From 4b92f5552b4a9c991edee1a2925f179c0a58f656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Wed, 30 May 2018 14:19:19 +0200 Subject: [PATCH] Make log messages typed --- src/app/console/console.component.ts | 3 ++- src/app/dashboard/dashboard.component.ts | 3 ++- src/app/services/log.message.ts | 7 +++++++ src/app/services/processlog.service.ts | 7 ++++--- 4 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 src/app/services/log.message.ts diff --git a/src/app/console/console.component.ts b/src/app/console/console.component.ts index 428ff9b..5c960bd 100644 --- a/src/app/console/console.component.ts +++ b/src/app/console/console.component.ts @@ -6,6 +6,7 @@ import { WebSocketService } from '../services/websocket.service'; import { ConsoleCommand } from './console-command'; import { config } from '../config'; import { ProcessLogService } from '../services/processlog.service'; +import { LogMessage } from '../services/log.message'; @Component({ selector: 'app-console', @@ -42,7 +43,7 @@ export class ConsoleComponent implements OnInit { this.sendContent(this.console_content); } - newLogsHandler(logs: any) { + newLogsHandler(logs: LogMessage) { if (this.rewriteContentWithProcessLogsOnDeploy !== '') { const log = logs[this.rewriteContentWithProcessLogsOnDeploy]; if (log) { diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index 275195e..5e5e440 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -8,6 +8,7 @@ import { WebSocketService } from '../services/websocket.service'; import { LayoutCommand } from './layout-command'; import { config } from '../config'; import { ProcessLogService } from '../services/processlog.service'; +import { LogMessage } from '../services/log.message'; @Component({ selector: 'app-dashboard', @@ -102,7 +103,7 @@ export class DashboardComponent implements OnInit, OnDestroy { this.selectedTerminalMenuItem = item; } - setConsoleContentIfNoLiveLogs(logs: any) { + setConsoleContentIfNoLiveLogs(logs: LogMessage) { this.processLogService.emitNewLogsIfNoLiveLogs(logs); if (config.ide.showConsoleOnDeploy) { this.selectTerminalMenuItem('console'); diff --git a/src/app/services/log.message.ts b/src/app/services/log.message.ts new file mode 100644 index 0000000..e7d537b --- /dev/null +++ b/src/app/services/log.message.ts @@ -0,0 +1,7 @@ +// Copyright (C) 2018 Avatao.com Innovative Learning Kft. +// All Rights Reserved. See LICENSE file for details. + +export interface LogMessage { + stdout: string; + stderr: string; +} diff --git a/src/app/services/processlog.service.ts b/src/app/services/processlog.service.ts index 3add780..372e180 100644 --- a/src/app/services/processlog.service.ts +++ b/src/app/services/processlog.service.ts @@ -6,10 +6,11 @@ import { WebSocketService } from './websocket.service'; import { ProcessLogCommand } from './processlog-command'; import { config } from '../config'; import { BehaviorSubject } from 'rxjs/BehaviorSubject'; +import { LogMessage } from './log.message'; @Injectable() export class ProcessLogService { - newLogs = new BehaviorSubject(config.console.defaultLogs); + newLogs = new BehaviorSubject(config.console.defaultLogs); showLiveLogs = config.console.showLiveLogs; command_handlers = { @@ -23,9 +24,9 @@ export class ProcessLogService { ); } - emitNewLogsIfNoLiveLogs(log: any) { + emitNewLogsIfNoLiveLogs(logs: LogMessage) { if (!config.console.showLiveLogs) { - this.newLogs.next(log); + this.newLogs.next(logs); } }