From fc8bd352006cded176635cb31c0924a06f90777e Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 25 Mar 2019 20:48:05 +0000 Subject: [PATCH] LP1811288 Sandbox editor handles dismissals Teach the sandbox FM editor example to log a useful message on dialog dismissal instead of throwing an error (as a result of the uncaught rejection). Signed-off-by: Bill Erickson Signed-off-by: Dan Wells --- .../app/staff/sandbox/sandbox.component.html | 2 +- .../src/app/staff/sandbox/sandbox.component.ts | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html index f112aedf40..84e127e3c0 100644 --- a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html +++ b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html @@ -37,7 +37,7 @@ [fieldOptions]="{marc_record_type:{customValues:[{id:'biblio'},{id:'serial'},{id:'authority'}]},description:{customTemplate:{template:descriptionTemplate,context:{'hello':'goodbye'}}}}" recordId="1" orgDefaultAllowed="owner"> - diff --git a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts index 4ee4ebc0f7..9b058cd5b1 100644 --- a/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.ts @@ -14,6 +14,7 @@ import {DateSelectComponent} from '@eg/share/date-select/date-select.component'; import {PrintService} from '@eg/share/print/print.service'; import {ComboboxEntry} from '@eg/share/combobox/combobox.component'; import {FormatService} from '@eg/core/format.service'; +import {FmRecordEditorComponent} from '@eg/share/fm-editor/fm-editor.component'; @Component({ templateUrl: 'sandbox.component.html' @@ -29,6 +30,9 @@ export class SandboxComponent implements OnInit { @ViewChild('printTemplate') private printTemplate: TemplateRef; + @ViewChild('fmRecordEditor') + private fmRecordEditor: FmRecordEditorComponent; + // @ViewChild('helloStr') private helloStr: StringComponent; gridDataSource: GridDataSource = new GridDataSource(); @@ -132,6 +136,19 @@ export class SandboxComponent implements OnInit { }); } + openEditor() { + this.fmRecordEditor.open({size: 'lg'}).then( + ok => { console.debug(ok); }, + err => { + if (err && err.dismissed) { + console.debug('dialog was dismissed'); + } else { + console.error(err); + } + } + ); + } + btGridRowClassCallback(row: any): string { if (row.id() === 1) { return 'text-uppercase font-weight-bold text-danger'; -- 2.43.2