From 95331c22c6c0a7557404dd0185ead17e120759ba Mon Sep 17 00:00:00 2001
From: Bill Erickson <berickxx@gmail.com>
Date: Wed, 11 Dec 2019 17:03:19 -0500
Subject: [PATCH] LP1852782 Progress indicator while saving MARC records

Signed-off-by: Bill Erickson <berickxx@gmail.com>

Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
---
 .../eg2/src/app/staff/share/marc-edit/editor.component.html   | 11 ++++++++++-
 .../src/eg2/src/app/staff/share/marc-edit/editor.component.ts |  7 +++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editor.component.html b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editor.component.html
index dea85817e1..7daa2c89b2 100644
--- a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editor.component.html
+++ b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editor.component.html
@@ -45,7 +45,16 @@
     [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">
diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editor.component.ts b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editor.component.ts
index 1ecfb9e6e6..02c9b459cd 100644
--- a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editor.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editor.component.ts
@@ -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;
                 }
 
-- 
2.11.0