LP#1775466 ng-lint updates
authorBill Erickson <berickxx@gmail.com>
Wed, 5 Sep 2018 14:18:57 +0000 (10:18 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 5 Sep 2018 14:18:57 +0000 (10:18 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
20 files changed:
Open-ILS/src/eg2/src/app/core/auth.service.ts
Open-ILS/src/eg2/src/app/core/format.service.ts
Open-ILS/src/eg2/src/app/core/locale.service.ts
Open-ILS/src/eg2/src/app/core/server-store.service.ts
Open-ILS/src/eg2/src/app/core/store.service.ts
Open-ILS/src/eg2/src/app/share/grid/grid-body-cell.component.ts
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/org-select/org-select.component.ts
Open-ILS/src/eg2/src/app/share/string/string.service.ts
Open-ILS/src/eg2/src/app/share/tree/tree.component.ts
Open-ILS/src/eg2/src/app/share/tree/tree.ts
Open-ILS/src/eg2/src/app/share/util/pager.ts
Open-ILS/src/eg2/src/app/staff/admin/basic-admin-page.component.ts
Open-ILS/src/eg2/src/app/staff/admin/workstation/workstations/workstations.component.ts
Open-ILS/src/eg2/src/app/staff/login.component.ts
Open-ILS/src/eg2/src/app/staff/nav.component.ts
Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts
Open-ILS/src/eg2/src/app/staff/share/translate/translate.component.ts
Open-ILS/src/eg2/src/app/staff/splash.component.ts

index 84897f0..dad2acd 100644 (file)
@@ -286,7 +286,7 @@ export class AuthService {
         }
 
         return new Promise((resolve, reject) => {
-            const workstations = 
+            const workstations =
                 this.store.getLocalItem('eg.workstation.all');
 
             if (workstations) {
index dfb04b2..2c7e388 100644 (file)
@@ -91,7 +91,7 @@ export class FormatService {
                 // Slightly better than a bare 't' or 'f'.
                 // Should probably add a global true/false string.
                 return Boolean(
-                    value === 't' || value === 1 || 
+                    value === 't' || value === 1 ||
                     value === '1' || value === true
                 ).toString();
 
index 10be460..81fb8a6 100644 (file)
@@ -2,7 +2,7 @@ import {Injectable} from '@angular/core';
 import {Location} from '@angular/common';
 import {environment} from '../../environments/environment';
 import {Observable} from 'rxjs/Observable';
-import 'rxjs/add/observable/of'
+import 'rxjs/add/observable/of';
 import {CookieService} from 'ngx-cookie';
 import {IdlObject} from '@eg/core/idl.service';
 import {PcrudService} from '@eg/core/pcrud.service';
@@ -11,7 +11,7 @@ import {PcrudService} from '@eg/core/pcrud.service';
 export class LocaleService {
 
     constructor(
-        private ngLocation: Location, 
+        private ngLocation: Location,
         private cookieService: CookieService,
         private pcrud: PcrudService) {
     }
@@ -25,13 +25,13 @@ export class LocaleService {
 
         // Finally tack the path of the current page back onto the URL
         // which is more friendly than forcing them back to the splash page.
-        url += this.ngLocation.path()
-        
+        url += this.ngLocation.path();
+
         // Set a 10-year locale cookie to maintain compatibility
         // with the AngularJS client.
         // Cookie takes the form aa_bb instead of aa-BB
         const cookie = code.replace(/-/, '_').toLowerCase();
-        this.cookieService.put('eg_locale', 
+        this.cookieService.put('eg_locale',
             cookie, {path : '/', secure: true, expires: '+10y'});
 
         window.location.href = url;
@@ -42,7 +42,7 @@ export class LocaleService {
         return environment.locales || [];
     }
 
-    // Returns i18n_l objects matching the locales supported 
+    // Returns i18n_l objects matching the locales supported
     // in the current environment.
     supportedLocales(): Observable<IdlObject> {
         const locales = this.supportedLocaleCodes();
@@ -57,7 +57,7 @@ export class LocaleService {
     // Extract the local from the URL.
     // It's the last component of the base path.
     // Note we don't extract it from the cookie since using cookies
-    // to store the locale will not be necessary when AngularJS 
+    // to store the locale will not be necessary when AngularJS
     // is deprecated.
     currentLocaleCode(): string {
         const base = this.ngLocation.prepareExternalUrl('/');
index c08dab8..43415c1 100644 (file)
@@ -18,7 +18,7 @@ interface ServerSettingSummary {
 export class ServerStoreService {
 
     cache: {[key: string]: ServerSettingSummary};
+
     constructor(
         private net: NetService,
         private auth: AuthService) {
@@ -26,7 +26,7 @@ export class ServerStoreService {
     }
 
     setItem(key: string, value: any): Promise<any> {
-        
+
         if (!this.auth.token()) {
             return Promise.reject('Auth required to apply settings');
         }
@@ -44,9 +44,9 @@ export class ServerStoreService {
             if (Number(appliedCount) > 0) { // value applied
                 return this.cache[key] = value;
             }
-            
+
             return Promise.reject(
-                `No user or workstation setting type exists for: "${key}".\n` + 
+                `No user or workstation setting type exists for: "${key}".\n` +
                 'Create a ws/user setting type or use setLocalItem() to ' +
                 'store the value locally.'
             );
@@ -62,7 +62,7 @@ export class ServerStoreService {
 
     // Returns a set of key/value pairs for the requested settings
     getItemBatch(keys: string[]): Promise<any> {
-        
+
         const values: any = {};
         keys.forEach(key => {
             if (this.cache[key]) {
@@ -77,7 +77,7 @@ export class ServerStoreService {
 
         if (!this.auth.token()) {
             // Authtokens require for fetching server settings, but
-            // calls to retrieve settings could potentially occur 
+            // calls to retrieve settings could potentially occur
             // before auth completes -- Ideally not, but just to be safe.
             return Promise.resolve({});
         }
@@ -98,7 +98,7 @@ export class ServerStoreService {
                 serverKeys, this.auth.token()
             ).subscribe(
                 summary => {
-                    this.cache[summary.name] = 
+                    this.cache[summary.name] =
                         values[summary.name] = summary.value;
                 },
                 err => reject,
index af1e0e9..46dd621 100644 (file)
@@ -70,7 +70,7 @@ export class StoreService {
         if (!isJson) {
             val = JSON.stringify(val);
         }
-        this.cookieService.put(key, val, 
+        this.cookieService.put(key, val,
             {path : this.loginSessionBasePath, secure: true});
     }
 
index 32dacae..3d844f3 100644 (file)
@@ -1,4 +1,4 @@
-import {Component, Input, OnInit, AfterViewInit, 
+import {Component, Input, OnInit, AfterViewInit,
     TemplateRef, ElementRef, AfterContentChecked} from '@angular/core';
 import {GridContext, GridColumn, GridRowSelector,
     GridColumnSet, GridDataSource} from './grid';
@@ -27,7 +27,7 @@ export class GridBodyCellComponent implements OnInit, AfterContentChecked {
         this.setTooltip();
     }
 
-    // Returns true if the contents of this cell exceed the 
+    // Returns true if the contents of this cell exceed the
     // boundaries of its container.
     cellOverflows(): boolean {
         let node = this.elm.nativeElement;
@@ -41,12 +41,12 @@ export class GridBodyCellComponent implements OnInit, AfterContentChecked {
         return false;
     }
 
-    // Tooltips are only applied to cells whose contents exceed 
+    // Tooltips are only applied to cells whose contents exceed
     // their container.
     // Applying an empty string value prevents a tooltip from rendering.
     setTooltip() {
         if (this.cellOverflows()) {
-            this.tooltipContent = this.column.cellTemplate || 
+            this.tooltipContent = this.column.cellTemplate ||
                 this.context.getRowColumnValue(this.row, this.column);
         } else {
             // No tooltip
index db02e62..1fa4c2c 100644 (file)
@@ -74,7 +74,7 @@ export class GridComponent implements OnInit, AfterViewInit, OnDestroy {
     // the selected fields will be hidden.
     @Input() hideFields: string;
 
-    // Allow the caller to jump directly to a specific page of 
+    // Allow the caller to jump directly to a specific page of
     // grid data.
     @Input() pageOffset: number;
 
index a152fd8..e04940d 100644 (file)
@@ -67,10 +67,10 @@ export class GridColumnSet {
     add(col: GridColumn) {
 
         this.applyColumnDefaults(col);
-        
-        if (!this.insertColumn(col)) { 
+
+        if (!this.insertColumn(col)) {
             // Column was rejected as a duplicate.
-            return; 
+            return;
         }
 
         if (col.isIndex) { this.indexColumn = col; }
@@ -91,7 +91,7 @@ export class GridColumnSet {
 
         if (col.isAuto) {
             if (this.getColByName(col.name)) {
-                // New auto-generated column conflicts with existing 
+                // New auto-generated column conflicts with existing
                 // column.  Skip it.
                 return false;
             } else {
@@ -107,7 +107,7 @@ export class GridColumnSet {
         for (let idx = 0; idx < this.columns.length; idx++) {
             const testCol = this.columns[idx];
             if (testCol.name === col.name) { // match found
-                if (testCol.isAuto) { 
+                if (testCol.isAuto) {
                     // new column takes precedence, remove the existing column.
                     this.columns.splice(idx, 1);
                     break;
@@ -399,6 +399,19 @@ export interface GridRowFlairEntry {
     title: string;  // tooltip string
 }
 
+export class GridColumnPersistConf {
+    name: string;
+    flex?: number;
+    sort?: number;
+    align?: string;
+}
+
+export class GridPersistConf {
+    version: number;
+    limit: number;
+    columns: GridColumnPersistConf[];
+}
+
 export class GridContext {
 
     pager: Pager;
@@ -431,7 +444,7 @@ export class GridContext {
     format: FormatService;
 
     constructor(
-        idl: IdlService, 
+        idl: IdlService,
         org: OrgService,
         store: ServerStoreService,
         format: FormatService) {
@@ -479,7 +492,7 @@ export class GridContext {
                 }
             }
 
-            // This is called regardless of the presence of saved 
+            // This is called regardless of the presence of saved
             // settings so defaults can be applied.
             this.columnSet.applyColumnSettings(columns);
         });
@@ -532,8 +545,8 @@ export class GridContext {
 
             if (!def.col.comparator) {
                 def.col.comparator = (a, b) => {
-                    if (a < b) { return -1; }  
-                    if (a > b) { return 1; }  
+                    if (a < b) { return -1; }
+                    if (a > b) { return 1; }
                     return 0;
                 };
             }
@@ -866,19 +879,6 @@ export class GridContext {
     }
 }
 
-export class GridColumnPersistConf {
-    name: string;
-    flex?: number;
-    sort?: number;
-    align?: string;
-}
-
-export class GridPersistConf {
-    version: number;
-    limit: number;
-    columns: GridColumnPersistConf[];
-}
-
 
 // Actions apply to specific rows
 export class GridToolbarAction {
index bc3bf85..39e0cff 100644 (file)
@@ -125,7 +125,7 @@ export class OrgSelectComponent implements OnInit {
         }
     }
 
-    // 
+    //
     applyPermLimitOrgs(perms: string[]) {
 
         if (!perms) {
@@ -142,9 +142,9 @@ export class OrgSelectComponent implements OnInit {
         // NOTE: If permLimitOrgs is useful in a non-staff context
         // we need to change this to support non-staff perm checks.
         this.perm.hasWorkPermAt(perms, true).then(permMap => {
-            this.permLimitOrgs = 
+            this.permLimitOrgs =
                 // safari-friendly version of Array.flat()
-                Object.values(permMap).reduce((acc,val) => acc.concat(val), []);
+                Object.values(permMap).reduce((acc, val) => acc.concat(val), []);
         });
     }
 
@@ -188,7 +188,7 @@ export class OrgSelectComponent implements OnInit {
                 if (this.permLimitOrgs) {
                     // Avoid showing org units where the user does
                     // not have the requested permission.
-                    orgs = orgs.filter(org => 
+                    orgs = orgs.filter(org =>
                         this.permLimitOrgs.includes(org.id()));
                 }
 
index 9eb1196..88d0c8a 100644 (file)
@@ -42,7 +42,7 @@ export class StringService {
                 ctx: ctx,
                 resolve: resolve,
                 reject: reject
-            }
+            };
 
             this.pending.push(pend);
 
@@ -57,7 +57,7 @@ export class StringService {
     processPending() {
         const pstring = this.pending[0];
         this.strings[pstring.key].resolver(pstring.ctx).then(
-            txt => { 
+            txt => {
                 pstring.resolve(txt);
                 this.pending.shift();
                 if (this.pending.length) {
index d02238d..d3fccda 100644 (file)
@@ -4,18 +4,18 @@ import {Tree, TreeNode} from './tree';
 /*
 Tree Widget:
 
-<eg-tree 
-    [tree]="myTree"                                                      
-    (nodeClicked)="nodeClicked($event)">                                       
-</eg-tree>   
+<eg-tree
+    [tree]="myTree"
+    (nodeClicked)="nodeClicked($event)">
+</eg-tree>
 
 ----
 
 constructor() {
 
     const rootNode = new TreeNode({
-        id: 1, 
-        label: 'Root', 
+        id: 1,
+        label: 'Root',
         children: [
             new TreeNode({id: 2, label: 'Child'}),
             new TreeNode({id: 3, label: 'Child2'})
index a58cb32..cca36d4 100644 (file)
@@ -17,7 +17,7 @@ export class TreeNode {
     // Set by the tree.
     selected: boolean;
 
-    // Optional link to user-provided stuff.  
+    // Optional link to user-provided stuff.
     // This field is ignored by the tree.
     callerData: any;
 
@@ -57,7 +57,7 @@ export class Tree {
 
         const nodes = [];
 
-        const recurseTree = 
+        const recurseTree =
             (node: TreeNode, depth: number, hidden: boolean) => {
             if (!node) { return; }
 
@@ -76,7 +76,7 @@ export class Tree {
             }
 
             node.children.forEach(n => recurseTree(n, depth, !node.expanded));
-        }
+        };
 
         recurseTree(this.rootNode, 0, false);
         return nodes;
index 8926b17..267d4fc 100644 (file)
@@ -85,7 +85,7 @@ export class Pager {
 
         if (start + size > pcount) {
             start = pcount - size + 1;
-            if (start < 1) { start = 1 };
+            if (start < 1) { start = 1; }
         }
 
         if (start + size > pcount) {
index ccbc847..cb18477 100644 (file)
@@ -35,7 +35,7 @@ export class BasicAdminPageComponent implements OnInit {
         }
         const table = schema + '.' + this.route.snapshot.paramMap.get('table');
 
-        // Set the prefix to "server", "local", "workstation", 
+        // Set the prefix to "server", "local", "workstation",
         // extracted from the URL path.
         this.persistKeyPfx = this.route.snapshot.parent.url[0].path;
 
index f4f3b83..a5c72e2 100644 (file)
@@ -172,7 +172,7 @@ export class WorkstationsComponent implements OnInit {
         };
 
         this.workstations.push(ws);
-        this.store.setLocalItem('eg.workstation.all', this.workstations)
+        this.store.setLocalItem('eg.workstation.all', this.workstations);
         this.newName = '';
         // when registering our first workstation, mark it as the
         // default and show it as selected in the ws selector.
index 7d663bf..2c1ac2a 100644 (file)
@@ -36,7 +36,7 @@ export class StaffLoginComponent implements OnInit {
         this.renderer.selectRootElement('#username').focus();
 
         this.workstations = this.store.getLocalItem('eg.workstation.all');
-        this.args.workstation = 
+        this.args.workstation =
             this.store.getLocalItem('eg.workstation.default');
         this.applyWorkstation();
     }
index 1eeac6f..c477c11 100644 (file)
@@ -35,7 +35,7 @@ export class StaffNavComponent implements OnInit {
             err => {},
             () => {
                 this.currentLocale = this.locales.filter(
-                    l => l.code() === this.locale.currentLocaleCode())[0]
+                    l => l.code() === this.locale.currentLocaleCode())[0];
             }
         );
     }
index febfe35..be4452b 100644 (file)
@@ -53,12 +53,12 @@ export class AdminPageComponent implements OnInit {
     // Ditto includeOrgAncestors, but descendants.
     @Input() includeOrgDescendants: boolean;
 
-    // Optional grid persist key.  This is the part of the key 
+    // Optional grid persist key.  This is the part of the key
     // following eg.grid.
     @Input() persistKey: string;
 
-    // Optional path component to add to the generated grid persist key, 
-    // formatted as (for example): 
+    // Optional path component to add to the generated grid persist key,
+    // formatted as (for example):
     // 'eg.grid.admin.${persistKeyPfx}.config.billing_type'
     @Input() persistKeyPfx: string;
 
@@ -123,17 +123,17 @@ export class AdminPageComponent implements OnInit {
         this.idlClassDef = this.idl.classes[this.idlClass];
         this.pkeyField = this.idlClassDef.pkey || 'id';
 
-        this.translatableFields = 
+        this.translatableFields =
             this.idlClassDef.fields.filter(f => f.i18n).map(f => f.name);
 
         if (!this.persistKey) {
-            this.persistKey = 
-                'admin.' + 
-                (this.persistKeyPfx ? this.persistKeyPfx + '.' : '') + 
+            this.persistKey =
+                'admin.' +
+                (this.persistKeyPfx ? this.persistKeyPfx + '.' : '') +
                 this.idlClassDef.table;
         }
 
-        // Limit the view org selector to orgs where the user has 
+        // Limit the view org selector to orgs where the user has
         // permacrud-encoded view permissions.
         const pc = this.idlClassDef.permacrud;
         if (pc && pc.retrieve) {
@@ -204,11 +204,11 @@ export class AdminPageComponent implements OnInit {
                     this.translateFieldIdx = 0;
                 }
 
-                this.translator.idlObject = 
+                this.translator.idlObject =
                     this.dataSource.data[this.translateRowIdx];
-                this.translator.fieldName = 
+                this.translator.fieldName =
                     this.translatableFields[this.translateFieldIdx];
-            }
+            };
 
             this.translator.prevString = () => {
 
@@ -220,14 +220,14 @@ export class AdminPageComponent implements OnInit {
                     this.translateFieldIdx = 0;
                 }
 
-                this.translator.idlObject = 
+                this.translator.idlObject =
                     this.dataSource.data[this.translateRowIdx];
-                this.translator.fieldName = 
+                this.translator.fieldName =
                     this.translatableFields[this.translateFieldIdx];
-            }
+            };
 
-            this.translator.open({size:'lg'});
-        }
+            this.translator.open({size: 'lg'});
+        };
     }
 
     checkCreatePerms() {
index 1d3b0a5..9c7361c 100644 (file)
@@ -86,8 +86,8 @@ export class TranslateComponent
         this.existingTranslation = null;
 
         this.pcrud.search('i18n', {
-            translation: this.selectedLocale, 
-            fq_field : this.fqField(), 
+            translation: this.selectedLocale,
+            fq_field : this.fqField(),
             identity_value: this.identValue()
         }).subscribe(tr => {
             this.existingTranslation = tr;
@@ -105,10 +105,12 @@ export class TranslateComponent
     }
 
     translate() {
-        if (!this.translatedValue) return;
+        if (!this.translatedValue) { return; }
+
+        let entry;
 
         if (this.existingTranslation) {
-            const entry = this.existingTranslation;
+            entry = this.existingTranslation;
             entry.string(this.translatedValue);
 
             this.pcrud.update(entry).toPromise().then(
@@ -123,7 +125,7 @@ export class TranslateComponent
             return;
         }
 
-        const entry = this.idl.create('i18n');
+        entry = this.idl.create('i18n');
         entry.fq_field(this.fqField());
         entry.identity_value(this.identValue());
         entry.translation(this.selectedLocale);
index c53d62f..af6b647 100644 (file)
@@ -31,7 +31,7 @@ export class StaffSplashComponent implements OnInit {
         */
 
         // Route to AngularJS / TPAC catalog
-        window.location.href = 
+        window.location.href =
             '/eg/staff/cat/catalog/results?query=' +
             encodeURIComponent(this.catSearchQuery);
     }