+<eg-progress-dialog #progressDialog>
+</eg-progress-dialog>
+
<div class='eg-holds w-100 mt-3'>
- <eg-grid #holdsGrid [dataSource]="gridDataSource"
- [useLocalSort]="true"
- persistKey="cat.catalog.wide_holds"
+ <eg-grid #holdsGrid [dataSource]="gridDataSource" [sortable]="true"
+ [multiSortable]="true" persistKey="cat.catalog.wide_holds"
>
<!--
</eg-grid-column>
<eg-grid-column i18n-label label="Queue Position"
path='relative_queue_position' [hidden]="true"></eg-grid-column>
-
- <!--
-
-
<eg-grid-column path='usr_id' i18n-label label="User ID" [hidden]="true"></eg-grid-column>
<eg-grid-column path='usr_usrname' i18n-label label="Username" [hidden]="true"></eg-grid-column>
+
<eg-grid-column path='usr_first_given_name' i18n-label label="First Name" [hidden]="true"></eg-grid-column>
<eg-grid-column path='usr_family_name' i18n-label label="Last Name" [hidden]="true"></eg-grid-column>
<eg-grid-column path='rusr_id' i18n-label label="Requestor ID" [hidden]="true"></eg-grid-column>
<eg-grid-column i18n-label label="Notify Count" path='notification_count' [hidden]="true"></eg-grid-column>
<eg-grid-column i18n-label label="Last Notify Time" path='last_notification_time' datatype="timestamp" [hidden]="true"></eg-grid-column>
--->
-
</eg-grid>
</div>
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',
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;
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<any> {
+ fetchHolds(pager: Pager, sort: any[]): Observable<any> {
if (!this.recId) { return of([]); }
- const orgs =
+ const orgs =
this.org.descendants(this.staffCat.searchContext.searchOrg, true);
const restrictions = {
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;
})
);