mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2025-01-15 23:41:55 +00:00
Implement handling of deployment failures
This commit is contained in:
parent
18aaebd758
commit
f318f94f4d
@ -1,4 +1,5 @@
|
||||
export class ProcessCommand {
|
||||
command: string;
|
||||
process_name: string;
|
||||
error: boolean
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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>
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user