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 05be06f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
8 changes: 3 additions & 5 deletions src/node/services/API/workspace-watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,16 @@ 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);
} 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
4 changes: 2 additions & 2 deletions src/node/services/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ export async function findApi(apisApi: k8s.ApisApi, apiName: string, version?: s
}
}

export async function delay(ms = 500): Promise<void> {
export async function delay(ms: number = 500): Promise<void> {
await new Promise<void>(resolve => setTimeout(resolve, ms));
};
}
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 05be06f

Please sign in to comment.