mirror of
				https://github.com/avatao-content/frontend-tutorial-framework
				synced 2025-11-04 05:32:55 +00:00 
			
		
		
		
	Rework dashboard API and refactory typing
This commit is contained in:
		@@ -5,7 +5,7 @@ import { Component, OnDestroy, OnInit, ChangeDetectorRef, ElementRef, ViewChild
 | 
				
			|||||||
import { DeploymentNotificationService } from '../services/deployment-notification.service';
 | 
					import { DeploymentNotificationService } from '../services/deployment-notification.service';
 | 
				
			||||||
import { Subscription } from 'rxjs';
 | 
					import { Subscription } from 'rxjs';
 | 
				
			||||||
import { WebSocketService } from '../services/websocket.service';
 | 
					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 { config } from '../config';
 | 
				
			||||||
import { ProcessLogService } from '../services/processlog.service';
 | 
					import { ProcessLogService } from '../services/processlog.service';
 | 
				
			||||||
import { LogMessage } from '../message.types/log.message';
 | 
					import { LogMessage } from '../message.types/log.message';
 | 
				
			||||||
@@ -71,19 +71,19 @@ export class DashboardComponent implements OnInit, OnDestroy {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  layoutHandler(data: LayoutCommand) {
 | 
					  layoutHandler(data: LayoutCommand) {
 | 
				
			||||||
    if (config.dashboard.enabledLayouts.includes(data.layout)) {
 | 
					    if (config.dashboard.enabledLayouts.includes(data.value)) {
 | 
				
			||||||
      this.setLayout(data.layout);
 | 
					      this.setLayout(data.value);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      console.log('Invalid ide layout "' + data.layout + '" received!');
 | 
					      console.log('Invalid ide layout "' + data.value + '" received!');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  hideMessagesHandler(data: LayoutCommand) {
 | 
					  hideMessagesHandler(data: HideMessagesCommand) {
 | 
				
			||||||
    this.hide_messages = data.hide_messages;
 | 
					    this.hide_messages = data.value;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  terminalMenuSelectHandler(data: LayoutCommand) {
 | 
					  terminalMenuSelectHandler(data: TerminalMenuItemCommand) {
 | 
				
			||||||
    this.selectTerminalMenuItem(data.terminal_menu_item);
 | 
					    this.selectTerminalMenuItem(data.value);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  reloadFrontendHandlder(data: CommandMessage) {
 | 
					  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;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user