From 81cbb5bd562397bdb2b2fea3d73fc8b0ce256a3a Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 3 Jul 2020 16:45:04 -0400 Subject: [PATCH] LPXXX Angular Volcopy lint; prod repairs Signed-off-by: Bill Erickson --- .../src/eg2/src/app/share/util/broadcast.service.ts | 4 ++-- .../app/staff/cat/volcopy/copy-attrs.component.html | 3 +-- .../app/staff/cat/volcopy/copy-attrs.component.ts | 21 ++++++++++----------- .../app/staff/cat/volcopy/vol-edit.component.html | 6 ++++-- .../src/app/staff/cat/volcopy/vol-edit.component.ts | 5 +++-- .../src/app/staff/cat/volcopy/volcopy.service.ts | 4 ++-- .../app/staff/catalog/record/holdings.component.ts | 2 +- .../share/holdings/copy-tags-dialog.component.ts | 14 +++++++------- 8 files changed, 30 insertions(+), 29 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/share/util/broadcast.service.ts b/Open-ILS/src/eg2/src/app/share/util/broadcast.service.ts index 08a54f3d5f..ccbb573a66 100644 --- a/Open-ILS/src/eg2/src/app/share/util/broadcast.service.ts +++ b/Open-ILS/src/eg2/src/app/share/util/broadcast.service.ts @@ -42,7 +42,7 @@ export class BroadcastService { } broadcast(key: string, value: any) { - if (typeof BroadcastChannel === 'undefined') { return; } + if (typeof BroadcastChannel === 'undefined') { return; } if (this.subscriptions[key]) { this.subscriptions[key].channel.postMessage(value); @@ -57,7 +57,7 @@ export class BroadcastService { } close(key: string) { - if (typeof BroadcastChannel === 'undefined') { return; } + if (typeof BroadcastChannel === 'undefined') { return; } if (this.subscriptions[key]) { this.subscriptions[key].channel.close(); diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.html b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.html index 1fcadbf0a3..338ffc2882 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.html +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.html @@ -33,8 +33,7 @@
Templates:
+ [allowFreeText]="true" [entries]="volcopy.templateNames">
diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts index 98cc60c059..47be74cbbe 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts @@ -122,7 +122,7 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit { const orgs = this.org.descendants(this.statCatFilter, true); return this.volcopy.commonData.acp_stat_cat.filter( - sc => orgs.includes(sc.owner())) + sc => orgs.includes(sc.owner())); } else { @@ -269,8 +269,6 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit { owningLibChanged(orgId: number) { if (!orgId) { return; } - let promise = Promise.resolve(); - // Map existing vol IDs to their replacments. const newVols: any = {}; @@ -321,8 +319,9 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit { // volume at the server, since other items could be attached // of which this instance of the editor is not aware. Object.keys(newVols).forEach(volId => { + const volNode = this.context.volNodes().filter( - volNode => volNode.target.id() === +volId)[0]; + node => node.target.id() === +volId)[0]; if (volNode && volNode.children.length === 0) { this.context.removeVolNode(+volId); @@ -395,7 +394,7 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit { this.context.copyList().forEach(copy => { if (copy.tags().filter( - map => map.tag().id() === tag.id()).length > 0) { + m => m.tag().id() === tag.id()).length > 0) { return; // map already exists } @@ -474,16 +473,16 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit { this.batchAttrs.forEach(comp => { if (!comp.hasChanged) { return; } - const name = comp.name; - const value = this.values[name]; + const field = comp.name; + const value = this.values[field]; if (value === null) { - delete template[name]; + delete template[field]; return; } - if (name.match(/stat_cat_/)) { - const statId = name.match(/stat_cat_(\d+)/)[1]; + if (field.match(/stat_cat_/)) { + const statId = field.match(/stat_cat_(\d+)/)[1]; if (!template.statcats) { template.statcats = {}; } template.statcats[statId] = value; @@ -492,7 +491,7 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit { // Some values are fleshed. this assumes fleshed objects // have an 'id' value, which is true so far. - template[name] = + template[field] = typeof value === 'object' ? value.id() : value; } }); diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.html b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.html index c8f657c0c3..6fe9bde5a4 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.html +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.html @@ -38,8 +38,10 @@
- - + +
diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.ts index 5d921c8d6d..7f1f8b8c6a 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.ts @@ -229,7 +229,7 @@ export class VolEditComponent implements OnInit { copyPartChanged(copyNode: HoldingsTreeNode, entry: ComboboxEntry) { const copy = copyNode.target; - let part = copyNode.target.parts()[0]; + const part = copyNode.target.parts()[0]; if (entry) { @@ -263,7 +263,8 @@ export class VolEditComponent implements OnInit { this.applyVolValue(vol, 'suffix', this.batchVolSuffix.id); } if (this.batchVolLabel) { - this.applyVolValue(vol, 'label', this.batchVolLabel.id); + // Use label; could be freetext. + this.applyVolValue(vol, 'label', this.batchVolLabel.label); } }); } diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.service.ts b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.service.ts index 13b802075b..32236f3a66 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.service.ts @@ -18,8 +18,8 @@ import {ComboboxComponent, ComboboxEntry} from '@eg/share/combobox/combobox.comp interface VolCopyDefaults { - values: {[field: string]: any}, - hidden: {[field: string]: boolean} + values: {[field: string]: any}; + hidden: {[field: string]: boolean}; } @Injectable() diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts index 320f5795cb..1934b26eb8 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts @@ -855,7 +855,7 @@ export class HoldingsMaintenanceComponent implements OnInit { ); } - openItemTags(rows: HoldingsEntry[], mode: string) { + openItemTags(rows: HoldingsEntry[]) { const copyIds = this.selectedCopyIds(rows); if (copyIds.length === 0) { return; } diff --git a/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-tags-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-tags-dialog.component.ts index 65f6775b76..c58e82d6a6 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-tags-dialog.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-tags-dialog.component.ts @@ -214,18 +214,18 @@ export class CopyTagsDialogComponent this.copies.forEach(copy => { if (copy.tags() && copy.tags().filter( - map => map.tag().id() === tag.id()).length > 0) { + m => m.tag().id() === tag.id()).length > 0) { return; // map already exists } promise = promise.then(_ => { - const map = this.idl.create('acptcm'); - map.isnew(true); - map.copy(copy.id()); - map.tag(tag.id()); - return this.pcrud.create(map).toPromise(); + const tagMap = this.idl.create('acptcm'); + tagMap.isnew(true); + tagMap.copy(copy.id()); + tagMap.tag(tag.id()); + return this.pcrud.create(tagMap).toPromise(); }); - }) + }); }); promise.then(_ => { -- 2.11.0