diff --git a/src/Umbraco.Web.UI.Client/libs/extensions-registry/workspace-action.models.ts b/src/Umbraco.Web.UI.Client/libs/extensions-registry/workspace-action.models.ts index 8804544841..d020346c10 100644 --- a/src/Umbraco.Web.UI.Client/libs/extensions-registry/workspace-action.models.ts +++ b/src/Umbraco.Web.UI.Client/libs/extensions-registry/workspace-action.models.ts @@ -11,5 +11,6 @@ export interface MetaWorkspaceAction { label?: string; //TODO: Use or implement additional label-key look?: InterfaceLook; color?: InterfaceColor; - api?: any; //TODO: Implement UmbEntityAction + repositoryAlias: string; + api: any; //TODO: Implement UmbEntityAction } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/create-blueprint.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/create-blueprint.action.ts index e501085939..b4b615d9ca 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/create-blueprint.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/create-blueprint.action.ts @@ -1,13 +1,17 @@ import { UmbDocumentRepository } from '../repository/document.repository'; -import { UmbEntityActionBase } from '../../../shared/components/entity-action'; +import { UmbActionBase } from '../../../shared/components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbCreateDocumentBlueprintEntityAction extends UmbEntityActionBase { +export class UmbCreateDocumentBlueprintEntityAction extends UmbActionBase { + #unique: string; + constructor(host: UmbControllerHostInterface, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + super(host, repositoryAlias); + this.#unique = unique; } async execute() { + console.log(`execute for: ${this.#unique}`); await this.repository?.createBlueprint(); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/create.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/create.action.ts index 6801efeaa4..5dc3446aa9 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/create.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/create.action.ts @@ -1,13 +1,17 @@ import { UmbDocumentRepository } from '../repository/document.repository'; -import { UmbEntityActionBase } from '../../../shared/components/entity-action'; +import { UmbActionBase } from '../../../shared/components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbCreateDocumentEntityAction extends UmbEntityActionBase { +export class UmbCreateDocumentEntityAction extends UmbActionBase { + #unique: string; + constructor(host: UmbControllerHostInterface, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + super(host, repositoryAlias); + this.#unique = unique; } execute() { + console.log(`execute for: ${this.#unique}`); alert('open create dialog'); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/culture-and-hostnames.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/culture-and-hostnames.action.ts index dcb6729e71..55edf1184e 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/culture-and-hostnames.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/culture-and-hostnames.action.ts @@ -1,13 +1,17 @@ import { UmbDocumentRepository } from '../repository/document.repository'; -import { UmbEntityActionBase } from '../../../shared/components/entity-action'; +import { UmbActionBase } from '../../../shared/components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbDocumentCultureAndHostnamesEntityAction extends UmbEntityActionBase { +export class UmbDocumentCultureAndHostnamesEntityAction extends UmbActionBase { + #unique: string; + constructor(host: UmbControllerHostInterface, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + super(host, repositoryAlias); + this.#unique = unique; } async execute() { + console.log(`execute for: ${this.#unique}`); await this.repository?.setCultureAndHostnames(); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/permissions.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/permissions.action.ts index b7ef6b3a9d..7d755eb1d4 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/permissions.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/permissions.action.ts @@ -1,13 +1,17 @@ import { UmbDocumentRepository } from '../repository/document.repository'; -import { UmbEntityActionBase } from '../../../shared/components/entity-action'; +import { UmbActionBase } from '../../../shared/components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbDocumentPermissionsEntityAction extends UmbEntityActionBase { +export class UmbDocumentPermissionsEntityAction extends UmbActionBase { + #unique: string; + constructor(host: UmbControllerHostInterface, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + super(host, repositoryAlias); + this.#unique = unique; } async execute() { + console.log(`execute for: ${this.#unique}`); await this.repository?.setPermissions(); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/public-access.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/public-access.action.ts index 0d1c5af596..5f52b96adb 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/public-access.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/public-access.action.ts @@ -1,13 +1,17 @@ import { UmbDocumentRepository } from '../repository/document.repository'; -import { UmbEntityActionBase } from '../../../shared/components/entity-action'; +import { UmbActionBase } from '../../../shared/components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbDocumentPublicAccessEntityAction extends UmbEntityActionBase { +export class UmbDocumentPublicAccessEntityAction extends UmbActionBase { + #unique: string; + constructor(host: UmbControllerHostInterface, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + super(host, repositoryAlias); + this.#unique = unique; } async execute() { + console.log(`execute for: ${this.#unique}`); await this.repository?.setPublicAccess(); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/publish.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/publish.action.ts index a1597a7674..0e1348aab1 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/publish.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/publish.action.ts @@ -1,13 +1,17 @@ import { UmbDocumentRepository } from '../repository/document.repository'; -import { UmbEntityActionBase } from '../../../shared/components/entity-action'; +import { UmbActionBase } from '../../../shared/components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbPublishDocumentEntityAction extends UmbEntityActionBase { +export class UmbPublishDocumentEntityAction extends UmbActionBase { + #unique: string; + constructor(host: UmbControllerHostInterface, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + super(host, repositoryAlias); + this.#unique = unique; } async execute() { + console.log(`execute for: ${this.#unique}`); await this.repository?.publish(); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/rollback.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/rollback.action.ts index dcac2df06a..0e67775d7b 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/rollback.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/rollback.action.ts @@ -1,13 +1,17 @@ import { UmbDocumentRepository } from '../repository/document.repository'; -import { UmbEntityActionBase } from '../../../shared/components/entity-action'; +import { UmbActionBase } from '../../../shared/components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbRollbackDocumentEntityAction extends UmbEntityActionBase { +export class UmbRollbackDocumentEntityAction extends UmbActionBase { + #unique: string; + constructor(host: UmbControllerHostInterface, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + super(host, repositoryAlias); + this.#unique = unique; } async execute() { + console.log(`execute for: ${this.#unique}`); await this.repository?.rollback(); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/unpublish.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/unpublish.action.ts index 067cd75ea3..47f887ee13 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/unpublish.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/unpublish.action.ts @@ -1,13 +1,17 @@ import { UmbDocumentRepository } from '../repository/document.repository'; -import { UmbEntityActionBase } from '../../../shared/components/entity-action'; +import { UmbActionBase } from '../../../shared/components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbUnpublishDocumentEntityAction extends UmbEntityActionBase { +export class UmbUnpublishDocumentEntityAction extends UmbActionBase { + #unique: string; + constructor(host: UmbControllerHostInterface, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + super(host, repositoryAlias); + this.#unique = unique; } async execute() { + console.log(`execute for: ${this.#unique}`); await this.repository?.unpublish(); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/actions/save-and-preview.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/actions/save-and-preview.action.ts index 3ee0657541..de24db885a 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/actions/save-and-preview.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/actions/save-and-preview.action.ts @@ -1,13 +1,14 @@ -import { UmbDocumentRepository } from '../../repository/document.repository'; -import { UmbDocumentWorkspaceContext } from '../document-workspace.context'; import { UmbWorkspaceAction } from '../../../../shared/components/workspace/workspace-action'; +import { UmbDocumentWorkspaceContext } from '../document-workspace.context'; +import { UmbDocumentRepository } from '../../repository/document.repository'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbSaveAndPreviewDocumentWorkspaceAction extends UmbWorkspaceAction { - #workspaceContext?: UmbDocumentWorkspaceContext; - - constructor(host: UmbControllerHostInterface, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); +export class UmbDocumentSaveAndPreviewWorkspaceAction extends UmbWorkspaceAction< + UmbDocumentRepository, + UmbDocumentWorkspaceContext +> { + constructor(host: UmbControllerHostInterface, repositoryAlias: string) { + super(host, repositoryAlias); } async execute() { diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/actions/save-and-publish.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/actions/save-and-publish.action.ts index 5773b858da..9d32a23225 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/actions/save-and-publish.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/actions/save-and-publish.action.ts @@ -1,13 +1,14 @@ -import { UmbDocumentRepository } from '../../repository/document.repository'; -import { UmbDocumentWorkspaceContext } from '../document-workspace.context'; import { UmbWorkspaceAction } from '../../../../shared/components/workspace/workspace-action'; +import { UmbDocumentWorkspaceContext } from '../document-workspace.context'; +import { UmbDocumentRepository } from '../../repository/document.repository'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbSaveAndPublishDocumentWorkspaceAction extends UmbWorkspaceAction { - #workspaceContext?: UmbDocumentWorkspaceContext; - - constructor(host: UmbControllerHostInterface, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); +export class UmbDocumentSaveAndPublishWorkspaceAction extends UmbWorkspaceAction< + UmbDocumentRepository, + UmbDocumentWorkspaceContext +> { + constructor(host: UmbControllerHostInterface, repositoryAlias: string) { + super(host, repositoryAlias); } async execute() { diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/actions/save-and-schedule.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/actions/save-and-schedule.action.ts index 91c55aa791..3c79e5fd37 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/actions/save-and-schedule.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/actions/save-and-schedule.action.ts @@ -1,13 +1,14 @@ +import { UmbWorkspaceAction } from '../../../../shared/components/workspace/workspace-action'; import { UmbDocumentRepository } from '../../repository/document.repository'; import { UmbDocumentWorkspaceContext } from '../document-workspace.context'; -import { UmbWorkspaceAction } from '../../../../shared/components/workspace/workspace-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbSaveAndScheduleDocumentWorkspaceAction extends UmbWorkspaceAction { - #workspaceContext?: UmbDocumentWorkspaceContext; - - constructor(host: UmbControllerHostInterface, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); +export class UmbSaveAndScheduleDocumentWorkspaceAction extends UmbWorkspaceAction< + UmbDocumentRepository, + UmbDocumentWorkspaceContext +> { + constructor(host: UmbControllerHostInterface, repositoryAlias: string) { + super(host, repositoryAlias); } async execute() { diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/actions/save.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/actions/save.action.ts index c872e5240c..ecc951ebb8 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/actions/save.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/actions/save.action.ts @@ -1,10 +1,14 @@ -import { UmbDocumentRepository } from '../../repository/document.repository'; import { UmbWorkspaceAction } from '../../../../shared/components/workspace/workspace-action'; +import { UmbDocumentRepository } from '../../repository/document.repository'; +import { UmbDocumentWorkspaceContext } from '../document-workspace.context'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbSaveDocumentWorkspaceAction extends UmbWorkspaceAction { - constructor(host: UmbControllerHostInterface, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); +export class UmbSaveDocumentWorkspaceAction extends UmbWorkspaceAction< + UmbDocumentRepository, + UmbDocumentWorkspaceContext +> { + constructor(host: UmbControllerHostInterface, repositoryAlias: string) { + super(host, repositoryAlias); } async execute() { diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/manifests.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/manifests.ts index 765fb821e8..624477ff70 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/manifests.ts @@ -5,9 +5,9 @@ import type { ManifestWorkspaceView, ManifestWorkspaceViewCollection, } from '@umbraco-cms/models'; -import { UmbSaveAndPublishDocumentWorkspaceAction } from './actions/save-and-publish.action'; +import { UmbDocumentSaveAndPublishWorkspaceAction } from './actions/save-and-publish.action'; import { UmbSaveDocumentWorkspaceAction } from './actions/save.action'; -import { UmbSaveAndPreviewDocumentWorkspaceAction } from './actions/save-and-preview.action'; +import { UmbDocumentSaveAndPreviewWorkspaceAction } from './actions/save-and-preview.action'; import { UmbSaveAndScheduleDocumentWorkspaceAction } from './actions/save-and-schedule.action'; const workspace: ManifestWorkspace = { @@ -79,7 +79,8 @@ const workspaceActions: Array = [ label: 'Save And Publish', look: 'primary', color: 'positive', - api: UmbSaveAndPublishDocumentWorkspaceAction, + repositoryAlias: DOCUMENT_REPOSITORY_ALIAS, + api: UmbDocumentSaveAndPublishWorkspaceAction, }, }, { @@ -91,6 +92,7 @@ const workspaceActions: Array = [ workspaces: ['Umb.Workspace.Document'], label: 'Save', look: 'secondary', + repositoryAlias: DOCUMENT_REPOSITORY_ALIAS, api: UmbSaveDocumentWorkspaceAction, }, }, @@ -102,7 +104,8 @@ const workspaceActions: Array = [ meta: { workspaces: ['Umb.Workspace.Document'], label: 'Save And Preview', - api: UmbSaveAndPreviewDocumentWorkspaceAction, + repositoryAlias: DOCUMENT_REPOSITORY_ALIAS, + api: UmbDocumentSaveAndPreviewWorkspaceAction, }, }, { @@ -113,6 +116,7 @@ const workspaceActions: Array = [ meta: { workspaces: ['Umb.Workspace.Document'], label: 'Save And Schedule', + repositoryAlias: DOCUMENT_REPOSITORY_ALIAS, api: UmbSaveAndScheduleDocumentWorkspaceAction, }, }, diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/entity-action/index.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/entity-action/index.ts index 51b8369892..249731dcf7 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/entity-action/index.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/entity-action/index.ts @@ -3,20 +3,21 @@ import { umbExtensionsRegistry } from '@umbraco-cms/extensions-api'; import { UmbObserverController } from '@umbraco-cms/observable-api'; import { createExtensionClass } from 'libs/extensions-api/create-extension-class.function'; -export interface UmbEntityAction { - unique: string; - repository: T; +export interface UmbAction { + repository: RepositoryType; execute(): Promise; } -export class UmbEntityActionBase { - host: UmbControllerHostInterface; +export interface UmbEntityAction extends UmbAction { unique: string; - repository?: T; +} - constructor(host: UmbControllerHostInterface, repositoryAlias: string, unique: string) { +export class UmbActionBase { + host: UmbControllerHostInterface; + repository?: RepositoryType; + + constructor(host: UmbControllerHostInterface, repositoryAlias: string) { this.host = host; - this.unique = unique; // TODO: unsure a method can't be called before everything is initialized new UmbObserverController( @@ -26,7 +27,7 @@ export class UmbEntityActionBase { if (!repositoryManifest) return; try { - const result = await createExtensionClass(repositoryManifest, [this.host]); + const result = await createExtensionClass(repositoryManifest, [this.host]); this.repository = result; } catch (error) { throw new Error('Could not create repository with alias: ' + repositoryAlias + ''); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-action/index.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-action/index.ts index 453e5fa4b6..27ae3ded9a 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-action/index.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-action/index.ts @@ -1,13 +1,13 @@ -import { UmbEntityActionBase } from '../../entity-action'; +import { UmbActionBase } from '../../entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; import { UmbContextConsumerController } from '@umbraco-cms/context-api'; -export class UmbWorkspaceAction extends UmbEntityActionBase { - workspaceContext: any; - constructor(host: UmbControllerHostInterface, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); +export class UmbWorkspaceAction extends UmbActionBase { + workspaceContext?: WorkspaceType; + constructor(host: UmbControllerHostInterface, repositoryAlias: string) { + super(host, repositoryAlias); - new UmbContextConsumerController(this.host, 'umbWorkspaceContext', (instance) => { + new UmbContextConsumerController(this.host, 'umbWorkspaceContext', (instance: WorkspaceType) => { this.workspaceContext = instance; }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-action/workspace-action.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-action/workspace-action.element.ts index 3cae7ba75b..f78b27acd1 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-action/workspace-action.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/workspace/workspace-action/workspace-action.element.ts @@ -29,7 +29,7 @@ export class UmbWorkspaceActionElement extends UmbLitElement { #createApi() { if (!this._manifest?.meta.api) return; - this.#api = new this._manifest.meta.api(this); + this.#api = new this._manifest.meta.api(this, this._manifest.meta.repositoryAlias); } #api: any; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/entity-actions/copy.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/entity-actions/copy.action.ts index 205e8e7df1..296938f83e 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/entity-actions/copy.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/entity-actions/copy.action.ts @@ -1,12 +1,16 @@ -import { UmbEntityActionBase } from '../components/entity-action'; +import { UmbActionBase } from '../components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbCopyEntityAction }> extends UmbEntityActionBase { +export class UmbCopyEntityAction }> extends UmbActionBase { + #unique: string; + constructor(host: UmbControllerHostInterface, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + super(host, repositoryAlias); + this.#unique = unique; } async execute() { + console.log(`execute for: ${this.#unique}`); await this.repository?.copy(); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/entity-actions/move.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/entity-actions/move.action.ts index 698549ce41..14c395ca46 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/entity-actions/move.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/entity-actions/move.action.ts @@ -1,12 +1,16 @@ -import { UmbEntityActionBase } from '../components/entity-action'; +import { UmbActionBase } from '../components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbMoveEntityAction }> extends UmbEntityActionBase { +export class UmbMoveEntityAction }> extends UmbActionBase { + #unique: string; + constructor(host: UmbControllerHostInterface, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + super(host, repositoryAlias); + this.#unique = unique; } async execute() { + console.log(`execute for: ${this.#unique}`); await this.repository?.move(); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/entity-actions/sort-children-of.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/entity-actions/sort-children-of.action.ts index 1453a9c7eb..17a24639da 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/entity-actions/sort-children-of.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/entity-actions/sort-children-of.action.ts @@ -1,14 +1,16 @@ -import { UmbEntityActionBase } from '../components/entity-action'; +import { UmbActionBase } from '../components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbSortChildrenOfEntityAction< - T extends { sortChildrenOf(): Promise } -> extends UmbEntityActionBase { +export class UmbSortChildrenOfEntityAction }> extends UmbActionBase { + #unique: string; + constructor(host: UmbControllerHostInterface, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + super(host, repositoryAlias); + this.#unique = unique; } async execute() { + console.log(`execute for: ${this.#unique}`); await this.repository?.sortChildrenOf(); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/entity-actions/trash.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/entity-actions/trash.action.ts index 8452d3f2d9..90957cf98a 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/entity-actions/trash.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/entity-actions/trash.action.ts @@ -1,15 +1,17 @@ -import { UmbEntityActionBase } from '../components/entity-action'; +import { UmbActionBase } from '../components/entity-action'; import { UmbContextConsumerController } from '@umbraco-cms/context-api'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; import { UmbModalService, UMB_MODAL_SERVICE_CONTEXT_TOKEN } from '@umbraco-cms/modal'; export class UmbTrashEntityAction< T extends { trash(unique: string): Promise; requestTreeItems(uniques: Array): any } -> extends UmbEntityActionBase { +> extends UmbActionBase { + #unique: string; #modalService?: UmbModalService; - constructor(host: UmbControllerHostInterface, repositoryAlias: string, key: string) { - super(host, repositoryAlias, key); + constructor(host: UmbControllerHostInterface, repositoryAlias: string, unique: string) { + super(host, repositoryAlias); + this.#unique = unique; new UmbContextConsumerController(this.host, UMB_MODAL_SERVICE_CONTEXT_TOKEN, (instance) => { this.#modalService = instance; @@ -19,7 +21,7 @@ export class UmbTrashEntityAction< async execute() { if (!this.repository) return; - const { data } = await this.repository.requestTreeItems([this.unique]); + const { data } = await this.repository.requestTreeItems([this.#unique]); if (data) { const item = data[0]; @@ -33,7 +35,7 @@ export class UmbTrashEntityAction< modalHandler?.onClose().then(({ confirmed }) => { if (confirmed) { - this.repository?.trash(this.unique); + this.repository?.trash(this.#unique); } }); }