mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2025-01-16 02:51:57 +00:00
Remove 'Save' button from frontend
This commit is contained in:
parent
2c89cff3a9
commit
d4e91c35e2
@ -9,7 +9,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div (keyup)="setSaveButtonState('DIRTY'); setDeployButtonState('TODEPLOY'); resetAutoSaveCountdown()"
|
<div (keyup)="setCodeState('DIRTY'); setDeployButtonState('TODEPLOY'); resetAutoSaveCountdown()"
|
||||||
ace-editor
|
ace-editor
|
||||||
[(text)]="code"
|
[(text)]="code"
|
||||||
[mode]="language"
|
[mode]="language"
|
||||||
@ -21,7 +21,7 @@
|
|||||||
<div class="btn-group flex-wrap">
|
<div class="btn-group flex-wrap">
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
class="btn btn-secondary"
|
class="btn btn-secondary"
|
||||||
(click)="sendCode(); deployCode()"
|
(click)="sendCodeIfDirty(); deployCode()"
|
||||||
[disabled]="deployButtonState === 'DEPLOYING' || deployButtonState === 'DEPLOYED'"
|
[disabled]="deployButtonState === 'DEPLOYING' || deployButtonState === 'DEPLOYED'"
|
||||||
[class.btn-success]="deployButtonState === 'DEPLOYED'"
|
[class.btn-success]="deployButtonState === 'DEPLOYED'"
|
||||||
[class.btn-info]="deployButtonState === 'DEPLOYING'"
|
[class.btn-info]="deployButtonState === 'DEPLOYING'"
|
||||||
@ -29,14 +29,4 @@
|
|||||||
><span *ngIf="deployButtonState === 'TODEPLOY'">Deploy</span>
|
><span *ngIf="deployButtonState === 'TODEPLOY'">Deploy</span>
|
||||||
<span *ngIf="deployButtonState === 'DEPLOYED'">Deploy</span>
|
<span *ngIf="deployButtonState === 'DEPLOYED'">Deploy</span>
|
||||||
<span *ngIf="deployButtonState === 'DEPLOYING'"><div class="loader"></div>Reloading app...</span></button>
|
<span *ngIf="deployButtonState === 'DEPLOYING'"><div class="loader"></div>Reloading app...</span></button>
|
||||||
<button (click)="sendCode()"
|
|
||||||
[disabled]="saveButtonState === 'SAVING' || saveButtonState === 'SAVED'"
|
|
||||||
type="submit"
|
|
||||||
class="btn btn-secondary"
|
|
||||||
[class.btn-success]="saveButtonState === 'SAVED'"
|
|
||||||
[class.btn-warning]="saveButtonState === 'SAVING'"
|
|
||||||
[class.disabled]="saveButtonState === 'SAVING' || saveButtonState === 'SAVED'"
|
|
||||||
><span *ngIf="saveButtonState === 'DIRTY'">Save</span>
|
|
||||||
<span *ngIf="saveButtonState === 'SAVED'">Save</span>
|
|
||||||
<span *ngIf="saveButtonState === 'SAVING'">Saving...</span></button>
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -33,7 +33,7 @@ export class WebideComponent implements OnInit {
|
|||||||
language = 'javascript';
|
language = 'javascript';
|
||||||
theme = 'monokai';
|
theme = 'monokai';
|
||||||
files: string[];
|
files: string[];
|
||||||
saveButtonState = 'SAVED';
|
codeState = 'SAVED';
|
||||||
deployButtonState = 'DEPLOYED';
|
deployButtonState = 'DEPLOYED';
|
||||||
autosave = null;
|
autosave = null;
|
||||||
command_handlers = {'reload': this.reloadHandler.bind(this),
|
command_handlers = {'reload': this.reloadHandler.bind(this),
|
||||||
@ -78,11 +78,11 @@ export class WebideComponent implements OnInit {
|
|||||||
|
|
||||||
readHandler(data: SourceCode) {
|
readHandler(data: SourceCode) {
|
||||||
this.updateFileData(data);
|
this.updateFileData(data);
|
||||||
this.saveButtonState = 'SAVED';
|
this.setCodeState('SAVED');
|
||||||
}
|
}
|
||||||
|
|
||||||
writeHandler() {
|
writeHandler() {
|
||||||
this.saveButtonState = 'SAVED';
|
this.setCodeState('SAVED');
|
||||||
}
|
}
|
||||||
|
|
||||||
resetAutoSaveCountdown() {
|
resetAutoSaveCountdown() {
|
||||||
@ -93,15 +93,17 @@ export class WebideComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tabSwitchButtonHandler(file) {
|
tabSwitchButtonHandler(file) {
|
||||||
if (this.saveButtonState === 'DIRTY') {
|
if (this.codeState === 'DIRTY') {
|
||||||
this.sendCodeContents();
|
this.sendCodeContents();
|
||||||
}
|
}
|
||||||
this.selectCode(file);
|
this.selectCode(file);
|
||||||
this.requestCode();
|
this.requestCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
setSaveButtonState(state: string) {
|
setCodeState(state: string) {
|
||||||
this.saveButtonState = state;
|
if (state.match('SAVED|DIRTY')) {
|
||||||
|
this.codeState = state;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setDeployButtonState(state: string) {
|
setDeployButtonState(state: string) {
|
||||||
@ -113,15 +115,8 @@ export class WebideComponent implements OnInit {
|
|||||||
this.deployButtonState = 'DEPLOYING';
|
this.deployButtonState = 'DEPLOYING';
|
||||||
}
|
}
|
||||||
|
|
||||||
sendCode() {
|
|
||||||
if (this.saveButtonState === 'DIRTY') {
|
|
||||||
this.sendCodeContents();
|
|
||||||
this.saveButtonState = 'SAVING';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sendCodeIfDirty() {
|
sendCodeIfDirty() {
|
||||||
if (this.saveButtonState === 'DIRTY') {
|
if (this.codeState === 'DIRTY') {
|
||||||
this.sendCodeContents();
|
this.sendCodeContents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user