Implement handling of deployment failures

This commit is contained in:
Kristóf Tóth 2018-03-07 15:15:28 +01:00
parent 18aaebd758
commit f318f94f4d
4 changed files with 8 additions and 4 deletions

View File

@ -1,4 +1,5 @@
export class ProcessCommand {
command: string;
process_name: string;
error: boolean
}

View File

@ -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<ProcessCommand>(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) {

View File

@ -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'"
><span *ngIf="deployButtonState === 'TODEPLOY'">Deploy</span>
<span *ngIf="deployButtonState === 'DEPLOYED'">Deploy</span>
<span *ngIf="deployButtonState === 'DEPLOYING'"><div class="loader"></div>Reloading app...</span></button>
<span *ngIf="deployButtonState === 'DEPLOYING'"><div class="loader"></div>Reloading app...</span>
<span *ngIf="deployButtonState === 'FAILED'">Deployment failed</span></button>
</div>

View File

@ -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();
}