Skip to content

Commit

Permalink
Fix the run workspace button
Browse files Browse the repository at this point in the history
Signed-off-by: Anna Shumilova <ashumilo@redhat.com>
  • Loading branch information
ashumilova committed Jun 12, 2019
1 parent 28e7f02 commit 00a7b0a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dashboard/src/app/ide/ide.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class IdeSvc {
}

startWorkspace(data: any): ng.IPromise<any> {
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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 00a7b0a

Please sign in to comment.