diff --git a/src/Umbraco.Web.UI.Client/libs/extensions-registry/tree.models.ts b/src/Umbraco.Web.UI.Client/libs/extensions-registry/tree.models.ts index 017bede8bd..e170cb24bc 100644 --- a/src/Umbraco.Web.UI.Client/libs/extensions-registry/tree.models.ts +++ b/src/Umbraco.Web.UI.Client/libs/extensions-registry/tree.models.ts @@ -8,5 +8,5 @@ export interface ManifestTree extends ManifestBase { export interface MetaTree { storeAlias?: string; - repository?: UmbRepositoryFactory; + repository?: UmbRepositoryFactory; } diff --git a/src/Umbraco.Web.UI.Client/libs/models/index.ts b/src/Umbraco.Web.UI.Client/libs/models/index.ts index 22756bffb9..6d2e751277 100644 --- a/src/Umbraco.Web.UI.Client/libs/models/index.ts +++ b/src/Umbraco.Web.UI.Client/libs/models/index.ts @@ -7,6 +7,7 @@ import { PagedEntityTreeItem, ProblemDetails, } from '@umbraco-cms/backend-api'; +import { UmbControllerHostInterface } from '@umbraco-cms/controller'; import { UmbTreeRepository } from 'libs/repository/tree-repository.interface'; import { Observable } from 'rxjs'; @@ -158,8 +159,6 @@ export interface DataSourceResponse { data?: T; error?: ProblemDetails; } - -// TODO; figure out why we can't add UmbControllerHostInterface as host type -export interface UmbRepositoryFactory { - new (host: any): UmbTreeRepository; +export interface UmbRepositoryFactory { + new (host: UmbControllerHostInterface): T; } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/copy.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/copy.action.ts index 2f0d0b1e0b..267de6f359 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/copy.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/copy.action.ts @@ -1,15 +1,13 @@ +import { UmbDocumentRepository } from '../repository/document.repository'; +import { UmbEntityActionBase } from '../../../shared/components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbCopyDocumentEntityAction { - #host: UmbControllerHostInterface; - #key: string; - - constructor(host: UmbControllerHostInterface, key: string) { - this.#host = host; - this.#key = key; +export class UmbCopyDocumentEntityAction extends UmbEntityActionBase { + constructor(host: UmbControllerHostInterface, unique: string) { + super(host, UmbDocumentRepository, unique); } - execute() { - alert('copy'); + async execute() { + await this.repository.copy(); } } 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 a1270e965f..2cd87c59b6 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,15 +1,13 @@ +import { UmbDocumentRepository } from '../repository/document.repository'; +import { UmbEntityActionBase } from '../../../shared/components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbCreateDocumentBlueprintEntityAction { - #host: UmbControllerHostInterface; - #key: string; - - constructor(host: UmbControllerHostInterface, key: string) { - this.#host = host; - this.#key = key; +export class UmbCreateDocumentBlueprintEntityAction extends UmbEntityActionBase { + constructor(host: UmbControllerHostInterface, unique: string) { + super(host, UmbDocumentRepository, unique); } - execute() { - alert('Blueprint'); + async execute() { + 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 5d3205f8b2..83a9992357 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,15 +1,13 @@ +import { UmbDocumentRepository } from '../repository/document.repository'; +import { UmbEntityActionBase } from '../../../shared/components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbCreateDocumentEntityAction { - #host: UmbControllerHostInterface; - #key: string; - - constructor(host: UmbControllerHostInterface, key: string) { - this.#host = host; - this.#key = key; +export class UmbCreateDocumentEntityAction extends UmbEntityActionBase { + constructor(host: UmbControllerHostInterface, unique: string) { + super(host, UmbDocumentRepository, unique); } execute() { - alert('create'); + 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 cd8d0f0d58..4a47638475 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,15 +1,13 @@ +import { UmbDocumentRepository } from '../repository/document.repository'; +import { UmbEntityActionBase } from '../../../shared/components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbDocumentCultureAndHostnamesEntityAction { - #host: UmbControllerHostInterface; - #key: string; - - constructor(host: UmbControllerHostInterface, key: string) { - this.#host = host; - this.#key = key; +export class UmbDocumentCultureAndHostnamesEntityAction extends UmbEntityActionBase { + constructor(host: UmbControllerHostInterface, unique: string) { + super(host, UmbDocumentRepository, unique); } - execute() { - alert('culture and hostnames'); + async execute() { + await this.repository.setCultureAndHostnames(); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/move.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/move.action.ts index fdfed756af..5c676e2de2 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/move.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/move.action.ts @@ -1,15 +1,13 @@ +import { UmbDocumentRepository } from '../repository/document.repository'; +import { UmbEntityActionBase } from '../../../shared/components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbMoveDocumentEntityAction { - #host: UmbControllerHostInterface; - #key: string; - - constructor(host: UmbControllerHostInterface, key: string) { - this.#host = host; - this.#key = key; +export class UmbMoveDocumentEntityAction extends UmbEntityActionBase { + constructor(host: UmbControllerHostInterface, unique: string) { + super(host, UmbDocumentRepository, unique); } - execute() { - alert('move'); + async execute() { + await this.repository.move(); } } 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 615fbec183..45d6a1b44c 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,15 +1,13 @@ +import { UmbDocumentRepository } from '../repository/document.repository'; +import { UmbEntityActionBase } from '../../../shared/components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbDocumentPermissionsEntityAction { - #host: UmbControllerHostInterface; - #key: string; - - constructor(host: UmbControllerHostInterface, key: string) { - this.#host = host; - this.#key = key; +export class UmbDocumentPermissionsEntityAction extends UmbEntityActionBase { + constructor(host: UmbControllerHostInterface, unique: string) { + super(host, UmbDocumentRepository, unique); } - execute() { - alert('Permissions'); + async execute() { + 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 b8d0c3e93c..4c3e7fb08a 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,15 +1,13 @@ +import { UmbDocumentRepository } from '../repository/document.repository'; +import { UmbEntityActionBase } from '../../../shared/components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbDocumentPublicAccessEntityAction { - #host: UmbControllerHostInterface; - #key: string; - - constructor(host: UmbControllerHostInterface, key: string) { - this.#host = host; - this.#key = key; +export class UmbDocumentPublicAccessEntityAction extends UmbEntityActionBase { + constructor(host: UmbControllerHostInterface, unique: string) { + super(host, UmbDocumentRepository, unique); } - execute() { - alert('public access'); + async execute() { + 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 4c84126b37..00823bc1b5 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,15 +1,13 @@ +import { UmbDocumentRepository } from '../repository/document.repository'; +import { UmbEntityActionBase } from '../../../shared/components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbPublishDocumentEntityAction { - #host: UmbControllerHostInterface; - #key: string; - - constructor(host: UmbControllerHostInterface, key: string) { - this.#host = host; - this.#key = key; +export class UmbPublishDocumentEntityAction extends UmbEntityActionBase { + constructor(host: UmbControllerHostInterface, unique: string) { + super(host, UmbDocumentRepository, unique); } - execute() { - alert('publish'); + async execute() { + 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 a35d34da6a..70d7035d9d 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,15 +1,13 @@ +import { UmbDocumentRepository } from '../repository/document.repository'; +import { UmbEntityActionBase } from '../../../shared/components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbRollbackDocumentEntityAction { - #host: UmbControllerHostInterface; - #key: string; - - constructor(host: UmbControllerHostInterface, key: string) { - this.#host = host; - this.#key = key; +export class UmbRollbackDocumentEntityAction extends UmbEntityActionBase { + constructor(host: UmbControllerHostInterface, unique: string) { + super(host, UmbDocumentRepository, unique); } - execute() { - alert('Rollback'); + async execute() { + await this.repository.rollback(); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/save-and-preview.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/save-and-preview.action.ts index bef0c26311..d44216350b 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/save-and-preview.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/save-and-preview.action.ts @@ -1,15 +1,13 @@ +import { UmbDocumentRepository } from '../repository/document.repository'; +import { UmbEntityActionBase } from '../../../shared/components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbSaveAndPreviewDocumentEntityAction { - #host: UmbControllerHostInterface; - #key: string; - - constructor(host: UmbControllerHostInterface, key: string) { - this.#host = host; - this.#key = key; +export class UmbSaveAndPreviewDocumentEntityAction extends UmbEntityActionBase { + constructor(host: UmbControllerHostInterface, unique: string) { + super(host, UmbDocumentRepository, unique); } - execute() { - alert('save and preview'); + async execute() { + await this.repository.saveAndPreview(); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/save-and-publish.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/save-and-publish.action.ts index ea781507d8..58de17d829 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/save-and-publish.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/save-and-publish.action.ts @@ -1,15 +1,13 @@ +import { UmbDocumentRepository } from '../repository/document.repository'; +import { UmbEntityActionBase } from '../../../shared/components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbSaveAndPublishDocumentEntityAction { - #host: UmbControllerHostInterface; - #key: string; - - constructor(host: UmbControllerHostInterface, key: string) { - this.#host = host; - this.#key = key; +export class UmbSaveAndPublishDocumentEntityAction extends UmbEntityActionBase { + constructor(host: UmbControllerHostInterface, unique: string) { + super(host, UmbDocumentRepository, unique); } - execute() { - alert('save and publish'); + async execute() { + await this.repository.saveAndPublish(); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/save-and-schedule.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/save-and-schedule.action.ts index 823e6619d2..b18db77126 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/save-and-schedule.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/save-and-schedule.action.ts @@ -1,15 +1,13 @@ +import { UmbDocumentRepository } from '../repository/document.repository'; +import { UmbEntityActionBase } from '../../../shared/components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbSaveAndScheduleDocumentEntityAction { - #host: UmbControllerHostInterface; - #key: string; - - constructor(host: UmbControllerHostInterface, key: string) { - this.#host = host; - this.#key = key; +export class UmbSaveAndScheduleDocumentEntityAction extends UmbEntityActionBase { + constructor(host: UmbControllerHostInterface, unique: string) { + super(host, UmbDocumentRepository, unique); } - execute() { - alert('save and schedule'); + async execute() { + await this.repository.saveAndSchedule(); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/save.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/save.action.ts index 41ebfe0a03..115d5a86d3 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/save.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/save.action.ts @@ -2,20 +2,16 @@ import { UmbDocumentRepository } from '../repository/document.repository'; import { UmbDocumentWorkspaceContext } from '../workspace/document-workspace.context'; import { UmbContextConsumerController } from '@umbraco-cms/context-api'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; +import { UmbEntityActionBase } from 'src/backoffice/shared/components/entity-action'; -export class UmbSaveDocumentEntityAction { - #host: UmbControllerHostInterface; - #key: string; - #documentRepository: UmbDocumentRepository; +export class UmbSaveDocumentEntityAction extends UmbEntityActionBase { #workspaceContext?: UmbDocumentWorkspaceContext; - constructor(host: UmbControllerHostInterface, key: string) { - this.#host = host; - this.#key = key; - this.#documentRepository = new UmbDocumentRepository(this.#host); // TODO: make repository injectable + constructor(host: UmbControllerHostInterface, unique: string) { + super(host, UmbDocumentRepository, unique); // TODO: add context token for workspace - new UmbContextConsumerController(this.#host, 'umbWorkspaceContext', (instance: UmbDocumentWorkspaceContext) => { + new UmbContextConsumerController(this.host, 'umbWorkspaceContext', (instance: UmbDocumentWorkspaceContext) => { this.#workspaceContext = instance; }); } @@ -29,6 +25,6 @@ export class UmbSaveDocumentEntityAction { const document = this.#workspaceContext.getData(); // TODO: handle errors if (!document) return; - this.#documentRepository.saveDetail(document); + this.repository.saveDetail(document); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/sort-children-of.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/sort-children-of.action.ts index 590ff6c3dd..1ff82bbe74 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/sort-children-of.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/sort-children-of.action.ts @@ -1,15 +1,13 @@ +import { UmbDocumentRepository } from '../repository/document.repository'; +import { UmbEntityActionBase } from '../../../shared/components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbSortChildrenOfDocumentEntityAction { - #host: UmbControllerHostInterface; - #key: string; - - constructor(host: UmbControllerHostInterface, key: string) { - this.#host = host; - this.#key = key; +export class UmbSortChildrenOfDocumentEntityAction extends UmbEntityActionBase { + constructor(host: UmbControllerHostInterface, unique: string) { + super(host, UmbDocumentRepository, unique); } - execute() { - alert('Sort'); + async execute() { + await this.repository.sortChildrenOf(); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/trash.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/trash.action.ts index 2d72ff925c..a27177a4c7 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/trash.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/trash.action.ts @@ -1,26 +1,22 @@ import { UmbDocumentRepository } from '../repository/document.repository'; +import { UmbEntityActionBase } from '../../../shared/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 UmbTrashDocumentEntityAction { - #host: UmbControllerHostInterface; - #key: string; +export class UmbTrashDocumentEntityAction extends UmbEntityActionBase { #modalService?: UmbModalService; - #documentRepository: UmbDocumentRepository; constructor(host: UmbControllerHostInterface, key: string) { - this.#host = host; - this.#key = key; - this.#documentRepository = new UmbDocumentRepository(this.#host); // TODO: make repository injectable + super(host, UmbDocumentRepository, key); - new UmbContextConsumerController(this.#host, UMB_MODAL_SERVICE_CONTEXT_TOKEN, (instance) => { + new UmbContextConsumerController(this.host, UMB_MODAL_SERVICE_CONTEXT_TOKEN, (instance) => { this.#modalService = instance; }); } async execute() { - const { data } = await this.#documentRepository.requestTreeItems([this.#key]); + const { data } = await this.repository.requestTreeItems([this.unique]); if (data) { const item = data[0]; @@ -34,7 +30,7 @@ export class UmbTrashDocumentEntityAction { modalHandler?.onClose().then(({ confirmed }) => { if (confirmed) { - this.#documentRepository.delete(this.#key); + this.repository.delete(this.unique); } }); } 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 58782590ff..dfa24e9dfe 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,15 +1,13 @@ +import { UmbDocumentRepository } from '../repository/document.repository'; +import { UmbEntityActionBase } from '../../../shared/components/entity-action'; import { UmbControllerHostInterface } from '@umbraco-cms/controller'; -export class UmbUnpublishDocumentEntityAction { - #host: UmbControllerHostInterface; - #key: string; - - constructor(host: UmbControllerHostInterface, key: string) { - this.#host = host; - this.#key = key; +export class UmbUnpublishDocumentEntityAction extends UmbEntityActionBase { + constructor(host: UmbControllerHostInterface, unique: string) { + super(host, UmbDocumentRepository, unique); } - execute() { - alert('unpublish'); + async execute() { + await this.repository.unpublish(); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/repository/document.repository.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/repository/document.repository.ts index 8c786dffed..4409ff3aec 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/repository/document.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/repository/document.repository.ts @@ -215,4 +215,59 @@ export class UmbDocumentRepository implements UmbTreeRepository, UmbDetailReposi return { error }; } + + // Listing all currently known methods we need to implement: + // these currently only covers posting data + // TODO: find a good way to split these + async saveAndPublish() { + alert('save and publish'); + } + + async saveAndPreview() { + alert('save and preview'); + } + + async saveAndSchedule() { + alert('save and schedule'); + } + + async createBlueprint() { + alert('create document blueprint'); + } + + async move() { + alert('move'); + } + + async copy() { + alert('copy'); + } + + async sortChildrenOf() { + alert('sort'); + } + + async setCultureAndHostnames() { + alert('set culture and hostnames'); + } + + async setPermissions() { + alert('set permissions'); + } + + async setPublicAccess() { + alert('set public access'); + } + + async publish() { + alert('publish'); + } + + async unpublish() { + alert('unpublish'); + } + + async rollback() { + alert('rollback'); + } } 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 new file mode 100644 index 0000000000..bc7ac09ca4 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/entity-action/index.ts @@ -0,0 +1,20 @@ +import { UmbControllerHostInterface } from '@umbraco-cms/controller'; +import type { UmbRepositoryFactory } from '@umbraco-cms/models'; + +export interface UmbEntityAction { + unique: string; + repository: T; + execute(): Promise; +} + +export class UmbEntityActionBase { + host: UmbControllerHostInterface; + unique: string; + repository: T; + + constructor(host: UmbControllerHostInterface, repository: UmbRepositoryFactory, unique: string) { + this.host = host; + this.unique = unique; + this.repository = new repository(this.host); + } +}