Listen changing workspace status (#15254)

Signed-off-by: Vitaliy Gulyy <vgulyy@redhat.com>
7.20.x
Vitaliy Gulyy 2019-11-27 14:00:37 +02:00 committed by GitHub
parent 51bb0bb13f
commit a461d50914
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -11,7 +11,7 @@
*/
'use strict';
import { CheWorkspace } from '../../../components/api/workspace/che-workspace.factory';
import { CheWorkspace, WorkspaceStatus } from '../../../components/api/workspace/che-workspace.factory';
import IdeSvc from '../ide.service';
/*global $:false */
@ -135,9 +135,12 @@ class IdeIFrameSvc {
const token = message.substring(message.indexOf(':') + 1);
this.cheWorkspace.validateMachineToken(workspaceId, token).then(() => {
this.cheWorkspace.stopWorkspace(workspaceId).then(() => {
this.cheWorkspace.fetchStatusChange(workspaceId, WorkspaceStatus[WorkspaceStatus.STOPPING]).then(() => {
this.ideSvc.reloadIdeFrame();
}).catch((error) => {
});
this.cheWorkspace.stopWorkspace(workspaceId).catch((error) => {
console.error('Unable to stop workspace. ', error);
});
}).catch(() => {