|
1 |
| -import type { UmbContentTypeCompositionModel, UmbContentTypeDetailModel, UmbContentTypeSortModel } from '../types.js'; |
2 | 1 | import { UmbContentTypeStructureManager } from '../structure/index.js';
|
| 2 | +import type { UmbContentTypeCompositionModel, UmbContentTypeDetailModel, UmbContentTypeSortModel } from '../types.js'; |
3 | 3 | import type { UmbContentTypeWorkspaceContext } from './content-type-workspace-context.interface.js';
|
| 4 | +import { UmbEntityDetailWorkspaceContextBase } from '@umbraco-cms/backoffice/workspace'; |
| 5 | +import { |
| 6 | + UmbEntityUpdatedEvent, |
| 7 | + UmbRequestReloadChildrenOfEntityEvent, |
| 8 | + UmbRequestReloadStructureForEntityEvent, |
| 9 | +} from '@umbraco-cms/backoffice/entity-action'; |
| 10 | +import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action'; |
| 11 | +import type { Observable } from '@umbraco-cms/backoffice/observable-api'; |
4 | 12 | import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
| 13 | +import type { UmbEntityModel } from '@umbraco-cms/backoffice/entity'; |
5 | 14 | import type {
|
6 | 15 | UmbDetailRepository,
|
7 | 16 | UmbRepositoryResponse,
|
8 | 17 | UmbRepositoryResponseWithAsObservable,
|
9 | 18 | } from '@umbraco-cms/backoffice/repository';
|
10 |
| -import { |
11 |
| - UmbEntityDetailWorkspaceContextBase, |
12 |
| - type UmbEntityDetailWorkspaceContextArgs, |
13 |
| - type UmbEntityDetailWorkspaceContextCreateArgs, |
14 |
| - type UmbRoutableWorkspaceContext, |
| 19 | +import type { |
| 20 | + UmbEntityDetailWorkspaceContextArgs, |
| 21 | + UmbEntityDetailWorkspaceContextCreateArgs, |
| 22 | + UmbRoutableWorkspaceContext, |
15 | 23 | } from '@umbraco-cms/backoffice/workspace';
|
16 | 24 | import type { UmbReferenceByUnique } from '@umbraco-cms/backoffice/models';
|
17 |
| -import type { Observable } from '@umbraco-cms/backoffice/observable-api'; |
18 |
| -import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action'; |
19 |
| -import { |
20 |
| - UmbRequestReloadChildrenOfEntityEvent, |
21 |
| - UmbRequestReloadStructureForEntityEvent, |
22 |
| -} from '@umbraco-cms/backoffice/entity-action'; |
23 |
| -import type { UmbEntityModel } from '@umbraco-cms/backoffice/entity'; |
24 | 25 |
|
25 | 26 | // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
26 | 27 | export interface UmbContentTypeWorkspaceContextArgs extends UmbEntityDetailWorkspaceContextArgs {}
|
@@ -183,16 +184,28 @@ export abstract class UmbContentTypeWorkspaceContextBase<
|
183 | 184 |
|
184 | 185 | this._data.setPersisted(this.structure.getOwnerContentType());
|
185 | 186 |
|
186 |
| - const actionEventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT); |
187 |
| - if (!actionEventContext) { |
| 187 | + const eventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT); |
| 188 | + if (!eventContext) { |
188 | 189 | throw new Error('Could not get the action event context');
|
189 | 190 | }
|
190 |
| - const event = new UmbRequestReloadStructureForEntityEvent({ |
191 |
| - unique: this.getUnique()!, |
192 |
| - entityType: this.getEntityType(), |
| 191 | + |
| 192 | + const unique = this.getUnique()!; |
| 193 | + const entityType = this.getEntityType(); |
| 194 | + |
| 195 | + const reloadStructureEvent = new UmbRequestReloadStructureForEntityEvent({ |
| 196 | + unique, |
| 197 | + entityType, |
| 198 | + }); |
| 199 | + |
| 200 | + eventContext.dispatchEvent(reloadStructureEvent); |
| 201 | + |
| 202 | + const updatedEvent = new UmbEntityUpdatedEvent({ |
| 203 | + unique, |
| 204 | + entityType, |
| 205 | + eventUnique: this._workspaceEventUnique, |
193 | 206 | });
|
194 | 207 |
|
195 |
| - actionEventContext.dispatchEvent(event); |
| 208 | + eventContext.dispatchEvent(updatedEvent); |
196 | 209 | } catch (error) {
|
197 | 210 | console.error(error);
|
198 | 211 | }
|
|
0 commit comments