register bulk copy for documents

This commit is contained in:
Mads Rasmussen
2023-02-07 15:19:59 +01:00
parent f15f358dd1
commit 9a5cb5a2c0
2 changed files with 35 additions and 1 deletions

View File

@@ -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<UmbDocumentRepository> {
#selection: Array<string>;
constructor(host: UmbControllerHostInterface, repositoryAlias: string, selection: Array<string>) {
super(host, repositoryAlias);
this.#selection = selection;
}
setSelection(selection: Array<string>) {
this.#selection = selection;
}
async execute() {
console.log(`execute copy for: ${this.#selection}`);
await this.repository?.copy();
}
}

View File

@@ -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<ManifestEntityBulkAction> = [
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<ManifestEntityBulkAction> = [
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];