diff --git a/src/app/ide/ide.component.ts b/src/app/ide/ide.component.ts index 6cc7546..8b38d66 100644 --- a/src/app/ide/ide.component.ts +++ b/src/app/ide/ide.component.ts @@ -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) { diff --git a/src/app/services/processmanager.service.ts b/src/app/services/processmanager.service.ts index 17c9bb5..4fc96b3 100644 --- a/src/app/services/processmanager.service.ts +++ b/src/app/services/processmanager.service.ts @@ -24,6 +24,10 @@ export class ProcessManagerService { this.observeProcessMessage(process_name).subscribe(callback); } + subscribeSuccessCallback(process_name: string, callback: (event: WSMessage) => void) { + this.observeProcessMessage(process_name).pipe(filter(message => !('error' in message.data))).subscribe(callback); + } + subscribeErrorCallback(process_name: string, callback: (event: WSMessage) => void) { this.observeProcessMessage(process_name).pipe(filter(message => 'error' in message.data)).subscribe(callback); }