LP1852782 Progress indicator while saving MARC records
authorBill Erickson <berickxx@gmail.com>
Wed, 11 Dec 2019 22:03:19 +0000 (17:03 -0500)
committerBill Erickson <berickxx@gmail.com>
Fri, 21 Feb 2020 16:44:38 +0000 (11:44 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Open-ILS/src/eg2/src/app/staff/share/marc-edit/editor.component.html
Open-ILS/src/eg2/src/app/staff/share/marc-edit/editor.component.ts

index dea8581..7daa2c8 100644 (file)
     [disabled]="record && record.deleted" i18n>Save Changes</button>
 </div>
 
-<div class="row">
+
+<ng-container *ngIf="dataSaving">
+  <div class="row mt-5">
+    <div class="offset-lg-3 col-lg-6">
+      <eg-progress-inline></eg-progress-inline>
+    </div>
+  </div>
+</ng-container>
+
+<div *ngIf="!dataSaving" class="row">
   <div class="col-lg-12">
     <ngb-tabset [activeId]="editorTab" (tabChange)="tabChange($event)">
       <ngb-tab title="Enhanced MARC Editor" i18n-title id="rich">
index 1ecfb9e..02c9b45 100644 (file)
@@ -35,6 +35,9 @@ export class MarcEditorComponent implements OnInit {
     sources: ComboboxEntry[];
     context: MarcEditContext;
 
+    // True if the save request is in flight
+    dataSaving: boolean;
+
     @Input() recordType: 'biblio' | 'authority' = 'biblio';
 
     @Input() set recordId(id: number) {
@@ -87,6 +90,8 @@ export class MarcEditorComponent implements OnInit {
         this.sources = [];
         this.recordSaved = new EventEmitter<MarcSavedEvent>();
         this.context = new MarcEditContext();
+
+        this.recordSaved.subscribe(_ => this.dataSaving = false);
     }
 
     ngOnInit() {
@@ -135,6 +140,7 @@ export class MarcEditorComponent implements OnInit {
 
     saveRecord(): Promise<any> {
         const xml = this.record.toXml();
+        this.dataSaving = true;
 
         // Save actions clears any pending changes.
         this.context.changesPending = false;
@@ -166,6 +172,7 @@ export class MarcEditorComponent implements OnInit {
                 if (evt) {
                     console.error(evt);
                     this.failMsg.current().then(msg => this.toast.warning(msg));
+                    this.dataSaving = false;
                     return;
                 }