From 9a5cb5a2c07972f9b4ff7de8ea3329a1027a0b6b Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 7 Feb 2023 15:19:59 +0100 Subject: [PATCH] register bulk copy for documents --- .../entity-bulk-actions/copy/copy.action.ts | 21 +++++++++++++++++++ .../entity-bulk-actions/manifests.ts | 15 ++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-bulk-actions/copy/copy.action.ts diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-bulk-actions/copy/copy.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-bulk-actions/copy/copy.action.ts new file mode 100644 index 0000000000..d555a79c3b --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-bulk-actions/copy/copy.action.ts @@ -0,0 +1,21 @@ +import { UmbDocumentRepository } from '../../repository/document.repository'; +import { UmbActionBase } from '../../../../shared/entity-actions'; +import { UmbControllerHostInterface } from '@umbraco-cms/controller'; + +export class UmbDocumentCopyEntityBulkAction extends UmbActionBase { + #selection: Array; + + constructor(host: UmbControllerHostInterface, repositoryAlias: string, selection: Array) { + super(host, repositoryAlias); + this.#selection = selection; + } + + setSelection(selection: Array) { + this.#selection = selection; + } + + async execute() { + console.log(`execute copy for: ${this.#selection}`); + await this.repository?.copy(); + } +} diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-bulk-actions/manifests.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-bulk-actions/manifests.ts index 07d3d3522f..10da47405a 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-bulk-actions/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-bulk-actions/manifests.ts @@ -1,4 +1,5 @@ import { UmbDocumentMoveEntityBulkAction } from './move/move.action'; +import { UmbDocumentCopyEntityBulkAction } from './copy/copy.action'; import { ManifestEntityBulkAction } from '@umbraco-cms/extensions-registry'; const entityType = 'document'; @@ -9,7 +10,7 @@ const entityActions: Array = [ type: 'entityBulkAction', alias: 'Umb.EntityBulkAction.Document.Move', name: 'Move Document Entity Bulk Action', - weight: 1000, + weight: 10, meta: { entityType, label: 'Move', @@ -17,6 +18,18 @@ const entityActions: Array = [ api: UmbDocumentMoveEntityBulkAction, }, }, + { + type: 'entityBulkAction', + alias: 'Umb.EntityBulkAction.Document.Copy', + name: 'Copy Document Entity Bulk Action', + weight: 9, + meta: { + entityType, + label: 'Copy', + repositoryAlias, + api: UmbDocumentCopyEntityBulkAction, + }, + }, ]; export const manifests = [...entityActions];