LP1849212: fix incorrect paths in course materials grid columns
authorJane Sandberg <sandbej@linnbenton.edu>
Sat, 15 Aug 2020 00:45:34 +0000 (17:45 -0700)
committerJane Sandberg <sandbej@linnbenton.edu>
Mon, 7 Sep 2020 18:11:26 +0000 (11:11 -0700)
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-material.component.html
Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-list.component.html
Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-list.component.ts
Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-page.component.ts
Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/routing.module.ts
Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts
Open-ILS/src/eg2/src/app/staff/common.module.ts
Open-ILS/src/eg2/src/app/staff/share/marc-edit/marcrecord.ts

index 2c994fc..c7f6f20 100644 (file)
@@ -6,7 +6,7 @@
 </eg-string>
 <eg-string #materialEditSuccessString i18n-text text="Update of Course Material succeeded"></eg-string>
 <eg-string #materialEditFailedString i18n-text text="Update of Course Material failed or was not allowed"></eg-string>
-<eg-string #MaterialAddDifferentLibraryString i18n-text text="Material exists at a different library"></eg-string>
+<eg-string #materialAddDifferentLibraryString i18n-text text="Material exists at a different library"></eg-string>
 
 <ng-template #dialogContent>
   <div class="modal-header bg-info" [ngClass]="isDialog() ? 'modal-header' : 'alert mt-3'">
           <eg-grid-column path="id" [index]=true [hidden]="true" label="ID" i18n-label></eg-grid-column>
           <eg-grid-column label="Barcode" i18n-label name="barcode" [cellTemplate]="barcodeCellTemplate"></eg-grid-column>
           <eg-grid-column label="Title" i18n-label name="title" flex="3" [cellTemplate]="titleCellTemplate"></eg-grid-column>
-          <eg-grid-column path="call_number.label" label="Call Number" i18n-label></eg-grid-column>
-          <eg-grid-column path="call_number.prefix.label" [hidden]="true" label="Call Number Prefix" i18n-label hidden>
+          <eg-grid-column path="item.call_number.label" label="Call Number" i18n-label></eg-grid-column>
+          <eg-grid-column path="item.call_number.prefix.label" [hidden]="true" label="Call Number Prefix" i18n-label hidden>
           </eg-grid-column>
-          <eg-grid-column path="call_number.suffix.label" [hidden]="true" label="Call Number Suffix" i18n-label hidden>
+          <eg-grid-column path="item.call_number.suffix.label" [hidden]="true" label="Call Number Suffix" i18n-label hidden>
           </eg-grid-column>
-          <eg-grid-column path="circ_modifier" [hidden]="true" label="Circulation Modifier" i18n-label></eg-grid-column>
-          <eg-grid-column path="circ_lib.shortname" label="Circulation Library" i18n-label></eg-grid-column>
-          <eg-grid-column path="location.name" [hidden]="true" label="Shelving Location" i18n-label></eg-grid-column>
-          <eg-grid-column path="status.name" [hidden]="true" label="Item Status" i18n-label></eg-grid-column>
+          <eg-grid-column path="item.circ_modifier" [hidden]="true" label="Circulation Modifier" i18n-label></eg-grid-column>
+          <eg-grid-column path="item.circ_lib.shortname" label="Circulation Library" i18n-label></eg-grid-column>
+          <eg-grid-column path="item.location.name" [hidden]="true" label="Shelving Location" i18n-label></eg-grid-column>
+          <eg-grid-column path="item.status.name" [hidden]="true" label="Item Status" i18n-label></eg-grid-column>
           <eg-grid-column path="original_circ_modifier.name" [hidden]="true" label="Original Circulation Modifier" i18n-label></eg-grid-column>
           <eg-grid-column path="original_location.name" [hidden]="true" label="Original Shelving Location" i18n-label></eg-grid-column>
           <eg-grid-column path="original_status.name" [hidden]="true" label="Original Item Status" i18n-label></eg-grid-column>
index aa4633e..54d0c7d 100644 (file)
@@ -1,20 +1,20 @@
 <eg-staff-banner bannerText="Course List" i18n-bannerText>
 </eg-staff-banner>
 
-<eg-string #successString i18n-text text="{{table_name}} Update Succeeded"></eg-string>
-<eg-string #createString i18n-text text="{{table_name}} Was Created Successfully"></eg-string>
-<eg-string #deleteFailedString i18n-text text="Deletion of {{table_name}} failed or was not allowed"></eg-string>
-<eg-string #deleteSuccessString i18n-text text="Deletion of {{table_name}} was successful"></eg-string>
-<eg-string #archiveFailedString i18n-text text="Archival of {{table_name}} failed or was not allowed"></eg-string>
-<eg-string #archiveSuccessString i18n-text text="Archival of {{table_name}} succeeded"></eg-string>
+<eg-string #successString i18n-text text="{{tableName}} Update Succeeded"></eg-string>
+<eg-string #createString i18n-text text="{{tableName}} Was Created Successfully"></eg-string>
+<eg-string #deleteFailedString i18n-text text="Deletion of {{tableName}} failed or was not allowed"></eg-string>
+<eg-string #deleteSuccessString i18n-text text="Deletion of {{tableName}} was successful"></eg-string>
+<eg-string #archiveFailedString i18n-text text="Archival of {{tableName}} failed or was not allowed"></eg-string>
+<eg-string #archiveSuccessString i18n-text text="Archival of {{tableName}} succeeded"></eg-string>
 <eg-string #flairTooltip i18n-text text="Limited Editing"></eg-string>
 
 <div class="w-100 mt-2 mb-2">
-  <eg-grid #grid idlClass={{idl_class}}
+  <eg-grid #grid idlClass={{idlClass}}
     [dataSource]="grid_source"
     [sortable]="true">
     <eg-grid-toolbar-button
-      label="Create {{table_name}}" (onClick)="createNew()" i18n-label>
+      label="Create {{tableName}}" (onClick)="createNew()" i18n-label>
     </eg-grid-toolbar-button>
     <eg-grid-toolbar-action label="Edit Selected" i18n-label (onClick)="editSelected($event)">
     </eg-grid-toolbar-action>
index 631c19f..bc439a4 100644 (file)
@@ -1,11 +1,8 @@
 import {Component, Input, ViewChild, OnInit} from '@angular/core';
-import { Router, ActivatedRoute }    from '@angular/router';
+import {Router} from '@angular/router';
 import {IdlObject} from '@eg/core/idl.service';
 import {PcrudService} from '@eg/core/pcrud.service';
-import {AuthService} from '@eg/core/auth.service';
 import {CourseService} from '@eg/staff/share/course.service';
-import {NetService} from '@eg/core/net.service';
-import {OrgService} from '@eg/core/org.service';
 import {GridComponent} from '@eg/share/grid/grid.component';
 import {Pager} from '@eg/share/util/pager';
 import {GridDataSource, GridColumn} from '@eg/share/grid/grid';
@@ -24,8 +21,8 @@ import {CourseAssociateUsersComponent
     templateUrl: './course-list.component.html'
 })
 
-export class CourseListComponent implements OnInit { 
+export class CourseListComponent implements OnInit {
+
     @ViewChild('editDialog', { static: true }) editDialog: FmRecordEditorComponent;
     @ViewChild('grid', { static: true }) grid: GridComponent;
     @ViewChild('successString', { static: true }) successString: StringComponent;
@@ -41,32 +38,28 @@ export class CourseListComponent implements OnInit {
     @ViewChild('courseUserDialog', {static: true})
         private courseUserDialog: CourseAssociateUsersComponent;
 
-    @Input() sort_field: string;
-    @Input() idl_class = "acmc";
+    @Input() sortField: string;
+    @Input() idlClass = 'acmc';
     @Input() dialog_size: 'sm' | 'lg' = 'lg';
-    @Input() table_name = "Course";
+    @Input() tableName = 'Course';
     grid_source: GridDataSource = new GridDataSource();
     currentMaterials: any[] = [];
     search_value = '';
 
     constructor(
-        private auth: AuthService,
         private courseSvc: CourseService,
         private locale: LocaleService,
-        private net: NetService,
-        private org: OrgService,
         private pcrud: PcrudService,
-        private route: ActivatedRoute,
         private router: Router,
         private toast: ToastService
-    ){}
+    ) {}
 
     ngOnInit() {
         this.getSource();
-        this.grid.onRowActivate.subscribe((course:IdlObject) => {
-            let idToEdit = course.id();
+        this.grid.onRowActivate.subscribe((course: IdlObject) => {
+            const idToEdit = course.id();
             this.navigateToCoursePage(idToEdit);
-        })
+        });
     }
 
     /**
@@ -77,31 +70,31 @@ export class CourseListComponent implements OnInit {
             const orderBy: any = {};
             if (sort.length) {
                 // Sort specified from grid
-                orderBy[this.idl_class] = sort[0].name + ' ' + sort[0].dir;
-            } else if (this.sort_field) {
+                orderBy[this.idlClass] = sort[0].name + ' ' + sort[0].dir;
+            } else if (this.sortField) {
                 // Default sort field
-                orderBy[this.idl_class] = this.sort_field;
+                orderBy[this.idlClass] = this.sortField;
             }
             const searchOps = {
                 offset: pager.offset,
                 limit: pager.limit,
                 order_by: orderBy
             };
-            return this.pcrud.retrieveAll(this.idl_class, searchOps, {fleshSelectors: true})
+            return this.pcrud.retrieveAll(this.idlClass, searchOps, {fleshSelectors: true});
         };
     }
 
     navigateToCoursePage(id_arr: IdlObject[]) {
-        if (typeof id_arr == 'number') id_arr = [id_arr];
-        let urls = [];
+        if (typeof id_arr === 'number') { id_arr = [id_arr]; }
+        const urls = [];
         id_arr.forEach(id => {console.log(this.router.url);
             urls.push([this.locale.currentLocaleCode() + this.router.url + '/' +  id]);
         });
-        if (id_arr.length == 1) {
+        if (id_arr.length === 1) {
         this.router.navigate([this.router.url + '/' + id_arr[0]]);
         } else {
             urls.forEach(url => {
-                window.open(url)
+                window.open(url);
             });
         }
     }
@@ -127,9 +120,9 @@ export class CourseListComponent implements OnInit {
 
     editSelected(fields: IdlObject[]) {
         // Edit each IDL thing one at a time
-        let course_ids = [];
+        const course_ids = [];
         fields.forEach(field => {
-            if (typeof field['id'] == 'function') {
+            if (typeof field['id'] === 'function') {
                 course_ids.push(field.id());
             } else {
                 course_ids.push(field['id']);
@@ -140,9 +133,8 @@ export class CourseListComponent implements OnInit {
 
     archiveSelected(course: IdlObject[]) {
         this.courseSvc.disassociateMaterials(course).then(res => {
-            course.forEach(course => {
-                console.log(course);
-                course.is_archived(true);
+            course.forEach(courseToArchive => {
+                courseToArchive.is_archived(true);
             });
             this.pcrud.update(course).subscribe(
                 val => {
@@ -159,12 +151,12 @@ export class CourseListComponent implements OnInit {
         });
     }
 
-    deleteSelected(idl_object: IdlObject[]) {
-        this.courseSvc.disassociateMaterials(idl_object).then(res => {
-            idl_object.forEach(idl_object => {
-                idl_object.isdeleted(true)
+    deleteSelected(idlObject: IdlObject[]) {
+        this.courseSvc.disassociateMaterials(idlObject).then(res => {
+            idlObject.forEach(object => {
+                object.isdeleted(true);
             });
-            this.pcrud.autoApply(idl_object).subscribe(
+            this.pcrud.autoApply(idlObject).subscribe(
                 val => {
                     console.debug('deleted: ' + val);
                     this.deleteSuccessString.current()
@@ -177,6 +169,6 @@ export class CourseListComponent implements OnInit {
                 () => this.grid.reload()
             );
         });
-    };
+    }
 }
 
index 6818a11..df7a41a 100644 (file)
@@ -1,19 +1,8 @@
 import {Component, Input, ViewChild, OnInit, TemplateRef} from '@angular/core';
-import {Router, ActivatedRoute} from '@angular/router';
-import {Observable, Observer, of} from 'rxjs';
-import {DialogComponent} from '@eg/share/dialog/dialog.component';
-import {AuthService} from '@eg/core/auth.service';
-import {NetService} from '@eg/core/net.service';
-import {EventService} from '@eg/core/event.service';
-import {OrgService} from '@eg/core/org.service';
+import {ActivatedRoute} from '@angular/router';
 import {PcrudService} from '@eg/core/pcrud.service';
-import {Pager} from '@eg/share/util/pager';
-import {NgbModal, NgbModalOptions} from '@ng-bootstrap/ng-bootstrap';
-import {GridDataSource} from '@eg/share/grid/grid';
-import {GridComponent} from '@eg/share/grid/grid.component';
 import {IdlObject, IdlService} from '@eg/core/idl.service';
 import {StringComponent} from '@eg/share/string/string.component';
-import {StaffBannerComponent} from '@eg/staff/share/staff-banner.component';
 import {ToastService} from '@eg/share/toast/toast.service';
 import {CourseService} from '@eg/staff/share/course.service';
 import {CourseAssociateUsersComponent} from './course-associate-users.component';
@@ -33,7 +22,7 @@ export class CoursePageComponent implements OnInit {
         private courseMaterialDialog: CourseAssociateMaterialComponent;
     @ViewChild('courseUserDialog', {static: true})
         private courseUserDialog: CourseAssociateUsersComponent;
-    
+
     // Edit Tab
     @ViewChild('archiveFailedString', { static: true })
         archiveFailedString: StringComponent;
@@ -43,12 +32,7 @@ export class CoursePageComponent implements OnInit {
     // Materials Tab
 
     constructor(
-        private auth: AuthService,
         private course: CourseService,
-        private event: EventService,
-        private idl: IdlService,
-        private net: NetService,
-        private org: OrgService,
         private pcrud: PcrudService,
         private route: ActivatedRoute,
         private toast: ToastService
@@ -56,7 +40,7 @@ export class CoursePageComponent implements OnInit {
     }
 
     ngOnInit() {
-        this.courseId = parseInt(this.route.snapshot.paramMap.get('id'));
+        this.courseId = +this.route.snapshot.paramMap.get('id');
         this.course.getCourses([this.courseId]).then(course => {
             this.currentCourse = course[0];
         });
@@ -78,5 +62,5 @@ export class CoursePageComponent implements OnInit {
     }
 
     // Materials Tab
-    
-}
\ No newline at end of file
+
+}
index 7c735dd..fcd9cd5 100644 (file)
@@ -16,4 +16,4 @@ const routes: Routes = [{
   exports: [RouterModule]
 })
 
-export class CourseReservesRoutingModule {}
\ No newline at end of file
+export class CourseReservesRoutingModule {}
index fe21399..9f0f266 100644 (file)
@@ -47,7 +47,7 @@ export class ResultRecordComponent implements OnInit, OnDestroy {
 
     ngOnInit() {
         this.searchContext = this.staffCat.searchContext;
-        this.loadCourseInformation(this.summary.id)
+        this.loadCourseInformation(this.summary.id);
         this.isRecordSelected = this.basket.hasRecordId(this.summary.id);
 
         // Watch for basket changes caused by other components
index 62c921c..feb159d 100644 (file)
@@ -18,7 +18,7 @@ import {MultiSelectComponent} from '@eg/share/multi-select/multi-select.componen
 import {NotBeforeMomentValidatorDirective} from '@eg/share/validators/not_before_moment_validator.directive';
 import {PatronBarcodeValidatorDirective} from '@eg/share/validators/patron_barcode_validator.directive';
 import {BroadcastService} from '@eg/share/util/broadcast.service';
-import {CourseService} from './share/course.service'
+import {CourseService} from './share/course.service';
 
 /**
  * Imports the EG common modules and adds modules common to all staff UI's.
@@ -72,7 +72,7 @@ export class StaffCommonModule {
             providers: [ // Export staff-wide services
                 AccessKeyService,
                 AudioService,
-                BroadcastService
+                BroadcastService,
                 CourseService
             ]
         };
index 97686fc..a8e2e51 100644 (file)
@@ -26,10 +26,10 @@ export interface MarcField {
     // Fields are immutable when it comes to controlfield vs.
     // data field.  Stamp the value when stamping field IDs.
     isCtrlField: boolean;
+    indicator?: (ind: number) => any;
 
     // Pass-through to marcrecord.js
     isControlfield(): boolean;
-    indicator?: (ind: number) => any;
 
     deleteExactSubfields(...subfield: MarcSubfield[]): number;
 }