mirror of
				https://github.com/avatao-content/frontend-tutorial-framework
				synced 2025-11-04 06:12:54 +00:00 
			
		
		
		
	Refactor ProcessManagerService error and success callback semantics
This commit is contained in:
		@@ -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);
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user