mirror of
				https://github.com/avatao-content/frontend-tutorial-framework
				synced 2025-11-04 14:12:55 +00:00 
			
		
		
		
	Refactor console message types and API
This commit is contained in:
		@@ -3,7 +3,7 @@
 | 
			
		||||
 | 
			
		||||
import { Component, OnInit } from '@angular/core';
 | 
			
		||||
import { WebSocketService } from '../services/websocket.service';
 | 
			
		||||
import { ConsoleCommand } from '../message.types/console.command';
 | 
			
		||||
import { ConsoleContentCommand, RewriteContentCommand, ShowLiveLogsCommand } from '../message.types/console.commands';
 | 
			
		||||
import { config } from '../config';
 | 
			
		||||
import { ProcessLogService } from '../services/processlog.service';
 | 
			
		||||
import { LogMessage } from '../message.types/log.message';
 | 
			
		||||
@@ -36,11 +36,11 @@ export class ConsoleComponent implements OnInit {
 | 
			
		||||
    this.processLogService.newLogs.subscribe((data) => this.newLogsHandler(data));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  writeHandler(data: ConsoleCommand) {
 | 
			
		||||
  writeHandler(data: ConsoleContentCommand) {
 | 
			
		||||
    this.setContent(data.content);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  readHandler(data: CommandMessage) {
 | 
			
		||||
  readHandler(data: ConsoleContentCommand) {
 | 
			
		||||
    this.sendContent(this.console_content);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -53,12 +53,12 @@ export class ConsoleComponent implements OnInit {
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  showLiveLogsHandler(data: ConsoleCommand) {
 | 
			
		||||
    this.processLogService.showLiveLogs = data.showLiveLogs;
 | 
			
		||||
  showLiveLogsHandler(data: ShowLiveLogsCommand) {
 | 
			
		||||
    this.processLogService.showLiveLogs = data.value;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  rewriteContentWithProcessLogsOnDeployHandler(data: ConsoleCommand) {
 | 
			
		||||
    this.rewriteContentWithProcessLogsOnDeploy = data.rewriteContentWithProcessLogsOnDeploy;
 | 
			
		||||
  rewriteContentWithProcessLogsOnDeployHandler(data: RewriteContentCommand) {
 | 
			
		||||
    this.rewriteContentWithProcessLogsOnDeploy = data.value;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  setContent(content: string) {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								src/app/message.types/console.commands.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								src/app/message.types/console.commands.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
// 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 ConsoleContentCommand extends CommandMessage {
 | 
			
		||||
  content?: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface ShowLiveLogsCommand extends CommandMessage, SetValueCommand<boolean> {}
 | 
			
		||||
 | 
			
		||||
export interface RewriteContentCommand extends CommandMessage, SetValueCommand<string> {}
 | 
			
		||||
@@ -3,8 +3,6 @@
 | 
			
		||||
 | 
			
		||||
import { CommandMessage } from './command.message';
 | 
			
		||||
 | 
			
		||||
export interface ConsoleCommand extends CommandMessage {
 | 
			
		||||
  content?: string;
 | 
			
		||||
  showLiveLogs?: boolean;
 | 
			
		||||
  rewriteContentWithProcessLogsOnDeploy?: string;
 | 
			
		||||
export interface SetValueCommand<T> extends CommandMessage {
 | 
			
		||||
  value: T;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user