mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2024-12-05 02:01:32 +00:00
Remove dead code related to the processmanager and message module
This commit is contained in:
parent
f63cede5d5
commit
f90907607d
@ -15,7 +15,6 @@ import { IdeComponent } from './ide/ide.component';
|
||||
import { MessagesComponent } from './messages/messages.component';
|
||||
import { WebSocketService } from './services/websocket.service';
|
||||
import { TerminalComponent } from './terminal/terminal.component';
|
||||
import { ProcessManagerService } from './services/processmanager.service';
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { TestmessengerComponent } from './testmessenger/testmessenger.component';
|
||||
import { DeploymentNotificationService } from './services/deployment-notification.service';
|
||||
@ -50,7 +49,6 @@ import { MonacoEditorModule } from 'ngx-monaco-editor';
|
||||
MarkdownService,
|
||||
WebSocketService,
|
||||
TerminadoService,
|
||||
ProcessManagerService,
|
||||
DeploymentNotificationService,
|
||||
],
|
||||
bootstrap: [
|
||||
|
@ -26,7 +26,6 @@ export const config = {
|
||||
autoSaveInterval: 444,
|
||||
defaultCode: 'Loading your file...',
|
||||
defaultLanguage: 'text',
|
||||
deployProcessName: 'webservice',
|
||||
deployButtonText: {
|
||||
'TODEPLOY': 'Deploy',
|
||||
'DEPLOYED': 'Deployed',
|
||||
@ -42,9 +41,7 @@ export const config = {
|
||||
route: 'shell'
|
||||
},
|
||||
messages: {
|
||||
route: 'messages',
|
||||
showNextButton: false,
|
||||
messageQueueWPM: 150
|
||||
route: 'messages'
|
||||
},
|
||||
console: {
|
||||
route: 'console',
|
||||
|
@ -99,11 +99,11 @@ export class IdeComponent implements OnInit {
|
||||
this.setCodeState(CodeState.SAVED);
|
||||
}
|
||||
|
||||
deployHandler(message: WebSocketMessage) {
|
||||
if (message['status'] === 'success') {
|
||||
this.setDeployButtonState(DeployButtonState.DEPLOYED);
|
||||
} else if (message['status'] === 'error') {
|
||||
deployHandler(message: DeployMessage) {
|
||||
if ('error' in message) {
|
||||
this.setDeployButtonState(DeployButtonState.FAILED);
|
||||
} else {
|
||||
this.setDeployButtonState(DeployButtonState.DEPLOYED);
|
||||
}
|
||||
this.deploymentNotificationService.deploying.next(false);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { WebSocketMessage } from './websocket-message';
|
||||
|
||||
export interface DeployMessage extends WebSocketMessage {
|
||||
status: string;
|
||||
error?: string;
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
import { LogMessage } from './log-message';
|
||||
import { WebSocketMessage } from './websocket-message';
|
||||
|
||||
export interface ProcessMessage extends WebSocketMessage, LogMessage {
|
||||
name: string;
|
||||
error?: string;
|
||||
}
|
@ -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
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user