entity-bulk-actions
This commit is contained in:
@@ -3,6 +3,7 @@ import { html, ifDefined, customElement, property } from '@umbraco-cms/backoffic
|
||||
import { UmbExecutedEvent } from '@umbraco-cms/backoffice/events';
|
||||
import { ManifestEntityBulkAction } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
|
||||
import { createExtensionApi } from '@umbraco-cms/backoffice/extension-api';
|
||||
|
||||
@customElement('umb-entity-bulk-action')
|
||||
export class UmbEntityBulkActionElement extends UmbLitElement {
|
||||
@@ -34,9 +35,9 @@ export class UmbEntityBulkActionElement extends UmbLitElement {
|
||||
}
|
||||
}
|
||||
|
||||
#createApi() {
|
||||
async #createApi() {
|
||||
if (!this._manifest?.meta.api) return;
|
||||
this.#api = new this._manifest.meta.api(this, this._manifest.meta.repositoryAlias, this._selection);
|
||||
this.#api = await createExtensionApi(this._manifest, [this._manifest.meta.repositoryAlias, this._selection]);
|
||||
}
|
||||
|
||||
#api?: UmbEntityBulkAction;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { ManifestElement, ManifestWithConditions } from '@umbraco-cms/backoffice/extension-api';
|
||||
import type { ManifestElementAndApi, ManifestWithConditions } from '@umbraco-cms/backoffice/extension-api';
|
||||
|
||||
/**
|
||||
* An action to perform on multiple entities
|
||||
* For example for content you may wish to move one or more documents in bulk
|
||||
*/
|
||||
export interface ManifestEntityBulkAction extends ManifestElement, ManifestWithConditions<ConditionsEntityBulkAction> {
|
||||
export interface ManifestEntityBulkAction extends ManifestElementAndApi, ManifestWithConditions<ConditionsEntityBulkAction> {
|
||||
type: 'entityBulkAction';
|
||||
meta: MetaEntityBulkAction;
|
||||
}
|
||||
@@ -15,11 +15,6 @@ export interface MetaEntityBulkAction {
|
||||
*/
|
||||
label: string;
|
||||
|
||||
/**
|
||||
* @TJS-ignore
|
||||
*/
|
||||
api: any; // create interface
|
||||
|
||||
/**
|
||||
* The alias for the repsoitory of the entity type this action is for
|
||||
* such as 'Umb.Repository.Documents'
|
||||
|
||||
@@ -11,10 +11,10 @@ const entityActions: Array<ManifestEntityBulkAction> = [
|
||||
alias: 'Umb.EntityBulkAction.Document.Move',
|
||||
name: 'Move Document Entity Bulk Action',
|
||||
weight: 10,
|
||||
api: UmbDocumentMoveEntityBulkAction,
|
||||
meta: {
|
||||
label: 'Move',
|
||||
repositoryAlias: DOCUMENT_REPOSITORY_ALIAS,
|
||||
api: UmbDocumentMoveEntityBulkAction,
|
||||
},
|
||||
conditions: {
|
||||
entityType,
|
||||
@@ -25,10 +25,10 @@ const entityActions: Array<ManifestEntityBulkAction> = [
|
||||
alias: 'Umb.EntityBulkAction.Document.Copy',
|
||||
name: 'Copy Document Entity Bulk Action',
|
||||
weight: 9,
|
||||
api: UmbDocumentCopyEntityBulkAction,
|
||||
meta: {
|
||||
label: 'Copy',
|
||||
repositoryAlias: DOCUMENT_REPOSITORY_ALIAS,
|
||||
api: UmbDocumentCopyEntityBulkAction,
|
||||
},
|
||||
conditions: {
|
||||
entityType,
|
||||
|
||||
@@ -12,10 +12,10 @@ const entityActions: Array<ManifestEntityBulkAction> = [
|
||||
alias: 'Umb.EntityBulkAction.Media.Move',
|
||||
name: 'Move Media Entity Bulk Action',
|
||||
weight: 100,
|
||||
api: UmbMediaMoveEntityBulkAction,
|
||||
meta: {
|
||||
label: 'Move',
|
||||
repositoryAlias: MEDIA_REPOSITORY_ALIAS,
|
||||
api: UmbMediaMoveEntityBulkAction,
|
||||
},
|
||||
conditions: {
|
||||
entityType,
|
||||
@@ -26,10 +26,10 @@ const entityActions: Array<ManifestEntityBulkAction> = [
|
||||
alias: 'Umb.EntityBulkAction.Media.Copy',
|
||||
name: 'Copy Media Entity Bulk Action',
|
||||
weight: 90,
|
||||
api: UmbMediaCopyEntityBulkAction,
|
||||
meta: {
|
||||
label: 'Copy',
|
||||
repositoryAlias: MEDIA_REPOSITORY_ALIAS,
|
||||
api: UmbMediaCopyEntityBulkAction,
|
||||
},
|
||||
conditions: {
|
||||
entityType,
|
||||
@@ -40,10 +40,10 @@ const entityActions: Array<ManifestEntityBulkAction> = [
|
||||
alias: 'Umb.EntityBulkAction.Media.Trash',
|
||||
name: 'Trash Media Entity Bulk Action',
|
||||
weight: 80,
|
||||
api: UmbMediaTrashEntityBulkAction,
|
||||
meta: {
|
||||
label: 'Trash',
|
||||
repositoryAlias: MEDIA_REPOSITORY_ALIAS,
|
||||
api: UmbMediaTrashEntityBulkAction,
|
||||
},
|
||||
conditions: {
|
||||
entityType,
|
||||
|
||||
@@ -10,10 +10,10 @@ const entityActions: Array<ManifestEntityBulkAction> = [
|
||||
alias: 'Umb.EntityBulkAction.UserGroup.Delete',
|
||||
name: 'Delete User Group Entity Bulk Action',
|
||||
weight: 400,
|
||||
api: UmbDeleteUserGroupEntityBulkAction,
|
||||
meta: {
|
||||
label: 'Delete',
|
||||
repositoryAlias: USER_GROUP_REPOSITORY_ALIAS,
|
||||
api: UmbDeleteUserGroupEntityBulkAction,
|
||||
},
|
||||
conditions: {
|
||||
entityType,
|
||||
|
||||
@@ -13,10 +13,10 @@ const entityActions: Array<ManifestEntityBulkAction> = [
|
||||
alias: 'Umb.EntityBulkAction.User.SetGroup',
|
||||
name: 'SetGroup User Entity Bulk Action',
|
||||
weight: 400,
|
||||
api: UmbSetGroupUserEntityBulkAction,
|
||||
meta: {
|
||||
label: 'SetGroup',
|
||||
repositoryAlias: USER_REPOSITORY_ALIAS,
|
||||
api: UmbSetGroupUserEntityBulkAction,
|
||||
},
|
||||
conditions: {
|
||||
entityType,
|
||||
@@ -27,10 +27,10 @@ const entityActions: Array<ManifestEntityBulkAction> = [
|
||||
alias: 'Umb.EntityBulkAction.User.Enable',
|
||||
name: 'Enable User Entity Bulk Action',
|
||||
weight: 300,
|
||||
api: UmbEnableUserEntityBulkAction,
|
||||
meta: {
|
||||
label: 'Enable',
|
||||
repositoryAlias: USER_REPOSITORY_ALIAS,
|
||||
api: UmbEnableUserEntityBulkAction,
|
||||
},
|
||||
conditions: {
|
||||
entityType,
|
||||
@@ -41,10 +41,10 @@ const entityActions: Array<ManifestEntityBulkAction> = [
|
||||
alias: 'Umb.EntityBulkAction.User.Unlock',
|
||||
name: 'Unlock User Entity Bulk Action',
|
||||
weight: 200,
|
||||
api: UmbUnlockUserEntityBulkAction,
|
||||
meta: {
|
||||
label: 'Unlock',
|
||||
repositoryAlias: USER_REPOSITORY_ALIAS,
|
||||
api: UmbUnlockUserEntityBulkAction,
|
||||
},
|
||||
conditions: {
|
||||
entityType,
|
||||
@@ -55,10 +55,10 @@ const entityActions: Array<ManifestEntityBulkAction> = [
|
||||
alias: 'Umb.EntityBulkAction.User.Disable',
|
||||
name: 'Disable User Entity Bulk Action',
|
||||
weight: 100,
|
||||
api: UmbDisableUserEntityBulkAction,
|
||||
meta: {
|
||||
label: 'Disable',
|
||||
repositoryAlias: USER_REPOSITORY_ALIAS,
|
||||
api: UmbDisableUserEntityBulkAction,
|
||||
},
|
||||
conditions: {
|
||||
entityType,
|
||||
|
||||
@@ -178,11 +178,11 @@ const manifest = {
|
||||
alias: 'My.EntityBulkAction',
|
||||
name: 'My Entity Bulk Action',
|
||||
weight: 10,
|
||||
api: MyEntityBulkAction,
|
||||
meta: {
|
||||
icon: 'umb:add',
|
||||
label: 'My Entity Bulk Action',
|
||||
repositoryAlias: 'My.Repository',
|
||||
api: MyEntityBulkAction,
|
||||
},
|
||||
conditions: {
|
||||
entityType: 'my-entity',
|
||||
|
||||
Reference in New Issue
Block a user