Rework dashboard API and refactory typing

This commit is contained in:
Kristóf Tóth 2018-05-31 12:22:53 +02:00
parent 279a121538
commit 2fdcea4af8
3 changed files with 19 additions and 18 deletions

View File

@ -5,7 +5,7 @@ import { Component, OnDestroy, OnInit, ChangeDetectorRef, ElementRef, ViewChild
import { DeploymentNotificationService } from '../services/deployment-notification.service';
import { Subscription } from 'rxjs';
import { WebSocketService } from '../services/websocket.service';
import { LayoutCommand } from '../message.types/layout.command';
import { HideMessagesCommand, LayoutCommand, TerminalMenuItemCommand } from '../message.types/dashboard.commands';
import { config } from '../config';
import { ProcessLogService } from '../services/processlog.service';
import { LogMessage } from '../message.types/log.message';
@ -71,19 +71,19 @@ export class DashboardComponent implements OnInit, OnDestroy {
}
layoutHandler(data: LayoutCommand) {
if (config.dashboard.enabledLayouts.includes(data.layout)) {
this.setLayout(data.layout);
if (config.dashboard.enabledLayouts.includes(data.value)) {
this.setLayout(data.value);
} else {
console.log('Invalid ide layout "' + data.layout + '" received!');
console.log('Invalid ide layout "' + data.value + '" received!');
}
}
hideMessagesHandler(data: LayoutCommand) {
this.hide_messages = data.hide_messages;
hideMessagesHandler(data: HideMessagesCommand) {
this.hide_messages = data.value;
}
terminalMenuSelectHandler(data: LayoutCommand) {
this.selectTerminalMenuItem(data.terminal_menu_item);
terminalMenuSelectHandler(data: TerminalMenuItemCommand) {
this.selectTerminalMenuItem(data.value);
}
reloadFrontendHandlder(data: CommandMessage) {

View File

@ -0,0 +1,11 @@
// Copyright (C) 2018 Avatao.com Innovative Learning Kft.
// All Rights Reserved. See LICENSE file for details.
import { CommandMessage } from './command.message';
import { SetValueCommand } from './set.value.command';
export interface LayoutCommand extends CommandMessage, SetValueCommand<string> {}
export interface HideMessagesCommand extends CommandMessage, SetValueCommand<boolean> {}
export interface TerminalMenuItemCommand extends CommandMessage, SetValueCommand<string> {}

View File

@ -1,10 +0,0 @@
// Copyright (C) 2018 Avatao.com Innovative Learning Kft.
// All Rights Reserved. See LICENSE file for details.
import { CommandMessage } from './command.message';
export interface LayoutCommand extends CommandMessage {
layout?: string;
hide_messages?: boolean;
terminal_menu_item?: string;
}