From: Bill Erickson Date: Tue, 18 Aug 2020 20:44:34 +0000 (-0400) Subject: LP1888723 Angular holdings broadcast changes X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=bdbc243a41ed4f8ebc74641782ca6633606b6de0;p=Evergreen.git LP1888723 Angular holdings broadcast changes Broadcast to other tabs information about which holdings have changed during editing in the Angular volcopy UI. Signed-off-by: Bill Erickson Signed-off-by: Ruth Frasur Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.ts index f782effb89..08eabd6a8b 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.ts @@ -13,6 +13,7 @@ import {ProgressInlineComponent} from '@eg/share/dialog/progress-inline.componen import {AnonCacheService} from '@eg/share/util/anon-cache.service'; import {VolCopyService} from './volcopy.service'; import {NgbNav, NgbNavChangeEvent} from '@ng-bootstrap/ng-bootstrap'; +import {BroadcastService} from '@eg/share/util/broadcast.service'; const COPY_FLESH = { flesh: 1, @@ -72,6 +73,7 @@ export class VolCopyComponent implements OnInit { private auth: AuthService, private pcrud: PcrudService, private cache: AnonCacheService, + private broadcaster: BroadcastService, private holdings: HoldingsService, private volcopy: VolCopyService ) { } @@ -412,6 +414,26 @@ export class VolCopyComponent implements OnInit { }).then(_ => this.loading = false); } + broadcastChanges(volumes: IdlObject[]) { + + const volIds = volumes.map(v => v.id()); + const copyIds = []; + const recIds = []; + + volumes.forEach(vol => { + if (!recIds.includes(vol.record())) { + recIds.push(vol.record()); + } + vol.copies().forEach(copy => copyIds.push(copy.id())); + }); + + this.broadcaster.broadcast('eg.holdings.update', { + copies : copyIds, + volumes: volIds, + records: recIds + }); + } + saveApi(volumes: IdlObject[], override?: boolean, close?: boolean): Promise { @@ -438,6 +460,8 @@ export class VolCopyComponent implements OnInit { return Promise.reject(); } + this.broadcastChanges(volumes); + return copyIds; }); }