From 18b93ecaf833764204e43132d4f90c082d58fcfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Wed, 21 Mar 2018 16:17:35 +0100 Subject: [PATCH 1/6] Remove obsolete TODO --- src/app/services/wsmessage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/services/wsmessage.ts b/src/app/services/wsmessage.ts index 1fceb3c..14224c2 100644 --- a/src/app/services/wsmessage.ts +++ b/src/app/services/wsmessage.ts @@ -1,5 +1,5 @@ export class WSMessage { key: string; trigger?: string; - data: T; // TODO: sane annotation + data: T; } From 0cf36912c349bfce04aa740c913518a37bcb62ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Wed, 21 Mar 2018 16:18:13 +0100 Subject: [PATCH 2/6] Make dashboard.component comply linter --- src/app/dashboard/dashboard.component.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index 62733b2..b54347b 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -33,8 +33,7 @@ export class DashboardComponent implements OnInit, OnDestroy { layoutHandler(data: LayoutCommand) { if (data.layout.match('vraw-open|vraw-closed|hraw|default-open|default-closed')) { this.layout = data.layout; - } - else { + } else { console.log('Invalid webide layout "' + data.layout + '" received!'); } } From ccc07817354b892d571d3095bd3c6363eebe99ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Wed, 21 Mar 2018 16:20:56 +0100 Subject: [PATCH 3/6] Add newline to end of layout-command.ts --- src/app/dashboard/layout-command.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/dashboard/layout-command.ts b/src/app/dashboard/layout-command.ts index e8e2f45..3d58db2 100644 --- a/src/app/dashboard/layout-command.ts +++ b/src/app/dashboard/layout-command.ts @@ -1,4 +1,4 @@ export class LayoutCommand { command: string; layout: string; -} \ No newline at end of file +} From 1b2b1c9f8dc01ed2367e6990898b22173a494129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Wed, 21 Mar 2018 16:27:57 +0100 Subject: [PATCH 4/6] Remove unused ngOnInit() --- src/app/header/header.component.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/app/header/header.component.ts b/src/app/header/header.component.ts index 591e148..b19f044 100644 --- a/src/app/header/header.component.ts +++ b/src/app/header/header.component.ts @@ -1,15 +1,10 @@ -import { Component, OnInit } from '@angular/core'; +import { Component } from '@angular/core'; @Component({ selector: 'app-header', templateUrl: './header.component.html', styleUrls: ['./header.component.scss'] }) -export class HeaderComponent implements OnInit { - - constructor() { } - - ngOnInit() { - } - +export class HeaderComponent { + constructor() {} } From 0682e53511a0c0c894a0a652a55743664205f404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Wed, 21 Mar 2018 16:32:56 +0100 Subject: [PATCH 5/6] Refactor project to use config file --- src/app/app-routing.module.ts | 11 ++++++----- src/app/config.ts | 23 +++++++++++++++++++++++ src/app/dashboard/dashboard.component.ts | 3 ++- src/app/messages/messages.component.ts | 3 ++- src/app/webide/webide.component.ts | 16 +++++++--------- 5 files changed, 40 insertions(+), 16 deletions(-) create mode 100644 src/app/config.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 7301482..d08e84e 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -6,14 +6,15 @@ import { WebideComponent } from './webide/webide.component'; import { TerminalComponent } from './terminal/terminal.component'; import { MessagesComponent } from './messages/messages.component'; import { TestmessengerComponent } from './testmessenger/testmessenger.component'; +import { config } from './config'; const routes: Routes = [ { path: '', redirectTo: '/dashboard', pathMatch: 'full'}, - { path: 'dashboard', component: DashboardComponent}, - { path: 'webide', component: WebideComponent }, - { path: 'shell', component: TerminalComponent }, - { path: 'messages', component: MessagesComponent }, - { path: 'testmessenger', component: TestmessengerComponent } + { path: config.dashboard.route, component: DashboardComponent}, + { path: config.webide.route, component: WebideComponent }, + { path: config.terminal.route, component: TerminalComponent }, + { path: config.messages.route, component: MessagesComponent }, + { path: config.testmessenger.route, component: TestmessengerComponent } ]; @NgModule({ diff --git a/src/app/config.ts b/src/app/config.ts new file mode 100644 index 0000000..658a2ba --- /dev/null +++ b/src/app/config.ts @@ -0,0 +1,23 @@ +export const config = { + dashboard: { + 'route': 'dashboard', + 'defaultLayout': 'vraw-open' + }, + webide: { + 'route': 'webide', + 'autoSaveInterval': 1000, + 'defaultCode': 'Loading your file...', + 'defaultLanguage': 'text', + 'deployProcessName': 'login' + }, + terminal: { + 'route': 'shell' + }, + messages: { + 'route': 'messages', + 'showNextButton': false + }, + testmessenger: { + 'route': 'testmessenger' + } +}; diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index b54347b..ea2f7b5 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -3,6 +3,7 @@ import { DeploymentNotificationService } from '../services/deployment-notificati import { Subscription } from 'rxjs/Subscription'; import { WebSocketService } from '../services/websocket.service'; import { LayoutCommand } from './layout-command'; +import { config } from '../config'; @Component({ selector: 'app-dashboard', @@ -12,7 +13,7 @@ import { LayoutCommand } from './layout-command'; export class DashboardComponent implements OnInit, OnDestroy { deploying = false; deploymentNotificationSubscription: Subscription; - layout = 'vraw-open'; + layout: string = config.dashboard.defaultLayout; command_handlers = {'layout': this.layoutHandler.bind(this)}; constructor(private deploymentNotificationService: DeploymentNotificationService, diff --git a/src/app/messages/messages.component.ts b/src/app/messages/messages.component.ts index bf812e6..7804923 100644 --- a/src/app/messages/messages.component.ts +++ b/src/app/messages/messages.component.ts @@ -4,6 +4,7 @@ import { WebSocketService } from '../services/websocket.service'; import { Message } from './message'; import { MessageControl } from './messagecontrol'; +import { config } from '../config'; @Component({ selector: 'app-messages', @@ -12,7 +13,7 @@ import { MessageControl } from './messagecontrol'; }) export class MessagesComponent implements OnInit { messages: Message[] = []; - showNextButton = false; + showNextButton: boolean = config.messages.showNextButton; command_handlers = {'showbutton': this.showButton.bind(this)}; constructor( diff --git a/src/app/webide/webide.component.ts b/src/app/webide/webide.component.ts index 9dfe170..96e8269 100644 --- a/src/app/webide/webide.component.ts +++ b/src/app/webide/webide.component.ts @@ -16,12 +16,10 @@ import { SourceCode } from './source-code'; import { WebSocketService } from '../services/websocket.service'; import { ProcessManagerService } from '../services/processmanager.service'; import { DeploymentNotificationService } from '../services/deployment-notification.service'; +import { config } from '../config'; const modelist = brace.acequire('ace/ext/modelist'); -const defaultSourceCode = 'Loading your file...'; -const autosave_interval = 1000; - @Component({ selector: 'app-webide', templateUrl: './webide.component.html', @@ -29,9 +27,9 @@ const autosave_interval = 1000; }) export class WebideComponent implements OnInit { key_id = 'webide'; - filename = 'demo.js'; - code: string = defaultSourceCode; - language = 'javascript'; + filename = ''; + code: string = config.webide.defaultCode; + language: string = config.webide.defaultLanguage; theme = 'cobalt'; directory = ''; files: string[]; @@ -54,8 +52,8 @@ export class WebideComponent implements OnInit { this.subscribeWS(); this.requestCode(); this.processManagerService.init(); - this.processManagerService.subscribeCallback('login', (event) => { this.setDeployButtonState('DEPLOYED'); }); - this.processManagerService.subscribeErrorCallback('login', (event) => { this.setDeployButtonState('FAILED'); }); + this.processManagerService.subscribeCallback(config.webide.deployProcessName, (event) => { this.setDeployButtonState('DEPLOYED'); }); + this.processManagerService.subscribeErrorCallback(config.webide.deployProcessName, (event) => { this.setDeployButtonState('FAILED'); }); this.resetAutoSaveCountdown(); } @@ -99,7 +97,7 @@ export class WebideComponent implements OnInit { if (this.autosave) { clearInterval(this.autosave); } - this.autosave = setInterval(() => { this.sendCodeIfDirty(); }, autosave_interval); + this.autosave = setInterval(() => { this.sendCodeIfDirty(); }, config.webide.autoSaveInterval); } tabSwitchButtonHandler(file) { From 7d145e95aed7f55999cde84cef8158fc141700bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Wed, 21 Mar 2018 16:44:51 +0100 Subject: [PATCH 6/6] Make webide deploy button optional --- src/app/config.ts | 3 ++- src/app/webide/webide.component.html | 3 ++- src/app/webide/webide.component.ts | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/config.ts b/src/app/config.ts index 658a2ba..713d03c 100644 --- a/src/app/config.ts +++ b/src/app/config.ts @@ -8,7 +8,8 @@ export const config = { 'autoSaveInterval': 1000, 'defaultCode': 'Loading your file...', 'defaultLanguage': 'text', - 'deployProcessName': 'login' + 'deployProcessName': 'login', + 'showDeployButton': true }, terminal: { 'route': 'shell' diff --git a/src/app/webide/webide.component.html b/src/app/webide/webide.component.html index 48437f8..937d2c1 100644 --- a/src/app/webide/webide.component.html +++ b/src/app/webide/webide.component.html @@ -14,7 +14,8 @@
-