From: Bill Erickson Date: Mon, 18 Feb 2019 15:40:12 +0000 (-0800) Subject: LP1806087 Catalog holds display WIP X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b60f277edb6cc59ede8443ca0679f475fa893aa5;p=working%2FEvergreen.git LP1806087 Catalog holds display WIP Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/holds.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/record/holds.component.html index 29fd2d3451..ee778cf403 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/record/holds.component.html +++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/holds.component.html @@ -1,9 +1,11 @@ + + +
- -
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/holds.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/record/holds.component.ts index 75517ce795..769aec44b7 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/record/holds.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/holds.component.ts @@ -9,6 +9,7 @@ import {StaffCatalogService} from '../catalog.service'; import {Pager} from '@eg/share/util/pager'; import {GridDataSource} from '@eg/share/grid/grid'; import {GridComponent} from '@eg/share/grid/grid.component'; +import {ProgressDialogComponent} from '@eg/share/dialog/progress.component'; @Component({ selector: 'eg-catalog-holds', @@ -21,8 +22,8 @@ export class HoldsComponent implements OnInit { gridDataSource: GridDataSource; pickupLib: IdlObject; holdsCount: number; - holdsContext: any; - @ViewChild('holdsGrid') copyGrid: GridComponent; + @ViewChild('holdsGrid') private copyGrid: GridComponent; + @ViewChild('progressDialog') private progressDialog: ProgressDialogComponent; @Input() set recordId(id: number) { this.recId = id; @@ -47,18 +48,14 @@ export class HoldsComponent implements OnInit { this.gridDataSource.getRows = (pager: Pager, sort: any[]) => { // sorting not currently supported - return this.fetchHolds(pager); + return this.fetchHolds(pager, sort); }; - - this.holdsContext = { - - } } - fetchHolds(pager: Pager): Observable { + fetchHolds(pager: Pager, sort: any[]): Observable { if (!this.recId) { return of([]); } - const orgs = + const orgs = this.org.descendants(this.staffCat.searchContext.searchOrg, true); const restrictions = { @@ -69,27 +66,43 @@ export class HoldsComponent implements OnInit { pickup_lib: orgs }; + const orderBy: any = []; + sort.forEach(obj => { + const subObj: any = {}; + subObj[obj.name] = {dir: obj.dir, nulls: 'last'}; + orderBy.push(subObj); + }); + + this.progressDialog.open(); + this.progressDialog.update({value: 0, max: 1}); let first = true; + let loadCount = 0; return this.net.request( 'open-ils.circ', 'open-ils.circ.hold.wide_hash.stream', - this.auth.token(), - restrictions - //restrictions, order_by, limit, offset + this.auth.token(), restrictions, orderBy, pager.limit, pager.offset ).pipe( filter(holdData => { // First API response is the hold count. if (first) { - this.holdsCount = holdData; - first = false; - return false; + this.holdsCount = Number(holdData); + return first = false; } return true; }), map(holdData => { - console.log(holdData); + + this.progressDialog.update( + {value: ++loadCount, max: this.holdsCount}); + + if (loadCount === this.holdsCount) { + this.progressDialog.close(); + } + + // Do we even need to modify anything? + // Probably not. return holdData; }) ); diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts index 5b16f71816..ed35231d05 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts @@ -97,7 +97,12 @@ export class SearchFormComponent implements OnInit, AfterViewInit { selector = '#first-query-input'; } - this.renderer.selectRootElement(selector).focus(); + try { + // TODO: sometime the selector is not available in the DOM + // until even later (even with setTimeouts). Need to fix this. + // Note the error is thrown selectRootElement(). + this.renderer.selectRootElement(selector).focus(); + } catch(E) {} } /**