LPXXX Angular Volcopy lint; prod repairs
authorBill Erickson <berickxx@gmail.com>
Fri, 3 Jul 2020 20:45:04 +0000 (16:45 -0400)
committerBill Erickson <berickxx@gmail.com>
Fri, 3 Jul 2020 20:45:04 +0000 (16:45 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/share/util/broadcast.service.ts
Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.html
Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts
Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.html
Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.ts
Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.service.ts
Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts
Open-ILS/src/eg2/src/app/staff/share/holdings/copy-tags-dialog.component.ts

index 08a54f3..ccbb573 100644 (file)
@@ -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();
index 1fcadbf..338ffc2 100644 (file)
@@ -33,8 +33,7 @@
   <div class="col-lg-1 font-weight-bold" i18n>Templates:</div>
   <div class="col-lg-4">
     <eg-combobox #copyTemplateCbox domId="template-select" 
-      [allowFreeText]="true" [entries]="volcopy.templateNames" 
-      [(ngModel)]="currentTemplate">
+      [allowFreeText]="true" [entries]="volcopy.templateNames">
     </eg-combobox>
   </div>
   <div class="col-lg-7 d-flex">
index 98cc60c..47be74c 100644 (file)
@@ -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;
             }
         });
index c8f657c..6fe9bde 100644 (file)
   <div class="p-1" [ngStyle]="{flex: flexAt(5)}">
     <div><label class="font-weight-bold" i18n>Call Number Label</label></div>
     <div>
-      <eg-combobox [smallFormControl]="true" [(ngModel)]="batchVolLabel">
-        <eg-combobox-entry *ngFor="let label of recordVolLabels" [entryId]="label">
+      <eg-combobox [smallFormControl]="true" 
+        [allowFreeText]="true" [(ngModel)]="batchVolLabel">
+        <eg-combobox-entry *ngFor="let label of recordVolLabels" 
+          [entryId]="label" [entryLabel]="label">
         </eg-combobox-entry>
       </eg-combobox>
     </div>
index 5d921c8..7f1f8b8 100644 (file)
@@ -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);
             }
         });
     }
index 13b8020..32236f3 100644 (file)
@@ -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()
index 320f579..1934b26 100644 (file)
@@ -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; }
 
index 65f6775..c58e82d 100644 (file)
@@ -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(_ => {