From: Bill Erickson Date: Fri, 16 Aug 2019 21:00:11 +0000 (-0400) Subject: LP1840050 Modularize various standalone components + more. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=df0c2559f4e42234359869f6e1fd650ba685d822;p=evergreen%2Fpines.git 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 --- 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 @@ + + + -