diff --git a/src/app/webide/webide.component.html b/src/app/webide/webide.component.html index a85de03..a144a1e 100644 --- a/src/app/webide/webide.component.html +++ b/src/app/webide/webide.component.html @@ -9,7 +9,7 @@ -
+
+ + Saving... +
diff --git a/src/app/webide/webide.component.ts b/src/app/webide/webide.component.ts index bfe925d..3de38fc 100644 --- a/src/app/webide/webide.component.ts +++ b/src/app/webide/webide.component.ts @@ -34,11 +34,12 @@ export class WebideComponent implements OnInit { theme = 'monokai'; files: string[]; saveButtonState = 'SAVED'; + deployButtonState = 'DEPLOYED'; autosave = null; - command_handlers = { 'reload': this.reloadHandler.bind(this), - 'read': this.readHandler.bind(this), - 'select': this.selectHandler.bind(this), - 'write': () => {}}; + command_handlers = {'reload': this.reloadHandler.bind(this), + 'read': this.readHandler.bind(this), + 'select': this.selectHandler.bind(this), + 'write': this.writeHandler.bind(this)}; constructor(private webSocketService: WebSocketService, private changeDetectorRef: ChangeDetectorRef, @@ -49,7 +50,7 @@ export class WebideComponent implements OnInit { this.subscribeWS(); this.requestCode(); this.processManagerService.init(); - this.processManagerService.subscribeCallback('login', (event) => { this.setButtonStateSaved(); }); + this.processManagerService.subscribeCallback('login', (event) => { this.setDeployButtonStateDeployed(); }); this.resetAutoSaveCountdown(); } @@ -80,6 +81,10 @@ export class WebideComponent implements OnInit { this.saveButtonState = 'SAVED'; } + writeHandler() { + this.saveButtonState = 'SAVED'; + } + resetAutoSaveCountdown() { if (this.autosave) { clearInterval(this.autosave); @@ -95,18 +100,28 @@ export class WebideComponent implements OnInit { this.requestCode(); } - setButtonStateSaved() { - this.saveButtonState = 'SAVED'; - } - - setButtonStateDirty() { + setSaveButtonStateDirty() { this.saveButtonState = 'DIRTY'; } - sendCode() { - this.sendCodeContents(); - this.saveButtonState = 'SAVING'; + setDeployButtonStateDeployed() { + this.deployButtonState = 'DEPLOYED'; + } + + setDeployButtonStateTodeploy() { + this.deployButtonState = 'TODEPLOY'; + } + + deployCode() { this.processManagerService.restartProcess('login'); + this.deployButtonState = 'DEPLOYING'; + } + + sendCode() { + if (this.saveButtonState === 'DIRTY') { + this.sendCodeContents(); + this.saveButtonState = 'SAVING'; + } } sendCodeIfDirty() {