From 3453848854ae58d27e74cdd352b31bc5925a2a98 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 16 Aug 2019 17:00:11 -0400 Subject: [PATCH] LP1840050 Modularize various standalone components + more. Create container modules for the String, Translate, FM record editor, and Admin Page components & services. This simplifies imports and allows us to avoid requiring these modules on pages that don't need them. In particular, the staff splash page now loads fewer imports, which should improve initial load/login time. Additionally some components were enhanced. FM record editor now has a eg-fm-record-editor-action component so users can pass in an action, rendered as a button at the bottom of the editor. FM record editor gets a delete record option and hideBanner option. FM record editor now better handles real-time updates of its underlying recordId and record values, including updates to some editor callers to migrate to the modified API (replace recId with recordId). Signed-off-by: Bill Erickson --- .../share/fm-editor/fm-editor-action.component.ts | 31 ++++ .../app/share/fm-editor/fm-editor.component.html | 22 ++- .../src/app/share/fm-editor/fm-editor.component.ts | 171 +++++++++++++++++---- .../src/app/share/fm-editor/fm-editor.module.ts | 30 ++++ .../org-family-select/org-family-select.module.ts | 26 ++++ .../src/eg2/src/app/share/string/string.module.ts | 25 +++ .../share/translate/translate.component.html | 0 .../share/translate/translate.component.ts | 0 .../src/app/share/translate/translate.module.ts | 23 +++ .../src/eg2/src/app/staff/admin/common.module.ts | 11 +- .../staff/cat/vandelay/match-set-list.component.ts | 2 +- .../src/app/staff/cat/vandelay/vandelay.module.ts | 4 + .../eg2/src/app/staff/catalog/catalog.module.ts | 2 + .../app/staff/catalog/record/parts.component.ts | 4 +- Open-ILS/src/eg2/src/app/staff/common.module.ts | 20 +-- .../src/app/staff/sandbox/sandbox.component.html | 7 +- .../eg2/src/app/staff/sandbox/sandbox.component.ts | 2 +- .../eg2/src/app/staff/sandbox/sandbox.module.ts | 6 + .../staff/share/admin-page/admin-page.component.ts | 6 +- .../staff/share/admin-page/admin-page.module.ts | 33 ++++ 20 files changed, 364 insertions(+), 61 deletions(-) create mode 100644 Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor-action.component.ts create mode 100644 Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.module.ts create mode 100644 Open-ILS/src/eg2/src/app/share/org-family-select/org-family-select.module.ts create mode 100644 Open-ILS/src/eg2/src/app/share/string/string.module.ts rename Open-ILS/src/eg2/src/app/{staff => }/share/translate/translate.component.html (100%) rename Open-ILS/src/eg2/src/app/{staff => }/share/translate/translate.component.ts (100%) create mode 100644 Open-ILS/src/eg2/src/app/share/translate/translate.module.ts create mode 100644 Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.module.ts diff --git a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor-action.component.ts b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor-action.component.ts new file mode 100644 index 0000000000..298856d684 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor-action.component.ts @@ -0,0 +1,31 @@ +import {Component, Input, Output, EventEmitter, Host, OnInit} from '@angular/core'; +import {FmRecordEditorComponent} from './fm-editor.component'; + +@Component({ + selector: 'eg-fm-record-editor-action', + template: '' // no-op +}) + +export class FmRecordEditorActionComponent implements OnInit { + + // unique identifier + @Input() key: string; + + @Input() label: string; + + @Input() buttonCss = 'btn-outline-dark'; + + // Emits the 'key' of the clicked action. + @Output() actionClick: EventEmitter; + + @Input() disabled: boolean; + + constructor(@Host() private editor: FmRecordEditorComponent) { + this.actionClick = new EventEmitter(); + } + + ngOnInit() { + this.editor.actions.push(this); + } +} + diff --git a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html index fc11eee6c2..afae0effb1 100644 --- a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html +++ b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html @@ -4,8 +4,13 @@ + + + -