From df0c2559f4e42234359869f6e1fd650ba685d822 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 Signed-off-by: Galen Charlton --- Open-ILS/src/eg2/src/app/common.module.ts | 12 +- .../fm-editor/fm-editor-action.component.ts | 31 +++ .../share/fm-editor/fm-editor.component.html | 22 ++- .../share/fm-editor/fm-editor.component.ts | 177 ++++++++++++++---- .../app/share/fm-editor/fm-editor.module.ts | 30 +++ .../org-family-select.module.ts | 26 +++ .../eg2/src/app/share/string/string.module.ts | 23 +++ .../share/translate/translate.component.html | 0 .../share/translate/translate.component.ts | 0 .../app/share/translate/translate.module.ts | 23 +++ .../eg2/src/app/staff/admin/common.module.ts | 11 +- .../src/app/staff/booking/booking.module.ts | 4 + .../booking/create-reservation.component.ts | 2 +- .../booking/reservations-grid.component.ts | 2 +- .../cat/vandelay/match-set-list.component.ts | 2 +- .../app/staff/cat/vandelay/vandelay.module.ts | 4 + .../src/app/staff/catalog/catalog.module.ts | 2 + .../staff/catalog/record/parts.component.ts | 4 +- .../src/eg2/src/app/staff/common.module.ts | 12 -- .../app/staff/sandbox/sandbox.component.html | 7 +- .../app/staff/sandbox/sandbox.component.ts | 2 +- .../src/app/staff/sandbox/sandbox.module.ts | 6 + .../share/admin-page/admin-page.component.ts | 6 +- .../share/admin-page/admin-page.module.ts | 34 ++++ 24 files changed, 374 insertions(+), 68 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/common.module.ts b/Open-ILS/src/eg2/src/app/common.module.ts index af1f2b0705..d61eeabb3a 100644 --- a/Open-ILS/src/eg2/src/app/common.module.ts +++ b/Open-ILS/src/eg2/src/app/common.module.ts @@ -28,8 +28,7 @@ import {ProgressDialogComponent} from '@eg/share/dialog/progress.component'; import {BoolDisplayComponent} from '@eg/share/util/bool.component'; import {ToastService} from '@eg/share/toast/toast.service'; import {ToastComponent} from '@eg/share/toast/toast.component'; -import {StringComponent} from '@eg/share/string/string.component'; -import {StringService} from '@eg/share/string/string.service'; +import {StringModule} from '@eg/share/string/string.module'; @NgModule({ @@ -42,7 +41,6 @@ import {StringService} from '@eg/share/string/string.service'; ProgressInlineComponent, ProgressDialogComponent, ToastComponent, - StringComponent, BoolDisplayComponent ], imports: [ @@ -51,7 +49,8 @@ import {StringService} from '@eg/share/string/string.service'; ReactiveFormsModule, RouterModule, NgbModule, - EgCoreModule + EgCoreModule, + StringModule ], exports: [ CommonModule, @@ -59,6 +58,7 @@ import {StringService} from '@eg/share/string/string.service'; NgbModule, FormsModule, EgCoreModule, + StringModule, ReactiveFormsModule, PrintComponent, DialogComponent, @@ -68,8 +68,7 @@ import {StringService} from '@eg/share/string/string.service'; ProgressInlineComponent, ProgressDialogComponent, BoolDisplayComponent, - ToastComponent, - StringComponent + ToastComponent ] }) @@ -82,7 +81,6 @@ export class EgCommonModule { providers: [ HatchService, PrintService, - StringService, ToastService ] }; 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 bb0e34785e..e1ba382b63 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 @@ + + + -