From 5f2c0195fe69fca9036340c1a100df9dceb9f972 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Sun, 3 Mar 2024 16:07:23 +0100 Subject: [PATCH] update create actions --- .../entity-action/create/create.action.ts | 14 ++++++++------ .../entity-actions/create/create.action.ts | 12 ++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/entity-action/create/create.action.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/entity-action/create/create.action.ts index 05bc35c411..0a4b9730b3 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/entity-action/create/create.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/entity-action/create/create.action.ts @@ -1,17 +1,19 @@ -import type { UmbDictionaryDetailRepository } from '../../repository/index.js'; +import type { UmbEntityActionArgs } from '@umbraco-cms/backoffice/entity-action'; import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action'; -import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api'; +import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; -export default class UmbCreateDictionaryEntityAction extends UmbEntityActionBase { - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { - super(host, repositoryAlias, unique, entityType); +export default class UmbCreateDictionaryEntityAction extends UmbEntityActionBase> { + constructor(host: UmbControllerHost, args: UmbEntityActionArgs) { + super(host, args); } async execute() { history.pushState( {}, '', - `/section/dictionary/workspace/dictionary/create/parent/${this.entityType}/${this.unique ?? 'null'}`, + `/section/dictionary/workspace/dictionary/create/parent/${this.args.entityType}/${this.args.unique ?? 'null'}`, ); } + + destroy(): void {} } diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media-types/entity-actions/create/create.action.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media-types/entity-actions/create/create.action.ts index 0d0a00268f..d0576f7b5c 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media-types/entity-actions/create/create.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media-types/entity-actions/create/create.action.ts @@ -1,22 +1,22 @@ -import type { UmbMediaTypeDetailRepository } from '../../repository/detail/media-type-detail.repository.js'; import { UMB_MEDIA_TYPE_CREATE_OPTIONS_MODAL } from './modal/index.js'; +import type { UmbEntityActionArgs } from '@umbraco-cms/backoffice/entity-action'; import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action'; import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal'; -export class UmbCreateMediaTypeEntityAction extends UmbEntityActionBase { +export class UmbCreateMediaTypeEntityAction extends UmbEntityActionBase> { async execute() { - if (!this.repository) throw new Error('Repository is not available'); - const modalManager = await this.getContext(UMB_MODAL_MANAGER_CONTEXT); const modalContext = modalManager.open(this, UMB_MEDIA_TYPE_CREATE_OPTIONS_MODAL, { data: { parent: { - unique: this.unique, - entityType: this.entityType, + unique: this.args.unique, + entityType: this.args.entityType, }, }, }); await modalContext.onSubmit(); } + + destroy(): void {} }