minor usability enhancements

This commit is contained in:
garrettmills
2020-02-08 23:33:35 -06:00
parent 3852d6aab7
commit dc4f8fe7ed
2 changed files with 36 additions and 18 deletions

View File

@@ -3,7 +3,7 @@ import HostRecord from '../../structures/HostRecord';
import PageRecord from '../../structures/PageRecord';
import {PageService} from '../../service/page.service';
import {ActivatedRoute, Router} from '@angular/router';
import {PopoverController} from '@ionic/angular';
import {LoadingController, PopoverController} from '@ionic/angular';
import {NodePickerComponent} from '../../components/editor/node-picker/node-picker.component';
@Component({
@@ -24,6 +24,7 @@ export class EditorPage implements OnInit {
protected route: ActivatedRoute,
protected router: Router,
protected popover: PopoverController,
protected loader: LoadingController,
) {
this.route.params.subscribe(params => {
this.pageId = params.id;
@@ -174,15 +175,20 @@ export class EditorPage implements OnInit {
}
onSaveClick() {
this.pageRecord.Name = this.titleBar.el.innerText.trim();
this.loader.create({message: 'Saving changes...'}).then(loader => {
loader.present().then(() => {
this.pageRecord.Name = this.titleBar.el.innerText.trim();
// First, save the page record itself
this.pages.save(this.pageRecord).subscribe(pageRecord => {
this.pageRecord = pageRecord;
// First, save the page record itself
this.pages.save(this.pageRecord).subscribe(pageRecord => {
this.pageRecord = pageRecord;
// Now, save the nodes
this.pages.save_nodes(pageRecord, this.hostRecords).subscribe(result => {
this.hostRecords = result;
// Now, save the nodes
this.pages.save_nodes(pageRecord, this.hostRecords).subscribe(result => {
this.hostRecords = result;
loader.dismiss();
});
});
});
});
}