mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2024-12-05 02:31:33 +00:00
Refactor ProcessManagerService error and success callback semantics
This commit is contained in:
parent
5ebe29ccc8
commit
4b79d77fcc
@ -74,11 +74,9 @@ export class IdeComponent implements OnInit {
|
||||
|
||||
initProcessManagerService() {
|
||||
this.processManagerService.init();
|
||||
this.processManagerService.subscribeCallback(config.ide.deployProcessName, (event) => {
|
||||
this.setDeployButtonState('DEPLOYED');
|
||||
this.deploymentNotificationService.deploying.next(false);
|
||||
});
|
||||
this.processManagerService.subscribeErrorCallback(config.ide.deployProcessName, (event) => { this.setDeployButtonState('FAILED'); });
|
||||
this.processManagerService.subscribeCallback(config.ide.deployProcessName, (event) => this.deploymentNotificationService.deploying.next(false));
|
||||
this.processManagerService.subscribeSuccessCallback(config.ide.deployProcessName, (event) => this.setDeployButtonState('DEPLOYED'));
|
||||
this.processManagerService.subscribeErrorCallback(config.ide.deployProcessName, (event) => this.setDeployButtonState('FAILED'));
|
||||
}
|
||||
|
||||
updateFileData(data: SourceCode) {
|
||||
|
@ -24,6 +24,10 @@ export class ProcessManagerService {
|
||||
this.observeProcessMessage(process_name).subscribe(callback);
|
||||
}
|
||||
|
||||
subscribeSuccessCallback(process_name: string, callback: (event: WSMessage<ProcessCommand>) => void) {
|
||||
this.observeProcessMessage(process_name).pipe(filter(message => !('error' in message.data))).subscribe(callback);
|
||||
}
|
||||
|
||||
subscribeErrorCallback(process_name: string, callback: (event: WSMessage<ProcessCommand>) => void) {
|
||||
this.observeProcessMessage(process_name).pipe(filter(message => 'error' in message.data)).subscribe(callback);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user