Implement ProcessLogService and hook it up to existing log features

This commit is contained in:
Kristóf Tóth
2018-05-29 16:48:45 +02:00
parent 1b8a36331c
commit cfdb69987d
6 changed files with 59 additions and 15 deletions

View File

@ -7,7 +7,7 @@ import { Subscription } from 'rxjs';
import { WebSocketService } from '../services/websocket.service';
import { LayoutCommand } from './layout-command';
import { config } from '../config';
import { ConsoleComponent } from '../console/console.component';
import { ProcessLogService } from '../services/processlog.service';
@Component({
selector: 'app-dashboard',
@ -21,7 +21,6 @@ export class DashboardComponent implements OnInit, OnDestroy {
hide_messages: boolean = config.dashboard.hide_messages;
iframeUrl: string = config.dashboard.iframeUrl;
@ViewChild('webiframe') webiframe: ElementRef;
@ViewChild(ConsoleComponent) childConsole: ConsoleComponent;
selectedTerminalMenuItem = config.dashboard.terminalOrConsole;
command_handlers = {'layout': this.layoutHandler.bind(this),
@ -31,7 +30,8 @@ export class DashboardComponent implements OnInit, OnDestroy {
constructor(private deploymentNotificationService: DeploymentNotificationService,
private webSocketService: WebSocketService,
private changeDetectorRef: ChangeDetectorRef) {}
private changeDetectorRef: ChangeDetectorRef,
private processLogService: ProcessLogService) {}
ngOnInit() {
this.webSocketService.connect();
@ -103,9 +103,11 @@ export class DashboardComponent implements OnInit, OnDestroy {
}
setConsoleContent(logs: any) {
this.childConsole.newLogHandler(logs);
if (config.ide.showConsoleOnDeploy) {
this.selectTerminalMenuItem('console');
if (!config.console.showLiveLogs) {
this.processLogService.newLog.next(logs);
if (config.ide.showConsoleOnDeploy) {
this.selectTerminalMenuItem('console');
}
}
}
}