mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2024-12-05 02:41:32 +00:00
Rework dashboard API and refactory typing
This commit is contained in:
parent
279a121538
commit
2fdcea4af8
@ -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) {
|
||||
|
11
src/app/message.types/dashboard.commands.ts
Normal file
11
src/app/message.types/dashboard.commands.ts
Normal 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> {}
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user