show notification when data type is saved

This commit is contained in:
Mads Rasmussen
2022-07-05 18:55:48 +02:00
parent fa7f9bcd2b
commit 40beff7cf3

View File

@@ -6,6 +6,7 @@ import { IRoute, IRoutingInfo, RouterSlot } from 'router-slot';
import { map, Subscription } from 'rxjs';
import { UmbContextConsumerMixin } from '../../core/context';
import { UmbExtensionManifestEditorView, UmbExtensionRegistry } from '../../core/extension';
import { UmbNotificationService } from '../../core/services/notification.service';
import { UmbDataTypeStore } from '../../core/stores/data-type.store';
import { DataTypeEntity } from '../../mocks/data/data-type.data';
@@ -64,6 +65,7 @@ export class UmbEditorDataTypeElement extends UmbContextConsumerMixin(LitElement
private _dataTypeSubscription?: Subscription;
private _extensionRegistry?: UmbExtensionRegistry;
private _editorViewsSubscription?: Subscription;
private _notificationService?: UmbNotificationService;
private _routerFolder = '';
@@ -80,6 +82,10 @@ export class UmbEditorDataTypeElement extends UmbContextConsumerMixin(LitElement
this._useEditorViews();
});
this.consumeContext('umbNotificationService', (service: UmbNotificationService) => {
this._notificationService = service;
});
// TODO: temp solution to handle property editor UI change
this.addEventListener('change', this._handleChange);
}
@@ -176,6 +182,7 @@ export class UmbEditorDataTypeElement extends UmbContextConsumerMixin(LitElement
try {
this._saveButtonState = 'waiting';
await this._dataTypeStore.save([this._dataType]);
this._notificationService?.peek('Data Type saved');
this._saveButtonState = 'success';
} catch (error) {
this._saveButtonState = 'failed';