diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 1efe740..da2ed9b 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -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: [ diff --git a/src/app/config.ts b/src/app/config.ts index 4e40339..6d7f08e 100644 --- a/src/app/config.ts +++ b/src/app/config.ts @@ -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', diff --git a/src/app/ide/ide.component.ts b/src/app/ide/ide.component.ts index aa7f254..252b2ec 100644 --- a/src/app/ide/ide.component.ts +++ b/src/app/ide/ide.component.ts @@ -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); } diff --git a/src/app/message-types/deploy-message.ts b/src/app/message-types/deploy-message.ts index a2b85c0..d98a3a6 100644 --- a/src/app/message-types/deploy-message.ts +++ b/src/app/message-types/deploy-message.ts @@ -1,5 +1,5 @@ import { WebSocketMessage } from './websocket-message'; export interface DeployMessage extends WebSocketMessage { - status: string; + error?: string; } diff --git a/src/app/message-types/process-message.ts b/src/app/message-types/process-message.ts deleted file mode 100644 index 2da66f6..0000000 --- a/src/app/message-types/process-message.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { LogMessage } from './log-message'; -import { WebSocketMessage } from './websocket-message'; - -export interface ProcessMessage extends WebSocketMessage, LogMessage { - name: string; - error?: string; -} diff --git a/src/app/services/processmanager.service.ts b/src/app/services/processmanager.service.ts deleted file mode 100644 index d14cd6d..0000000 --- a/src/app/services/processmanager.service.ts +++ /dev/null @@ -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('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 - }); - } -}