From f318f94f4d138363a550e62d8f26c496271e81a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Wed, 7 Mar 2018 15:15:28 +0100 Subject: [PATCH] Implement handling of deployment failures --- src/app/services/processcommand.ts | 1 + src/app/services/processmanager.service.ts | 4 ++-- src/app/webide/webide.component.html | 4 +++- src/app/webide/webide.component.ts | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app/services/processcommand.ts b/src/app/services/processcommand.ts index f275533..d10a17e 100644 --- a/src/app/services/processcommand.ts +++ b/src/app/services/processcommand.ts @@ -1,4 +1,5 @@ export class ProcessCommand { command: string; process_name: string; + error: boolean } diff --git a/src/app/services/processmanager.service.ts b/src/app/services/processmanager.service.ts index 3e948a6..f757b8a 100644 --- a/src/app/services/processmanager.service.ts +++ b/src/app/services/processmanager.service.ts @@ -16,9 +16,9 @@ export class ProcessManagerService { this.webSocketService.connect(); } - subscribeCallback(process_name: string, callback: (event: any) => void) { + subscribeCallback(process_name: string, error: boolean, callback: (event: any) => void) { this.webSocketService.observeKey(this.key) - .pipe(filter(message => message.data.process_name === process_name)).subscribe(callback); + .pipe(filter(message => message.data.process_name === process_name && message.data.error === error)).subscribe(callback); } sendCommand(command: string, process_name: string) { diff --git a/src/app/webide/webide.component.html b/src/app/webide/webide.component.html index f2c6bfd..96bcb4c 100644 --- a/src/app/webide/webide.component.html +++ b/src/app/webide/webide.component.html @@ -27,7 +27,9 @@ [class.btn-success]="deployButtonState === 'DEPLOYED'" [class.btn-info]="deployButtonState === 'DEPLOYING'" [class.disabled]="deployButtonState === 'DEPLOYING' || deployButtonState === 'DEPLOYED'" + [class.btn-danger]="deployButtonState === 'FAILED'" >Deploy Deploy -
Reloading app...
+
Reloading app...
+ Deployment failed diff --git a/src/app/webide/webide.component.ts b/src/app/webide/webide.component.ts index e221950..5def77f 100644 --- a/src/app/webide/webide.component.ts +++ b/src/app/webide/webide.component.ts @@ -50,7 +50,8 @@ export class WebideComponent implements OnInit { this.subscribeWS(); this.requestCode(); this.processManagerService.init(); - this.processManagerService.subscribeCallback('login', (event) => { this.setDeployButtonState('DEPLOYED'); }); + this.processManagerService.subscribeCallback('login', false, (event) => { this.setDeployButtonState('DEPLOYED'); }); + this.processManagerService.subscribeCallback('login', true, (event) => { this.setDeployButtonState('FAILED'); }); this.resetAutoSaveCountdown(); }