LP#1850547: eg-grid: indicate error condition to user if data source throws one
authorGalen Charlton <gmc@equinoxinitiative.org>
Fri, 31 Jan 2020 22:21:36 +0000 (17:21 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 3 Sep 2020 15:51:39 +0000 (11:51 -0400)
Sponsored-by: Evergreen Community Development Initiative
Sponsored-by: Georgia Public Library Service
Sponsored-by: Indiana State Library
Sponsored-by: C/W MARS
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Tiffany Little <tlittle@georgialibraries.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/share/grid/grid.component.html
Open-ILS/src/eg2/src/app/share/grid/grid.ts

index 5713d24..2ab6be0 100644 (file)
         </div>
       </ng-container>
       <ng-container *ngIf="!dataSource.requestingData">
-        <div class="col-lg-12 text-center alert font-italic font-weight-bold">
+        <div class="col-lg-12 text-center alert alert-danger font-italic font-weight-bold" *ngIf="dataSource.retrievalError">
+          <span i18n>Error Retrieving Results</span>
+        </div>
+        <div class="col-lg-12 text-center alert font-italic font-weight-bold" *ngIf="!dataSource.retrievalError">
           <span i18n>Nothing to Display</span>
         </div>
       </ng-container>
index a71a7e4..866e685 100644 (file)
@@ -1153,6 +1153,7 @@ export class GridDataSource {
     filters: Object;
     allRowsRetrieved: boolean;
     requestingData: boolean;
+    retrievalError: boolean;
     getRows: (pager: Pager, sort: any[]) => Observable<any>;
 
     constructor() {
@@ -1191,6 +1192,7 @@ export class GridDataSource {
 
         // If we have to call out for data, set inFetch
         this.requestingData = true;
+        this.retrievalError = false;
 
         return new Promise((resolve, reject) => {
             let idx = pager.offset;
@@ -1198,14 +1200,18 @@ export class GridDataSource {
                 row => {
                     this.data[idx++] = row;
                     this.requestingData = false;
+                    this.retrievalError = false;
                 },
                 err => {
                     console.error(`grid getRows() error ${err}`);
+                    this.requestingData = false;
+                    this.retrievalError = true;
                     reject(err);
                 },
                 ()  => {
                     this.checkAllRetrieved(pager, idx);
                     this.requestingData = false;
+                    this.retrievalError = false;
                     resolve();
                 }
             );