Remove dead code related to the processmanager and message module

This commit is contained in:
R. Richard 2019-08-26 13:15:02 +02:00
parent 2c4e10428e
commit 1c176f8452
6 changed files with 6 additions and 70 deletions

View File

@ -15,7 +15,6 @@ import { IdeComponent } from './ide/ide.component';
import { MessagesComponent } from './messages/messages.component'; import { MessagesComponent } from './messages/messages.component';
import { WebSocketService } from './services/websocket.service'; import { WebSocketService } from './services/websocket.service';
import { TerminalComponent } from './terminal/terminal.component'; import { TerminalComponent } from './terminal/terminal.component';
import { ProcessManagerService } from './services/processmanager.service';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
import { TestmessengerComponent } from './testmessenger/testmessenger.component'; import { TestmessengerComponent } from './testmessenger/testmessenger.component';
import { DeploymentNotificationService } from './services/deployment-notification.service'; import { DeploymentNotificationService } from './services/deployment-notification.service';
@ -50,7 +49,6 @@ import { MonacoEditorModule } from 'ngx-monaco-editor';
MarkdownService, MarkdownService,
WebSocketService, WebSocketService,
TerminadoService, TerminadoService,
ProcessManagerService,
DeploymentNotificationService, DeploymentNotificationService,
], ],
bootstrap: [ bootstrap: [

View File

@ -26,7 +26,6 @@ export const config = {
autoSaveInterval: 444, autoSaveInterval: 444,
defaultCode: 'Loading your file...', defaultCode: 'Loading your file...',
defaultLanguage: 'text', defaultLanguage: 'text',
deployProcessName: 'webservice',
deployButtonText: { deployButtonText: {
'TODEPLOY': 'Deploy', 'TODEPLOY': 'Deploy',
'DEPLOYED': 'Deployed', 'DEPLOYED': 'Deployed',
@ -42,9 +41,7 @@ export const config = {
route: 'shell' route: 'shell'
}, },
messages: { messages: {
route: 'messages', route: 'messages'
showNextButton: false,
messageQueueWPM: 150
}, },
console: { console: {
route: 'console', route: 'console',

View File

@ -99,11 +99,11 @@ export class IdeComponent implements OnInit {
this.setCodeState(CodeState.SAVED); this.setCodeState(CodeState.SAVED);
} }
deployHandler(message: WebSocketMessage) { deployHandler(message: DeployMessage) {
if (message['status'] === 'success') { if ('error' in message) {
this.setDeployButtonState(DeployButtonState.DEPLOYED);
} else if (message['status'] === 'error') {
this.setDeployButtonState(DeployButtonState.FAILED); this.setDeployButtonState(DeployButtonState.FAILED);
} else {
this.setDeployButtonState(DeployButtonState.DEPLOYED);
} }
this.deploymentNotificationService.deploying.next(false); this.deploymentNotificationService.deploying.next(false);
} }

View File

@ -1,5 +1,5 @@
import { WebSocketMessage } from './websocket-message'; import { WebSocketMessage } from './websocket-message';
export interface DeployMessage extends WebSocketMessage { export interface DeployMessage extends WebSocketMessage {
status: string; error?: string;
} }

View File

@ -1,7 +0,0 @@
import { LogMessage } from './log-message';
import { WebSocketMessage } from './websocket-message';
export interface ProcessMessage extends WebSocketMessage, LogMessage {
name: string;
error?: string;
}

View File

@ -1,52 +0,0 @@
import { Injectable } from '@angular/core';
import { WebSocketService } from './websocket.service';
import { ProcessMessage } from '../message-types/process-message';
import { filter } from 'rxjs/operators';
@Injectable()
export class ProcessManagerService {
process_name: string;
constructor(private webSocketService: WebSocketService) {}
init() {
this.webSocketService.connect();
}
subscribeCallback(process_name: string, callback: (message: ProcessMessage) => void) {
this.observeProcessMessage(process_name).subscribe(callback);
}
subscribeSuccessCallback(process_name: string, callback: (message: ProcessMessage) => void) {
this.observeProcessMessage(process_name).pipe(filter(message => !('error' in message))).subscribe(callback);
}
subscribeErrorCallback(process_name: string, callback: (message: ProcessMessage) => void) {
this.observeProcessMessage(process_name).pipe(filter(message => 'error' in message)).subscribe(callback);
}
observeProcessMessage(process_name: string) {
return this.webSocketService.observeKey<ProcessMessage>('process')
.pipe(filter(message => message.name === process_name));
}
startProcess(process_name: string) {
this.sendCommand('start', process_name);
}
stopProcess(process_name: string) {
this.sendCommand('stop', process_name);
}
restartProcess(process_name: string) {
this.sendCommand('restart', process_name);
}
sendCommand(command: string, process_name: string) {
this.webSocketService.send({
'key': 'process.' + command,
'name': process_name
});
}
}