From: Bill Erickson Date: Thu, 2 Dec 2021 15:29:44 +0000 (-0500) Subject: LP1936233 Item status more columns; speed up refresh X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=2bccda52b830679a81d80834db47d27f61809c2d;p=working%2FEvergreen.git LP1936233 Item status more columns; speed up refresh Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/staff/cat/item/status.component.html b/Open-ILS/src/eg2/src/app/staff/cat/item/status.component.html index b9b50c8af2..c7590e807c 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/item/status.component.html +++ b/Open-ILS/src/eg2/src/app/staff/cat/item/status.component.html @@ -342,6 +342,9 @@ + + + @@ -360,7 +363,16 @@ - + + + + + + diff --git a/Open-ILS/src/eg2/src/app/staff/cat/item/status.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/item/status.component.ts index 1965f33e21..ac744d9be1 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/item/status.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/item/status.component.ts @@ -1,9 +1,10 @@ -import {Component, Input, OnInit, AfterViewInit, ViewChild} from '@angular/core'; +import {Component, ChangeDetectorRef, Input, OnInit, AfterViewInit, ViewChild} from '@angular/core'; import {Location} from '@angular/common'; import {Router, ActivatedRoute, ParamMap} from '@angular/router'; import {from, of, empty} from 'rxjs'; import {concatMap, tap} from 'rxjs/operators'; import {IdlObject, IdlService} from '@eg/core/idl.service'; +import {OrgService} from '@eg/core/org.service'; import {PcrudService} from '@eg/core/pcrud.service'; import {AuthService} from '@eg/core/auth.service'; import {NetService} from '@eg/core/net.service'; @@ -113,11 +114,13 @@ export class ItemStatusComponent implements OnInit, AfterViewInit { private router: Router, private route: ActivatedRoute, private ngLocation: Location, + private changeDetector: ChangeDetectorRef, private net: NetService, private idl: IdlService, private printer: PrintService, private store: StoreService, private pcrud: PcrudService, + private org: OrgService, private auth: AuthService, private circ: CircService, private evt: EventService, @@ -256,6 +259,13 @@ export class ItemStatusComponent implements OnInit, AfterViewInit { })).toPromise().then(_ => { if (this.grid) { this.grid.reload(); + // Modifying items that already exist in the grid creates + // scenarios where Angular does not realize a change + // has occurred until another digest cycle naturally + // occurrs. Force it to check. The setTimeout is + // needed because grid.reload() runs it its own timeout + // and we want this to happen after its timeout. + setTimeout(() => this.changeDetector.detectChanges()); } }); } @@ -417,9 +427,17 @@ export class ItemStatusComponent implements OnInit, AfterViewInit { return Promise.resolve(); } - return this.pcrud.search('circ', {target_copy: item.id()}, - {order_by: {circ: 'xact_start DESC'}, limit: 1}) - .toPromise().then(circ => item._circ = circ); + return this.pcrud.search('circ', + {target_copy: item.id()}, + { flesh: 1, + flesh_fields: {circ: ['workstation', 'checkin_workstation']}, + order_by: {circ: 'xact_start DESC'}, + limit: 1 + } + ).toPromise().then(circ => { + circ.circ_lib(this.org.get(circ.circ_lib())); + item._circ = circ; + }); } // A bit of cleanup to make the ISBN's look friendlier