LP#1775466 Grid row flair; ng-lint updates
authorBill Erickson <berickxx@gmail.com>
Wed, 27 Jun 2018 21:01:37 +0000 (17:01 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 5 Sep 2018 14:05:23 +0000 (10:05 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
22 files changed:
Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts
Open-ILS/src/eg2/src/app/share/catalog/catalog.service.ts
Open-ILS/src/eg2/src/app/share/grid/grid-body-cell.component.html
Open-ILS/src/eg2/src/app/share/grid/grid-body-cell.component.ts
Open-ILS/src/eg2/src/app/share/grid/grid-body.component.html
Open-ILS/src/eg2/src/app/share/grid/grid-body.component.ts
Open-ILS/src/eg2/src/app/share/grid/grid-header.component.html
Open-ILS/src/eg2/src/app/share/grid/grid-header.component.ts
Open-ILS/src/eg2/src/app/share/grid/grid-toolbar.component.ts
Open-ILS/src/eg2/src/app/share/grid/grid.component.css
Open-ILS/src/eg2/src/app/share/grid/grid.component.html
Open-ILS/src/eg2/src/app/share/grid/grid.component.ts
Open-ILS/src/eg2/src/app/share/grid/grid.ts
Open-ILS/src/eg2/src/app/share/print/print.component.ts
Open-ILS/src/eg2/src/app/staff/about.component.ts
Open-ILS/src/eg2/src/app/staff/catalog/record/actions.component.ts
Open-ILS/src/eg2/src/app/staff/catalog/record/copies.component.ts
Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts
Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html
Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts
Open-ILS/src/eg2/src/app/staff/share/buckets/record-bucket-dialog.component.ts
Open-ILS/src/eg2/src/app/staff/share/holdings.service.ts

index 25b5020..19924d9 100644 (file)
@@ -16,9 +16,105 @@ export const NAMESPACE_MAPS = {
     'indexing': 'http://open-ils.org/spec/indexing/v1'
 };
 
-export const HOLDINGS_XPATH = 
+export const HOLDINGS_XPATH =
     '/holdings:holdings/holdings:counts/holdings:count';
 
+
+export class BibRecordSummary {
+    id: number; // == record.id() for convenience
+    orgId: number;
+    orgDepth: number;
+    record: IdlObject;
+    display: any;
+    attributes: any;
+    holdingsSummary: any;
+    holdCount: number;
+    bibCallNumber: string;
+    net: NetService;
+
+    constructor(record: IdlObject, orgId: number, orgDepth: number) {
+        this.id = record.id();
+        this.record = record;
+        this.orgId = orgId;
+        this.orgDepth = orgDepth;
+        this.display = {};
+        this.attributes = {};
+        this.bibCallNumber = null;
+    }
+
+    ingest() {
+        this.compileDisplayFields();
+        this.compileRecordAttrs();
+
+        // Normalize some data for JS consistency
+        this.record.creator(Number(this.record.creator()));
+        this.record.editor(Number(this.record.editor()));
+    }
+
+    compileDisplayFields() {
+        this.record.flat_display_entries().forEach(entry => {
+            if (entry.multi() === 't') {
+                if (this.display[entry.name()]) {
+                    this.display[entry.name()].push(entry.value());
+                } else {
+                    this.display[entry.name()] = [entry.value()];
+                }
+            } else {
+                this.display[entry.name()] = entry.value();
+            }
+        });
+    }
+
+    compileRecordAttrs() {
+        // Any attr can be multi-valued.
+        this.record.mattrs().forEach(attr => {
+            if (this.attributes[attr.attr()]) {
+                this.attributes[attr.attr()].push(attr.value());
+            } else {
+                this.attributes[attr.attr()] = [attr.value()];
+            }
+        });
+    }
+
+    // Get -> Set -> Return bib hold count
+    getHoldCount(): Promise<number> {
+
+        if (Number.isInteger(this.holdCount)) {
+            return Promise.resolve(this.holdCount);
+        }
+
+        return this.net.request(
+            'open-ils.circ',
+            'open-ils.circ.bre.holds.count', this.id
+        ).toPromise().then(count => this.holdCount = count);
+    }
+
+    // Get -> Set -> Return bib-level call number
+    getBibCallNumber(): Promise<string> {
+
+        if (this.bibCallNumber !== null) {
+            return Promise.resolve(this.bibCallNumber);
+        }
+
+        // TODO labelClass = cat.default_classification_scheme YAOUS
+        const labelClass = 1;
+
+        return this.net.request(
+            'open-ils.cat',
+            'open-ils.cat.biblio.record.marc_cn.retrieve',
+            this.id, labelClass
+        ).toPromise().then(cnArray => {
+            if (cnArray && cnArray.length > 0) {
+                const key1 = Object.keys(cnArray[0])[0];
+                this.bibCallNumber = cnArray[0][key1];
+            } else {
+                this.bibCallNumber = '';
+            }
+            return this.bibCallNumber;
+        });
+    }
+}
+
 @Injectable()
 export class BibRecordService {
 
@@ -46,7 +142,7 @@ export class BibRecordService {
 
     // Note when multiple IDs are provided, responses are emitted in order
     // of receipt, not necessarily in the requested ID order.
-    getBibSummary(bibIds: number | number[], 
+    getBibSummary(bibIds: number | number[],
         orgId?: number, orgDepth?: number): Observable<BibRecordSummary> {
 
         const ids = [].concat(bibIds);
@@ -57,7 +153,7 @@ export class BibRecordService {
 
         return this.pcrud.search('bre', {id: ids},
             {   flesh: 1,
-                flesh_fields: {bre: ['flat_display_entries', 'mattrs']}, 
+                flesh_fields: {bre: ['flat_display_entries', 'mattrs']},
                 select: {bre : this.fetchableBreFields()}
             },
             {anonymous: true} // skip unneccesary auth
@@ -74,8 +170,8 @@ export class BibRecordService {
     }
 
     // Flesh the creator and editor fields.
-    // Handling this separately lets us pull from the cache and 
-    // avoids the requirement that the main bib query use a staff 
+    // Handling this separately lets us pull from the cache and
+    // avoids the requirement that the main bib query use a staff
     // (VIEW_USER) auth token.
     fleshBibUsers(records: IdlObject[]): Promise<void> {
 
@@ -112,7 +208,7 @@ export class BibRecordService {
         })).toPromise();
     }
 
-    getHoldingsSummary(recordId: number, 
+    getHoldingsSummary(recordId: number,
         orgId: number, orgDepth: number): Promise<any> {
 
         const holdingsSummary = [];
@@ -132,7 +228,7 @@ export class BibRecordService {
             };
 
             // Extract the holdings data from the unapi xml doc
-            const result = xmlDoc.evaluate(HOLDINGS_XPATH, 
+            const result = xmlDoc.evaluate(HOLDINGS_XPATH,
                 xmlDoc, resolver, XPathResult.ANY_TYPE, null);
 
             let node;
@@ -150,101 +246,4 @@ export class BibRecordService {
     }
 }
 
-export class BibRecordSummary {
-
-    id: number; // == record.id() for convenience
-    orgId: number;
-    orgDepth: number;
-    record: IdlObject;
-    display: any;
-    attributes: any;
-    holdingsSummary: any;
-    holdCount: number;
-    bibCallNumber: string;
-    net: NetService;
-
-    constructor(record: IdlObject, orgId: number, orgDepth: number) {
-        this.id = record.id();
-        this.record = record;
-        this.orgId = orgId;
-        this.orgDepth = orgDepth;
-        this.display = {};
-        this.attributes = {};
-        this.bibCallNumber = null;
-    }
-
-    ingest() {
-        this.compileDisplayFields();
-        this.compileRecordAttrs();
-
-        // Normalize some data for JS consistency
-        this.record.creator(Number(this.record.creator()));
-        this.record.editor(Number(this.record.editor()));
-    }
-
-    compileDisplayFields() {
-        this.record.flat_display_entries().forEach(entry => {
-            if (entry.multi() === 't') {
-                if (this.display[entry.name()]) {
-                    this.display[entry.name()].push(entry.value());
-                } else {
-                    this.display[entry.name()] = [entry.value()];
-                }
-            } else {
-                this.display[entry.name()] = entry.value();
-            }
-        });
-    }
-
-    compileRecordAttrs() {
-        // Any attr can be multi-valued.
-        this.record.mattrs().forEach(attr => {
-            if (this.attributes[attr.attr()]) {
-                this.attributes[attr.attr()].push(attr.value());
-            } else {
-                this.attributes[attr.attr()] = [attr.value()];
-            }
-        });
-    }
-
-    // Get -> Set -> Return bib hold count
-    getHoldCount(): Promise<number> {
-
-        if (Number.isInteger(this.holdCount)) {
-            return Promise.resolve(this.holdCount);
-        }
-
-        return this.net.request(
-            'open-ils.circ',
-            'open-ils.circ.bre.holds.count', this.id
-        ).toPromise().then(count => this.holdCount = count);
-    }
-
-    // Get -> Set -> Return bib-level call number
-    getBibCallNumber(): Promise<string> {
-
-        if (this.bibCallNumber !== null) {
-            return Promise.resolve(this.bibCallNumber);
-        }
-
-        // TODO labelClass = cat.default_classification_scheme YAOUS
-        const labelClass = 1;
-
-        return this.net.request(
-            'open-ils.cat',
-            'open-ils.cat.biblio.record.marc_cn.retrieve',
-            this.id, labelClass
-        ).toPromise().then(cnArray => {
-            if (cnArray && cnArray.length > 0) {
-                const key1 = Object.keys(cnArray[0])[0];
-                this.bibCallNumber = cnArray[0][key1];
-            } else {
-                this.bibCallNumber = '';
-            }
-            return this.bibCallNumber;
-        });
-    }
-}
-
-
 
index d4573b3..95967cb 100644 (file)
@@ -43,7 +43,7 @@ export class CatalogService {
         private org: OrgService,
         private unapi: UnapiService,
         private pcrud: PcrudService,
-           private bibService: BibRecordService        
+        private bibService: BibRecordService
     ) {}
 
     search(ctx: CatalogSearchContext): Promise<void> {
@@ -99,7 +99,7 @@ export class CatalogService {
             ctx.currentResultIds(), ctx.searchOrg.id(), depth)
         .pipe(map(summary => {
             // Responses are not necessarily returned in request-ID order.
-            const idx = ctx.currentResultIds().indexOf(summary.record.id()); 
+            const idx = ctx.currentResultIds().indexOf(summary.record.id());
             if (ctx.result.records) {
                 // May be reset when quickly navigating results.
                 ctx.result.records[idx] = summary;
index 55d6f2d..2fe7aad 100644 (file)
@@ -1,12 +1,12 @@
 
 <span *ngIf="!column.cellTemplate"
   ngbTooltip="{{context.getRowColumnValue(row, column)}}"
-  class="{{cellClassCallback(row, column)}}"
+  class="{{context.cellClassCallback(row, column)}}"
   triggers="mouseenter:mouseleave">
   {{context.getRowColumnValue(row, column)}}
 </span>
 <span *ngIf="column.cellTemplate" 
-  class="{{cellClassCallback(row, column)}}"
+  class="{{context.cellClassCallback(row, column)}}"
   [ngbTooltip]="column.cellTemplate"
   #tooltip="ngbTooltip" 
   (mouseenter)="tooltip.open(column.getCellContext(row))"
index 651aa8f..ca31fe7 100644 (file)
@@ -14,14 +14,9 @@ export class GridBodyCellComponent implements OnInit {
     @Input() context: GridContext;
     @Input() row: any;
     @Input() column: GridColumn;
-    @Input() cellClassCallback: (row: any, col: GridColumn) => string;
 
     constructor() {}
 
-    ngOnInit() {
-        if (!this.cellClassCallback) {
-            this.cellClassCallback = (row: any, col: GridColumn) => '';
-        }
-    }
+    ngOnInit() {}
 }
 
index 9b6dfa0..28cfdff 100644 (file)
@@ -2,23 +2,25 @@
   tabindex=1 so the grid body can capture keyboard events.
 -->
 <div class="eg-grid-body" tabindex="1" (keydown)="onGridKeyDown($event)">
-  <div class="eg-grid-row eg-grid-body-row {{rowClassCallback(row)}}"
+  <div class="eg-grid-row eg-grid-body-row {{context.rowClassCallback(row)}}"
     [ngClass]="{'selected': context.rowSelector.contains(context.getRowIndex(row))}"
     *ngFor="let row of context.dataSource.getPageOfRows(context.pager); let idx = index">
 
     <div class="eg-grid-cell eg-grid-checkbox-cell eg-grid-cell-skinny">
       <input type='checkbox' [(ngModel)]="context.rowSelector.indexes[context.getRowIndex(row)]">
     </div>
-    <div class="eg-grid-cell eg-grid-header-cell eg-grid-number-cell eg-grid-cell-skinny">
+    <div class="eg-grid-cell eg-grid-number-cell eg-grid-cell-skinny">
       {{context.pager.rowNumber(idx)}}
     </div>
+    <div *ngIf="context.rowFlairIsEnabled" class="eg-grid-cell eg-grid-flair-cell">
+      <span class="material-icons">{{context.rowFlairCallback(row)}}</span>
+    </div>
     <div class="eg-grid-cell eg-grid-body-cell" [ngStyle]="{flex:col.flex}"
       (dblclick)="onRowDblClick(row)"
       (click)="onRowClick($event, row, idx)"
       *ngFor="let col of context.columnSet.displayColumns()">
 
-      <eg-grid-body-cell [context]="context" [row]="row" [column]="col"
-        [cellClassCallback]="cellClassCallback">
+      <eg-grid-body-cell [context]="context" [row]="row" [column]="col">
       </eg-grid-body-cell>
     </div>
   </div>
index f029ccf..6246c44 100644 (file)
@@ -11,17 +11,10 @@ import {GridComponent} from './grid.component';
 export class GridBodyComponent implements OnInit {
 
     @Input() context: GridContext;
-    @Input() rowClassCallback: (row: any) => string;
-    @Input() cellClassCallback: (row: any, col: GridColumn) => string;
 
-    constructor(@Host() private grid: GridComponent) {
-    }
+    constructor(@Host() private grid: GridComponent) {}
 
-    ngOnInit() {
-        if (!this.rowClassCallback) {
-            this.rowClassCallback = (row: any) => '';
-        }
-    }
+    ngOnInit() {}
 
     // Not using @HostListener because it only works globally.
     onGridKeyDown(evt: KeyboardEvent) {
index 827c985..58e0c66 100644 (file)
@@ -6,7 +6,11 @@
   <div class="eg-grid-cell eg-grid-header-cell eg-grid-number-cell eg-grid-cell-skinny">
     <span i18n="number|Row Number Header">#</span>
   </div>
-  <div *ngFor="let col of gridContext.columnSet.displayColumns()" 
+  <div *ngIf="context.rowFlairIsEnabled" 
+    class="eg-grid-cell eg-grid-header-cell eg-grid-flair-cell">
+    <span class="material-icons">notifications</span>
+  </div>
+  <div *ngFor="let col of context.columnSet.displayColumns()" 
     draggable="true" 
     (dragstart)="dragColumn = col"
     (drop)="onColumnDrop(col)"
index 8f2dab3..584cc76 100644 (file)
@@ -9,7 +9,8 @@ import {GridContext, GridColumn, GridRowSelector,
 
 export class GridHeaderComponent implements OnInit {
 
-    @Input() gridContext: GridContext;
+    @Input() context: GridContext;
+
     dragColumn: GridColumn;
 
     constructor() {}
@@ -29,51 +30,51 @@ export class GridHeaderComponent implements OnInit {
     }
 
     onColumnDrop(col: GridColumn) {
-        this.gridContext.columnSet.insertBefore(this.dragColumn, col);
-        this.gridContext.columnSet.columns.forEach(c => c.isDragTarget = false);
+        this.context.columnSet.insertBefore(this.dragColumn, col);
+        this.context.columnSet.columns.forEach(c => c.isDragTarget = false);
     }
 
     sortOneColumn(col: GridColumn) {
         let dir = 'ASC';
-        const sort = this.gridContext.dataSource.sort;
+        const sort = this.context.dataSource.sort;
 
         if (sort.length && sort[0].name === col.name && sort[0].dir === 'ASC') {
             dir = 'DESC';
         }
 
-        this.gridContext.dataSource.sort = [{name: col.name, dir: dir}];
-        this.gridContext.reload();
+        this.context.dataSource.sort = [{name: col.name, dir: dir}];
+        this.context.reload();
     }
 
     // Returns true if the provided column is sorting in the
     // specified direction.
     isColumnSorting(col: GridColumn, dir: string): boolean {
-        const sort = this.gridContext.dataSource.sort.filter(c => c.name === col.name)[0];
+        const sort = this.context.dataSource.sort.filter(c => c.name === col.name)[0];
         return sort && sort.dir === dir;
     }
 
     handleBatchSelect($event) {
         if ($event.target.checked) {
-            if (this.gridContext.rowSelector.isEmpty() || !this.allRowsAreSelected()) {
+            if (this.context.rowSelector.isEmpty() || !this.allRowsAreSelected()) {
                 // clear selections from other pages to avoid confusion.
-                this.gridContext.rowSelector.clear();
+                this.context.rowSelector.clear();
                 this.selectAll();
             }
         } else {
-            this.gridContext.rowSelector.clear();
+            this.context.rowSelector.clear();
         }
     }
 
     selectAll() {
-        const rows = this.gridContext.dataSource.getPageOfRows(this.gridContext.pager);
-        const indexes = rows.map(r => this.gridContext.getRowIndex(r));
-        this.gridContext.rowSelector.select(indexes);
+        const rows = this.context.dataSource.getPageOfRows(this.context.pager);
+        const indexes = rows.map(r => this.context.getRowIndex(r));
+        this.context.rowSelector.select(indexes);
     }
 
     allRowsAreSelected(): boolean {
-        const rows = this.gridContext.dataSource.getPageOfRows(this.gridContext.pager);
-        const indexes = rows.map(r => this.gridContext.getRowIndex(r));
-        return this.gridContext.rowSelector.contains(indexes);
+        const rows = this.context.dataSource.getPageOfRows(this.context.pager);
+        const indexes = rows.map(r => this.context.getRowIndex(r));
+        return this.context.rowSelector.contains(indexes);
     }
 }
 
index 9e3ceda..fd15ba9 100644 (file)
@@ -64,9 +64,7 @@ export class GridToolbarComponent implements OnInit {
 
         // let the file name describe the grid
         this.csvExportFileName = (
-            this.gridContext.mainLabel ||
-            this.gridContext.persistKey ||
-            'eg_grid_data'
+            this.gridContext.persistKey || 'eg_grid_data'
         ).replace(/\s+/g, '_') + '.csv';
 
         this.gridContext.gridToCsv().then(csv => {
index 1496a8e..87d2aaf 100644 (file)
   flex: none;
 }
 
+.eg-grid-flair-cell {
+  /* mat icons currently 22px, unclear why it needs this much space */
+  width: 34px; 
+  text-align: center;
+  flex: none;
+}
+
 /* depends on width of .eg-grid-cell-skinny */
 .eg-grid-column-width-header {
   width: 4.4em;
index 6ce2831..a98e17a 100644 (file)
@@ -7,7 +7,7 @@
     [colWidthConfig]="colWidthConfig">
   </eg-grid-toolbar>
 
-  <eg-grid-header [gridContext]="context"></eg-grid-header>
+  <eg-grid-header [context]="context"></eg-grid-header>
 
   <eg-grid-column-width #colWidthConfig [gridContext]="context">
   </eg-grid-column-width>
@@ -22,9 +22,6 @@
     </div>
   </div>
 
-  <eg-grid-body [context]="context"
-    [rowClassCallback]="rowClassCallback" 
-    [cellClassCallback]="cellClassCallback">
-  </eg-grid-body>
+  <eg-grid-body [context]="context"></eg-grid-body>
 </div>
 
index af29a64..65f0338 100644 (file)
@@ -15,27 +15,53 @@ import {GridContext, GridColumn, GridDataSource} from './grid';
   selector: 'eg-grid',
   templateUrl: './grid.component.html',
   styleUrls: ['grid.component.css'],
-  // share grid css globally once imported so all grid component CSS 
-  // can live in grid.component.css and to avoid multiple copies of 
+  // share grid css globally once imported so all grid component CSS
+  // can live in grid.component.css and to avoid multiple copies of
   // the CSS when multiple grids are displayed.
   encapsulation: ViewEncapsulation.None
 })
 
 export class GridComponent implements OnInit, AfterViewInit, OnDestroy {
 
-    @Input() mainLabel: string;
+    // Source of row data.
     @Input() dataSource: GridDataSource;
+
+    // IDL class for auto-generation of columns
     @Input() idlClass: string;
+
+    // True if any columns are sortable
     @Input() sortable: boolean;
+
+    // True if the grid supports sorting of multiple columns at once
     @Input() multiSortable: boolean;
+
+    // Storage persist key / per-grid-type unique identifier
+    // The value is prefixed with 'eg.grid.'
     @Input() persistKey: string;
+
+    // Prevent selection of multiple rows
     @Input() disableMultiSelect: boolean;
+
+    // Show an extra column in the grid where the caller can apply
+    // row-specific flair (material icons).
+    @Input() rowFlairIsEnabled: boolean;
+
+    // Returns a material icon name to display in the flar column
+    // (if enabled) for the given row.
+    @Input() rowFlairCallback: (row: any) => string;
+
+    // Returns a space-separated list of CSS class names to apply to
+    // a given row
     @Input() rowClassCallback: (row: any) => string;
+
+    // Returns a space-separated list of CSS class names to apply to
+    // a given cell or all cells in a column.
     @Input() cellClassCallback: (row: any, col: GridColumn) => string;
 
     context: GridContext;
 
     // These events are emitted from our grid-body component.
+    // They are defined here for ease of access to the caller.
     onRowActivate$: EventEmitter<any>;
     onRowClick$: EventEmitter<any>;
 
@@ -52,13 +78,22 @@ export class GridComponent implements OnInit, AfterViewInit, OnDestroy {
     }
 
     ngOnInit() {
-        this.context.mainLabel = this.mainLabel;
         this.context.idlClass = this.idlClass;
         this.context.dataSource = this.dataSource;
         this.context.persistKey = this.persistKey;
         this.context.isSortable = this.sortable === true;
         this.context.isMultiSortable = this.multiSortable === true;
         this.context.disableMultiSelect = this.disableMultiSelect === true;
+        this.context.rowFlairIsEnabled = this.rowFlairIsEnabled  === true;
+
+        // TS doesn't seem to like: let foo = bar || () => '';
+        this.context.rowFlairCallback =
+            this.rowFlairCallback || function () { return ''; };
+        this.context.rowClassCallback =
+            his.rowClassCallback || function () { return ''; };
+        this.context.cellClassCallback =
+            this.cellClassCallback || function() { return ''; };
+
         this.context.init();
     }
 
index 4b4fc84..d947b2e 100644 (file)
@@ -327,7 +327,10 @@ export class GridContext {
     toolbarActions: GridToolbarAction[];
     lastSelectedIndex: any;
     pageChanges: Subscription;
-    mainLabel: string;
+    rowFlairIsEnabled: boolean;
+    rowFlairCallback: (row: any) => string;
+    rowClassCallback: (row: any) => string;
+    cellClassCallback: (row: any, col: GridColumn) => string;
 
     // Services injected by our grid component
     idl: IdlService;
index 3abc449..4f69949 100644 (file)
@@ -53,7 +53,7 @@ export class PrintComponent implements OnInit {
 
         // Give templates a chance to render before printing
         setTimeout(() => {
-            this.dispatchPrint(printReq)
+            this.dispatchPrint(printReq);
             this.reset();
         });
     }
@@ -80,7 +80,7 @@ export class PrintComponent implements OnInit {
         }
     }
 
-    // Clear the print data 
+    // Clear the print data
     reset() {
         this.isPrinting = false;
         this.template = null;
@@ -105,7 +105,7 @@ export class PrintComponent implements OnInit {
         this.store.setLocalItem('eg.print.last_printed', {
             content: printReq.text,
             context: printReq.printContext,
-            content_type: printReq.contentType, 
+            content_type: printReq.contentType,
             show_dialog: printReq.showDialog
         });
 
index b88ba0e..a494956 100644 (file)
@@ -3,7 +3,6 @@ import {NetService} from '@eg/core/net.service';
 
 @Component({
     selector: 'eg-about',
-    //styleUrls: ['about.component.css'],
     templateUrl: 'about.component.html'
 })
 
index b6ab6ce..b65bfae 100644 (file)
@@ -39,7 +39,7 @@ export class RecordActionsComponent implements OnInit {
     };
 
     @Input() set recordId(recId: number) {
-        this.recId = recId
+        this.recId = recId;
         if (this.initDone) {
             // Fire any record specific actions here
         }
index b868c8f..b99bb2b 100644 (file)
@@ -43,7 +43,7 @@ export class CopiesComponent implements OnInit {
         this.gridDataSource.getRows = (pager: Pager, sort: any[]) => {
             // sorting not currently supported
             return this.fetchCopies(pager);
-        }
+        };
 
         this.copyContext = {
             holdable: (copy: any) => {
@@ -51,7 +51,7 @@ export class CopiesComponent implements OnInit {
                     && copy.location_holdable === 't'
                     && copy.status_holdable === 't';
             }
-        }
+        };
     }
 
     collectData() {
@@ -81,7 +81,7 @@ export class CopiesComponent implements OnInit {
             pager.offset,
             this.staffCat.prefOrg ? this.staffCat.prefOrg.id() : null
         ).pipe(map(copy => {
-            copy.active_date = copy.active_date || copy.create_date
+            copy.active_date = copy.active_date || copy.create_date;
             return copy;
         }));
     }
index aa9877a..52a26f2 100644 (file)
@@ -106,7 +106,7 @@ export class SearchFormComponent implements OnInit, AfterViewInit {
 
             case 'ident': // identifier query input
                 const iq = this.searchContext.identQuery;
-                const qt = this.searchContext.identQueryType
+                const qt = this.searchContext.identQueryType;
                 if (iq) {
                     // Ident queries ignore search-specific filters.
                     this.searchContext.reset();
@@ -115,7 +115,7 @@ export class SearchFormComponent implements OnInit, AfterViewInit {
                 }
                 break;
         }
-        
+
         this.searchByForm();
     }
 
index fdbc0c8..074389a 100644 (file)
@@ -82,6 +82,8 @@
 <eg-grid #cbtGrid idlClass="cbt" 
   [dataSource]="btSource" 
   [rowClassCallback]="btGridRowClassCallback"
+  [rowFlairIsEnabled]="true"
+  [rowFlairCallback]="btGridRowFlairCallback"
   [cellClassCallback]="btGridCellClassCallback"
   [sortable]="true">
   <eg-grid-column name="test" [cellTemplate]="cellTmpl" 
index f90fa3f..68762b3 100644 (file)
@@ -89,9 +89,20 @@ export class SandboxComponent implements OnInit {
         }
     }
 
+    btGridRowFlairCallback(row: any): string {
+        if (row.id() === 2) {
+            return 'priority_high';
+        } else if (row.id() === 3) {
+            return 'not_interested';
+        }
+    }
+
     // apply to all 'name' columns regardless of row
     btGridCellClassCallback(row: any, col: GridColumn): string {
         if (col.name === 'name') {
+            if (row.id() === 7) {
+                return 'text-lowercase font-weight-bold text-info';
+            }
             return 'text-uppercase font-weight-bold text-success';
         }
     }
index bca5b69..1f127b4 100644 (file)
@@ -91,7 +91,7 @@ export class RecordBucketDialogComponent
         item.bucket(id);
         item.target_biblio_record_entry(this.recId);
         this.net.request(
-            'open-ils.actor', 
+            'open-ils.actor',
             'open-ils.actor.container.item.create',
             this.auth.token(), 'biblio', item
         ).subscribe(resp => {
index 333027a..d2596b5 100644 (file)
@@ -5,8 +5,8 @@ import {Injectable, EventEmitter} from '@angular/core';
 import {NetService} from '@eg/core/net.service';
 
 interface NewVolumeData {
-    owner: number,
-    label?: string
+    owner: number;
+    label?: string;
 }
 
 @Injectable()