mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2025-01-16 02:21:57 +00:00
Improve handling of deployment failures
This commit is contained in:
parent
f318f94f4d
commit
955ddac7c6
@ -1,5 +1,5 @@
|
|||||||
export class ProcessCommand {
|
export class ProcessCommand {
|
||||||
command: string;
|
command: string;
|
||||||
process_name: string;
|
process_name: string;
|
||||||
error: boolean
|
error?: string;
|
||||||
}
|
}
|
||||||
|
@ -16,9 +16,17 @@ export class ProcessManagerService {
|
|||||||
this.webSocketService.connect();
|
this.webSocketService.connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
subscribeCallback(process_name: string, error: boolean, callback: (event: any) => void) {
|
subscribeCallback(process_name: string, callback: (event: any) => void) {
|
||||||
this.webSocketService.observeKey<ProcessCommand>(this.key)
|
this.observeProcessMessage(process_name).subscribe(callback);
|
||||||
.pipe(filter(message => message.data.process_name === process_name && message.data.error === error)).subscribe(callback);
|
}
|
||||||
|
|
||||||
|
subscribeErrorCallback(process_name: string, callback: (event: any) => void) {
|
||||||
|
this.observeProcessMessage(process_name).pipe(filter(message => 'error' in message.data)).subscribe(callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
observeProcessMessage(process_name: string) {
|
||||||
|
return this.webSocketService.observeKey<ProcessCommand>(this.key)
|
||||||
|
.pipe(filter(message => message.data.process_name === process_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
sendCommand(command: string, process_name: string) {
|
sendCommand(command: string, process_name: string) {
|
||||||
|
@ -50,8 +50,8 @@ export class WebideComponent implements OnInit {
|
|||||||
this.subscribeWS();
|
this.subscribeWS();
|
||||||
this.requestCode();
|
this.requestCode();
|
||||||
this.processManagerService.init();
|
this.processManagerService.init();
|
||||||
this.processManagerService.subscribeCallback('login', false, (event) => { this.setDeployButtonState('DEPLOYED'); });
|
this.processManagerService.subscribeCallback('login', (event) => { this.setDeployButtonState('DEPLOYED'); });
|
||||||
this.processManagerService.subscribeCallback('login', true, (event) => { this.setDeployButtonState('FAILED'); });
|
this.processManagerService.subscribeErrorCallback('login', (event) => { this.setDeployButtonState('FAILED'); });
|
||||||
this.resetAutoSaveCountdown();
|
this.resetAutoSaveCountdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user