LP#1779158 Angular vandelay more import form
authorBill Erickson <berickxx@gmail.com>
Sat, 30 Jun 2018 19:47:56 +0000 (15:47 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 11 Oct 2018 18:56:30 +0000 (14:56 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/cat/vandelay/import.component.css [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/cat/vandelay/import.component.html
Open-ILS/src/eg2/src/app/staff/cat/vandelay/import.component.ts
Open-ILS/src/eg2/src/app/staff/cat/vandelay/vandelay.service.ts

diff --git a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/import.component.css b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/import.component.css
new file mode 100644 (file)
index 0000000..310131c
--- /dev/null
@@ -0,0 +1,26 @@
+
+
+.import-form {
+  margin-right: 10px;
+  margin-left: 10px;
+  font-size: 95%;
+}
+
+.import-form .row {
+  margin: 5px;
+  padding: 3px;
+}
+
+.import-form .row:nth-child(even) {
+  background-color: rgba(0,0,0,.03);
+  border-bottom: 1px solid rgba(0,0,0,.125);
+}
+
+.import-form label {
+  font-weight: bold;
+}
+
+.import-form input[type="checkbox"] {
+  /* BS adds a negative left margin */
+  margin-left: 0px;
+}
index 40bf0d5..e380b6a 100644 (file)
       </eg-typeahead>
     </div>
   </div>
-</div>
+  <div class="row">
+    <div class="col-lg-3">
+      <label i18n>Merge Profile</label>
+    </div>
+    <div class="col-lg-3">
+      <eg-typeahead [entries]="formatEntries('mergeProfiles')"
+        placeholder="Merge Profile..." i18n-placeholder>
+      </eg-typeahead>
+    </div>
+  </div>
+  <div class="row">
+    <div class="col-lg-3"><label i18n>Import Non-Matching Records</label></div>
+    <div class="col-lg-3">
+      <input class="form-check-input" type="checkbox" 
+        [(ngModel)]="importNonMatching">
+    </div>
+    <div class="col-lg-3"><label i18n>Merge On Single Match</label></div>
+    <div class="col-lg-3">
+      <input class="form-check-input" type="checkbox" 
+        [(ngModel)]="mergeOnSingleMatch">
+    </div>
+  </div>
+  <div class="row">
+    <div class="col-lg-3"><label i18n>Merge On Exact Match (901c)</label></div>
+    <div class="col-lg-3">
+      <input class="form-check-input" type="checkbox" 
+        [(ngModel)]="mergeOnExact">
+    </div>
+    <div class="col-lg-3"><label i18n>Merge On Best Match</label></div>
+    <div class="col-lg-3">
+      <input class="form-check-input" type="checkbox" 
+        [(ngModel)]="mergeOnBestMatch">
+    </div>
+  </div>
+  <div class="row">
+    <div class="col-lg-3">
+      <label i18n>Best/Single Match Minimum Quality Ratio</label></div>
+    <div class="col-lg-3">
+      <input type="number" step="0.1" 
+        class="form-control" [(ngModel)]="minQualityRatio">
+    </div>
+    <div class="col-lg-3">
+      <label i18n>Insufficient Quality Fall-Through Profile</label></div>
+    <div class="col-lg-3">
+      <eg-typeahead [entries]="formatEntries('mergeProfiles')"
+        placeholder="Merge Profile..." i18n-placeholder>
+      </eg-typeahead>
+    </div>
+  </div>
 
+</div>
 
 
index 0d125a7..725c0fd 100644 (file)
@@ -21,10 +21,17 @@ export class ImportComponent implements OnInit, AfterViewInit {
     itemImportAttrDefs: IdlObject[];
     matchSets: {[stype: string]: IdlObject[]};
     defaultMatchSet: string;
+    mergeProfiles: IdlObject[];
 
     matchSetEntries: TypeaheadEntry[];
     importItemDefEntries: TypeaheadEntry[];
 
+    importNonMatching: boolean;
+    mergeOnExact: boolean;
+    mergeOnSingleMatch: boolean;
+    mergeOnBestMatch: boolean;
+    minQualityRatio: number;
+
     @ViewChild('progressDialog')
         private progressDialog: ProgressDialogComponent;
 
@@ -36,6 +43,7 @@ export class ImportComponent implements OnInit, AfterViewInit {
         this.attrDefs = {};
         this.matchSets = {};
         this.activeQueues = {};
+        this.minQualityRatio = 0;
     }
 
     ngOnInit() {}
@@ -57,6 +65,8 @@ export class ImportComponent implements OnInit, AfterViewInit {
                 .then(defs => this.attrDefs.bib = defs),
             this.vandelay.getAttrDefs('auth')
                 .then(defs => this.attrDefs.auth = defs),
+            this.vandelay.getMergeProfiles()
+                .then(profiles => this.mergeProfiles = profiles),
             this.vandelay.getActiveQueues('bib')
                 .then(queues => this.activeQueues.bib = queues),
             this.vandelay.getActiveQueues('auth')
@@ -102,6 +112,11 @@ export class ImportComponent implements OnInit, AfterViewInit {
                 return (this.itemImportAttrDefs || []).map(d => {
                     return {id: d.id(), label: d.name()};
                  });
+
+            case 'mergeProfiles':
+                return (this.mergeProfiles || []).map(d => {
+                    return {id: d.id(), label: d.name()};
+                 });
         }
     }
 }
index e8d3e5f..46bfd09 100644 (file)
@@ -22,6 +22,7 @@ export class VandelayService {
     matchSets: {[stype: string]: IdlObject[]};
     importItemAttrDefs: IdlObject[];
     bibTrashGroups: IdlObject[];
+    mergeProfiles: IdlObject[];
 
     constructor(
         private idl: IdlService,
@@ -53,6 +54,20 @@ export class VandelayService {
         });
     }
 
+    getMergeProfiles(): Promise<IdlObject[]> {
+        if (this.mergeProfiles) {
+            return Promise.resolve(this.mergeProfiles);
+        }
+
+        const owners = this.org.ancestors(this.auth.user().ws_ou(), true);
+        return this.pcrud.search('vmp', 
+            {owner: owners}, {order_by: {vmp: ['name']}}, {atomic: true})
+        .toPromise().then(profiles => {
+            this.mergeProfiles = profiles;
+            return profiles;
+        });
+    }
+
     // Returns a promise resolved with the list of queues.
     // Also emits the onQueueListUpdate event so listeners
     // can detect queue content changes.