mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2025-06-28 16:25:12 +00:00
Move all message types to a standardised location
This commit is contained in:
@ -16,7 +16,7 @@ import 'brace/mode/python';
|
||||
import 'brace/mode/sql';
|
||||
|
||||
import 'brace/theme/cobalt';
|
||||
import { SourceCode } from './source-code';
|
||||
import { IDECommand } from '../message.types/ide.command';
|
||||
import { WebSocketService } from '../services/websocket.service';
|
||||
import { ProcessManagerService } from '../services/processmanager.service';
|
||||
import { DeploymentNotificationService } from '../services/deployment-notification.service';
|
||||
@ -89,7 +89,7 @@ export class IdeComponent implements OnInit {
|
||||
}
|
||||
|
||||
subscribeWS() {
|
||||
this.webSocketService.observeKey<SourceCode>(this.key_id).subscribe((event) => {
|
||||
this.webSocketService.observeKey<IDECommand>(this.key_id).subscribe((event) => {
|
||||
this.command_handlers[event.data.command](event.data);
|
||||
this.changeDetectorRef.detectChanges();
|
||||
});
|
||||
@ -119,7 +119,7 @@ export class IdeComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
updateFileData(data: SourceCode) {
|
||||
updateFileData(data: IDECommand) {
|
||||
this.filename = data.filename;
|
||||
this.directory = data.directory;
|
||||
this.code = (data.content != null) ? data.content : this.code;
|
||||
@ -127,15 +127,15 @@ export class IdeComponent implements OnInit {
|
||||
this.files = data.files;
|
||||
}
|
||||
|
||||
selectHandler(data: SourceCode) {
|
||||
selectHandler(data: IDECommand) {
|
||||
this.updateFileData(data);
|
||||
}
|
||||
|
||||
reloadHandler(data: SourceCode) {
|
||||
reloadHandler(data: IDECommand) {
|
||||
this.requestCode();
|
||||
}
|
||||
|
||||
readHandler(data: SourceCode) {
|
||||
readHandler(data: IDECommand) {
|
||||
if (this.codeState === CodeState.SAVED) {
|
||||
this.updateFileData(data);
|
||||
}
|
||||
@ -145,7 +145,7 @@ export class IdeComponent implements OnInit {
|
||||
this.setCodeState(CodeState.SAVED);
|
||||
}
|
||||
|
||||
selectdirHandler(data: SourceCode) {
|
||||
selectdirHandler(data: IDECommand) {
|
||||
this.updateFileData(data);
|
||||
}
|
||||
|
||||
|
@ -1,10 +0,0 @@
|
||||
// Copyright (C) 2018 Avatao.com Innovative Learning Kft.
|
||||
// All Rights Reserved. See LICENSE file for details.
|
||||
|
||||
export interface SourceCode {
|
||||
filename: string;
|
||||
content?: string;
|
||||
files: string[];
|
||||
directory: string;
|
||||
command: string;
|
||||
}
|
Reference in New Issue
Block a user