diff --git a/dashboard/src/app/ide/ide.service.ts b/dashboard/src/app/ide/ide.service.ts index fc89df87e6f0..48b1882d10a5 100644 --- a/dashboard/src/app/ide/ide.service.ts +++ b/dashboard/src/app/ide/ide.service.ts @@ -122,7 +122,7 @@ class IdeSvc { } startWorkspace(data: any): ng.IPromise { - let startWorkspacePromise = this.cheAPI.getWorkspace().startWorkspace(data.id, data.config.defaultEnv); + let startWorkspacePromise = this.cheAPI.getWorkspace().startWorkspace(data.id, data.config ? data.config.defaultEnv: null); return startWorkspacePromise; } diff --git a/dashboard/src/app/workspaces/list-workspaces/workspace-status-action/workspace-status.controller.ts b/dashboard/src/app/workspaces/list-workspaces/workspace-status-action/workspace-status.controller.ts index 2c8abd347be4..7e339c587ea8 100644 --- a/dashboard/src/app/workspaces/list-workspaces/workspace-status-action/workspace-status.controller.ts +++ b/dashboard/src/app/workspaces/list-workspaces/workspace-status-action/workspace-status.controller.ts @@ -50,13 +50,13 @@ export class WorkspaceStatusController { return; } const workspace = this.cheWorkspace.getWorkspaceById(this.workspaceId); - if (!workspace || !workspace.config) { + if (!workspace) { return; } const status = this.getWorkspaceStatus(); const isRunButton = status !== WorkspaceStatus.RUNNING && status !== WorkspaceStatus.STOPPING && status !== WorkspaceStatus.STARTING; - const environment = workspace.config.defaultEnv; + const environment = workspace.config ? workspace.config.defaultEnv : null; if (isRunButton) { this.updateRecentWorkspace(this.workspaceId); @@ -65,7 +65,6 @@ export class WorkspaceStatusController { this.cheWorkspace.fetchStatusChange(this.workspaceId, 'ERROR').then((data: any) => { this.cheNotification.showError(data.error); }); - const promise = isRunButton ? this.cheWorkspace.startWorkspace(this.workspaceId, environment) : this.cheWorkspace.stopWorkspace(this.workspaceId); promise.catch((error: any) => { this.cheNotification.showError(`${isRunButton ? 'Run' : 'Stop'} workspace error.`, error);