From: Galen Charlton Date: Tue, 17 May 2022 15:35:31 +0000 (+0000) Subject: LP#1929749: tweaks to import template management X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0c54be511c1673008f814e451ba701022bfbd7fe;p=working%2FEvergreen.git LP#1929749: tweaks to import template management - toast now displayed when a template is saved, deleted, or marked as default - fixed bug with making another template be the new default one Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/eg2/src/app/staff/acq/picklist/upload.component.html b/Open-ILS/src/eg2/src/app/staff/acq/picklist/upload.component.html index 8265892fde..1ccc883acf 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/picklist/upload.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/picklist/upload.component.html @@ -5,6 +5,9 @@ + + + diff --git a/Open-ILS/src/eg2/src/app/staff/acq/picklist/upload.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/picklist/upload.component.ts index d5785e0f18..ef12730b17 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/picklist/upload.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/picklist/upload.component.ts @@ -7,6 +7,7 @@ import {NetService} from '@eg/core/net.service'; import {EventService} from '@eg/core/event.service'; import {OrgService} from '@eg/core/org.service'; import {AuthService} from '@eg/core/auth.service'; +import {StringComponent} from '@eg/share/string/string.component'; import {ToastService} from '@eg/share/toast/toast.service'; import {ComboboxComponent, ComboboxEntry} from '@eg/share/combobox/combobox.component'; @@ -140,6 +141,13 @@ export class UploadComponent implements OnInit, AfterViewInit, OnDestroy { private fallThruMergeProfileSelector: ComboboxComponent; @ViewChild('dupeQueueAlert', { static: true }) private dupeQueueAlert: AlertDialogComponent; + @ViewChild('loadMarcOrderTemplateSavedString', { static: false }) + private loadMarcOrderTemplateSavedString: StringComponent; + @ViewChild('loadMarcOrderTemplateDeletedString', { static: false }) + private loadMarcOrderTemplateDeletedString: StringComponent; + @ViewChild('loadMarcOrderTemplateSetAsDefaultString', { static: false }) + private loadMarcOrderTemplateSetAsDefaultString: StringComponent; + constructor( private http: HttpClient, @@ -591,21 +599,25 @@ export class UploadComponent implements OnInit, AfterViewInit, OnDestroy { const template = {}; TEMPLATE_ATTRS.forEach(key => template[key] = this[key]); - console.debug('Saving import profile', template); - this.formTemplates[this.selectedTemplate] = template; - return this.store.setItem(TEMPLATE_SETTING_NAME, this.formTemplates); + this.store.setItem(TEMPLATE_SETTING_NAME, this.formTemplates).then(x => + this.loadMarcOrderTemplateSavedString.current() + .then(str => this.toast.success(str)) + ); } markTemplateDefault() { Object.keys(this.formTemplates).forEach( - name => delete this.formTemplates.default + name => delete this.formTemplates[name].default ); this.formTemplates[this.selectedTemplate].default = true; - return this.store.setItem(TEMPLATE_SETTING_NAME, this.formTemplates); + this.store.setItem(TEMPLATE_SETTING_NAME, this.formTemplates).then(x => + this.loadMarcOrderTemplateSetAsDefaultString.current() + .then(str => this.toast.success(str)) + ); } templateSelectorChange(entry: ComboboxEntry) { @@ -640,7 +652,10 @@ export class UploadComponent implements OnInit, AfterViewInit, OnDestroy { deleteTemplate() { delete this.formTemplates[this.selectedTemplate]; this.formTemplateSelector.selected = null; - return this.store.setItem(TEMPLATE_SETTING_NAME, this.formTemplates); + this.store.setItem(TEMPLATE_SETTING_NAME, this.formTemplates).then(x => + this.loadMarcOrderTemplateDeletedString.current() + .then(str => this.toast.success(str)) + ); } }