Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Commit

Permalink
fix: renames the callback
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksii Orel <oorel@redhat.com>
  • Loading branch information
olexii4 committed Aug 4, 2021
1 parent 9c6d211 commit cb552b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/node/services/API/workspace-watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ export class NodeDevWorkspaceWatcher implements IDevWorkspaceWatcher {
return this.customObjectWatch.watch(path, {}, (type: string, devworkspace: IDevWorkspace) => {
const status = devworkspace!.status!.phase;
const workspaceId = devworkspace!.status!.devworkspaceId;
if (devworkspace.kind !== 'DevWorkspace' || !workspaceId || !status) {
if (!workspaceId || !status) {
return;
}

if (type === 'ADDED') {
callbacks.onAdded(devworkspace);
if ( status === 'Stopped') {
callbacks.onAdded(devworkspace);
}
} else if (type === 'MODIFIED') {
callbacks.onStatusChange({ workspaceId, status });
callbacks.onModified(devworkspace);
} else if (type === 'DELETED') {
if (status === 'Terminating') {
callbacks.onDeleted(workspaceId);
}
callbacks.onDeleted(workspaceId);
} else {
callbacks.onError(`Error: Unknown type '${type}'.`);
}
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface IDevWorkspaceClient {
}

export type IDevWorkspaceCallbacks = {
onStatusChange: (statusUpdate: { status: string; workspaceId: string }) => void;
onModified: (workspace: IDevWorkspace) => void;
onDeleted: (workspaceId: string) => void;
onAdded: (workspace: IDevWorkspace) => void;
onError: (error: string) => void;
Expand Down

0 comments on commit cb552b2

Please sign in to comment.