From 134141b49572cab1c415639179594a04b525d791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Fri, 9 Mar 2018 09:36:14 +0100 Subject: [PATCH 1/2] Refresh SourceCode class --- src/app/webide/source-code.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/webide/source-code.ts b/src/app/webide/source-code.ts index 2b49091..ab0b524 100644 --- a/src/app/webide/source-code.ts +++ b/src/app/webide/source-code.ts @@ -1,6 +1,7 @@ export interface SourceCode { - filename?: string; + filename: string; content?: string; - files?: string[]; + files: string[]; + directory: string; command: string; } From 703beec5b3a933e316ff31e716fb047a77463180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Fri, 9 Mar 2018 09:36:39 +0100 Subject: [PATCH 2/2] Implement workdir change support in webide --- src/app/webide/webide.component.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/app/webide/webide.component.ts b/src/app/webide/webide.component.ts index 0c41590..caca58b 100644 --- a/src/app/webide/webide.component.ts +++ b/src/app/webide/webide.component.ts @@ -32,14 +32,16 @@ export class WebideComponent implements OnInit { code: string = defaultSourceCode; language = 'javascript'; theme = 'monokai'; + directory = ''; files: string[]; codeState = 'SAVED'; deployButtonState = 'DEPLOYED'; autosave = null; - command_handlers = {'reload': this.reloadHandler.bind(this), - 'read': this.readHandler.bind(this), - 'select': this.selectHandler.bind(this), - 'write': this.writeHandler.bind(this)}; + command_handlers = {'reload': this.reloadHandler.bind(this), + 'read': this.readHandler.bind(this), + 'select': this.selectHandler.bind(this), + 'write': this.writeHandler.bind(this), + 'selectdir': this.selectdirHandler.bind(this)}; constructor(private webSocketService: WebSocketService, private changeDetectorRef: ChangeDetectorRef, @@ -64,6 +66,7 @@ export class WebideComponent implements OnInit { updateFileData(data: SourceCode) { this.filename = data.filename; + this.directory = data.directory; this.code = data.content; this.language = modelist.getModeForPath(this.filename).name; this.files = data.files; @@ -86,6 +89,10 @@ export class WebideComponent implements OnInit { this.setCodeState('SAVED'); } + selectdirHandler(data: SourceCode) { + this.updateFileData(data); + } + resetAutoSaveCountdown() { if (this.autosave) { clearInterval(this.autosave);