Use enums in IdeComponent state machines

This commit is contained in:
Kristóf Tóth
2018-05-23 11:16:44 +02:00
parent 8bf82365f4
commit b2862b755b
2 changed files with 68 additions and 39 deletions

View File

@ -9,10 +9,10 @@
[class.active]="filename === file"
[class.disabled]="filename === file"
[disabled]="filename === file"
[class.tao-tab-btn-saved]="filename === file && codeState === 'SAVED'">
[class.tao-tab-btn-saved]="filename === file && codeState === CodeState.SAVED">
<span *ngIf="filename !== file">{{file}}</span>
<span *ngIf="filename === file"
[class.underline]="codeState === 'DIRTY'">{{file}}</span>
[class.underline]="codeState === CodeState.DIRTY">{{file}}</span>
</button>
</div>
@ -21,28 +21,27 @@
type="submit"
class="btn tfw-deploy-btn tao-grid-top-center"
(click)="sendCodeIfDirty(); deployCode()"
[disabled]="deployButtonState === 'DEPLOYING' || deployButtonState === 'DEPLOYED'"
[class.deployed]="deployButtonState === 'DEPLOYED'"
[class.deploy]="deployButtonState === 'DEPLOYING'"
[class.disabled]="deployButtonState === 'DEPLOYING' || deployButtonState === 'DEPLOYED'"
[class.failed]="deployButtonState === 'FAILED'"
>
<span *ngIf="deployButtonState === 'TODEPLOY'">Deploy</span>
<span *ngIf="deployButtonState === 'DEPLOYED'">
[disabled]="deployButtonState === DeployButtonState.DEPLOYING || deployButtonState === DeployButtonState.DEPLOYED"
[class.deployed]="deployButtonState === DeployButtonState.DEPLOYED"
[class.deploy]="deployButtonState === DeployButtonState.DEPLOYING"
[class.disabled]="deployButtonState === DeployButtonState.DEPLOYING || deployButtonState === DeployButtonState.DEPLOYED"
[class.failed]="deployButtonState === DeployButtonState.FAILED">
<span *ngIf="deployButtonState === DeployButtonState.TODEPLOY">Deploy</span>
<span *ngIf="deployButtonState === DeployButtonState.DEPLOYED">
<img src="images/greentick_icon.svg"/>
<span>Deployed</span>
</span>
<span *ngIf="deployButtonState === 'DEPLOYING'"><div class="loader"></div>Reloading app...</span>
<span *ngIf="deployButtonState === 'FAILED'">Deployment failed. Retry</span></button>
<span *ngIf="deployButtonState === DeployButtonState.DEPLOYING"><div class="loader"></div>Reloading app...</span>
<span *ngIf="deployButtonState === DeployButtonState.FAILED">Deployment failed. Retry</span>
</button>
</div>
</div>
<div (keyup)="setCodeState('DIRTY'); setDeployButtonState('TODEPLOY'); resetAutoSaveCountdown()"
<div (keyup)="setCodeState(CodeState.DIRTY); setDeployButtonState(DeployButtonState.TODEPLOY); resetAutoSaveCountdown()"
ace-editor
[(text)]="code"
[mode]="language"
[theme]="theme"
[options]="options"
class="tfw-ace-editor"
>
class="tfw-ace-editor">
</div>