From: Jane Sandberg Date: Wed, 2 Sep 2020 19:32:07 +0000 (-0700) Subject: LP1849212: lint X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ea9779f461a372db1e169dbeb828736e253c65c3;p=contrib%2FConifer.git LP1849212: lint Signed-off-by: Jane Sandberg Signed-off-by: Michele Morgan Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-term-map.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-term-map.component.ts index 7fb460d4cb..bfca8a7270 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-term-map.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-term-map.component.ts @@ -25,4 +25,4 @@ import {Component} from '@angular/core'; export class CourseTermMapComponent { -} \ No newline at end of file +} diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-field.component.ts b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-field.component.ts new file mode 100644 index 0000000000..26d76fdf0a --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-field.component.ts @@ -0,0 +1,60 @@ +import {Component, Host, Input, OnInit, AfterViewInit} from '@angular/core'; +import {MarcSimplifiedEditorComponent} from './simplified-editor.component'; +import {MarcField, MarcSubfield} from '../marcrecord'; + +/** + * A field that a user can edit, which will later be + * compiled into MARC + */ + +@Component({ + selector: 'eg-marc-simplified-editor-field', + template: '' +}) +export class MarcSimplifiedEditorFieldComponent implements OnInit, AfterViewInit { + + @Input() tag = 'a'; + @Input() ind1 = ' '; + @Input() ind2 = ' '; + + subfieldIndex = 1; + + marcVersion: MarcField; + + addSubfield: (code: string, defaultValue?: string) => void; + + constructor(@Host() private editor: MarcSimplifiedEditorComponent) {} + + ngOnInit() { + this.marcVersion = { + tag: this.tag, + subfields: [], + authValid: false, + authChecked: false, + isCtrlField: false, + isControlfield: () => false, + indicator: (ind: number) => (ind === 1) ? this.ind1 : this.ind2, + deleteExactSubfields: (...subfield: MarcSubfield[]) => 0, // not used by the simplified editor + }; + + this.addSubfield = (code: string, defaultValue?: string) => { + this.marcVersion.subfields.push( + [ + code, + defaultValue ? defaultValue : '', + this.subfieldIndex + ] + ); + this.subfieldIndex += 1; + + }; + } + + ngAfterViewInit() { + this.editor.addField(this.marcVersion); + } + +} + + + diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-field.directive.ts b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-field.directive.ts deleted file mode 100644 index a5e7e0a76f..0000000000 --- a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-field.directive.ts +++ /dev/null @@ -1,60 +0,0 @@ -import {Directive, Host, Input, OnInit, AfterViewInit} from '@angular/core'; -import {MarcSimplifiedEditorComponent} from './simplified-editor.component'; -import {MarcField, MarcSubfield} from '../marcrecord'; -import {MarcSimplifiedEditorSubfieldDirective} from './simplified-editor-subfield.directive'; - -/** - * A field that a user can edit, which will later be - * compiled into MARC - */ - -@Directive({ - selector: 'eg-marc-simplified-editor-field', -}) -export class MarcSimplifiedEditorFieldDirective implements OnInit, AfterViewInit { - - @Input() tag = 'a'; - @Input() ind1 = ' '; - @Input() ind2 = ' '; - - subfieldIndex = 1; - - marcVersion: MarcField; - - addSubfield: (code: string, defaultValue?: string) => void; - - constructor(@Host() private editor: MarcSimplifiedEditorComponent) {} - - ngOnInit() { - this.marcVersion = { - tag: this.tag, - subfields: [], - authValid: false, - authChecked: false, - isCtrlField: false, - isControlfield: () => false, - indicator: (ind: number) => (ind === 1) ? this.ind1 : this.ind2, - deleteExactSubfields: (...subfield: MarcSubfield[]) => 0, // not used by the simplified editor - }; - - this.addSubfield = (code: string, defaultValue?: string) => { - this.marcVersion.subfields.push( - [ - code, - defaultValue ? defaultValue : '', - this.subfieldIndex - ] - ); - this.subfieldIndex += 1; - - } - } - - ngAfterViewInit() { - this.editor.addField(this.marcVersion); - } - -} - - - diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-subfield.component.ts b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-subfield.component.ts new file mode 100644 index 0000000000..24104cee7b --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-subfield.component.ts @@ -0,0 +1,24 @@ +import {Directive, Input, Host, OnInit, Component} from '@angular/core'; +import {MarcSimplifiedEditorFieldComponent} from './simplified-editor-field.component'; + +/** + * A subfield that a user can edit, which will later be + * compiled into MARC + */ + +@Component({ + selector: 'eg-marc-simplified-editor-subfield', + template: '' +}) +export class MarcSimplifiedEditorSubfieldComponent implements OnInit { + + @Input() code: string; + @Input() defaultValue: string; + + constructor(@Host() private field: MarcSimplifiedEditorFieldComponent) {} + + ngOnInit() { + this.field.addSubfield(this.code, this.defaultValue); + } + +} diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-subfield.directive.ts b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-subfield.directive.ts deleted file mode 100644 index d9474a85c5..0000000000 --- a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-subfield.directive.ts +++ /dev/null @@ -1,23 +0,0 @@ -import {Directive, Input, Host, OnInit} from '@angular/core'; -import {MarcSimplifiedEditorFieldDirective} from './simplified-editor-field.directive'; - -/** - * A subfield that a user can edit, which will later be - * compiled into MARC - */ - -@Directive({ - selector: 'eg-marc-simplified-editor-subfield', -}) -export class MarcSimplifiedEditorSubfieldDirective implements OnInit { - - @Input() code: string; - @Input() defaultValue: string; - - constructor(@Host() private field: MarcSimplifiedEditorFieldDirective) {} - - ngOnInit() { - this.field.addSubfield(this.code, this.defaultValue); - } - -} diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor.component.ts b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor.component.ts index 77405cc261..149bf26fe8 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor.component.ts @@ -3,9 +3,7 @@ import {FormGroup, FormControl} from '@angular/forms'; import {MarcField, MarcRecord} from '../marcrecord'; import {TagTableService} from '../tagtable.service'; import {NetService} from '@eg/core/net.service'; -import { ComboboxEntry } from '@eg/share/combobox/combobox.component'; -import { Observable, of } from 'rxjs'; -import { switchMap } from 'rxjs/operators'; +import {ComboboxEntry} from '@eg/share/combobox/combobox.component'; const DEFAULT_RECORD_TYPE = 'BKS'; @@ -57,22 +55,22 @@ export class MarcSimplifiedEditorComponent implements AfterViewInit, OnInit { field.fieldId = this.fieldIndex; this.fields.push(field); field.subfields.forEach((subfield) => { - this.editor.addControl(this.editorFieldIdentifier(field, subfield), new FormControl(null, [])); - }) + this.editor.addControl(this.editorFieldIdentifier(field, subfield), new FormControl(null, [])); + }); this.fieldIndex++; }; this.editorFieldIdentifier = (field: MarcField, subfield: Array) => { return field.tag + subfield[0]; // e.g. 245a - } + }; this.net.request('open-ils.cat', 'open-ils.cat.biblio.fixed_field_values.by_rec_type', DEFAULT_RECORD_TYPE, 'Form') .subscribe((forms) => { this.marcForms = forms['Form'].map((form) => { - return {id: form[0], label: form[1]} - }) + return {id: form[0], label: form[1]}; + }); }); this.net.request('open-ils.cat', @@ -80,8 +78,8 @@ export class MarcSimplifiedEditorComponent implements AfterViewInit, OnInit { DEFAULT_RECORD_TYPE, 'Type') .subscribe((types) => { this.marcTypes = types['Type'].map((type) => { - return {id: type[0], label: type[1]} - }) + return {id: type[0], label: type[1]}; + }); }); } @@ -91,7 +89,7 @@ export class MarcSimplifiedEditorComponent implements AfterViewInit, OnInit { this.fields.forEach((field) => { field.subfields.forEach((subfield) => { this.subfieldLabels[this.editorFieldIdentifier(field, subfield)] = table.getSubfieldLabel(field.tag, subfield[0]); - }) + }); }); }); } @@ -103,8 +101,8 @@ export class MarcSimplifiedEditorComponent implements AfterViewInit, OnInit { field.subfields.forEach((subfield) => { if (subfield[1] === '') { // Default value has not been applied subfield[1] = this.editor.get(this.editorFieldIdentifier(field, subfield)).value; - } - }) + } + }); }); record.fields = this.fields; diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor.module.ts b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor.module.ts index e17ad0efd1..3c0fe7aac2 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor.module.ts @@ -2,15 +2,15 @@ import {NgModule} from '@angular/core'; import {StaffCommonModule} from '@eg/staff/common.module'; import {CommonWidgetsModule} from '@eg/share/common-widgets.module'; import {MarcSimplifiedEditorComponent} from './simplified-editor.component'; -import {MarcSimplifiedEditorFieldDirective} from './simplified-editor-field.directive'; -import {MarcSimplifiedEditorSubfieldDirective} from './simplified-editor-subfield.directive'; +import {MarcSimplifiedEditorFieldComponent} from './simplified-editor-field.component'; +import {MarcSimplifiedEditorSubfieldComponent} from './simplified-editor-subfield.component'; import {TagTableService} from '../tagtable.service'; @NgModule({ declarations: [ MarcSimplifiedEditorComponent, - MarcSimplifiedEditorFieldDirective, - MarcSimplifiedEditorSubfieldDirective, + MarcSimplifiedEditorFieldComponent, + MarcSimplifiedEditorSubfieldComponent, ], imports: [ StaffCommonModule, @@ -18,8 +18,8 @@ import {TagTableService} from '../tagtable.service'; ], exports: [ MarcSimplifiedEditorComponent, - MarcSimplifiedEditorFieldDirective, - MarcSimplifiedEditorSubfieldDirective + MarcSimplifiedEditorFieldComponent, + MarcSimplifiedEditorSubfieldComponent ], providers: [ TagTableService