add conditions to bulk action manifest
This commit is contained in:
@@ -3,11 +3,15 @@ import type { ManifestElement } from './models';
|
||||
export interface ManifestEntityBulkAction extends ManifestElement {
|
||||
type: 'entityBulkAction';
|
||||
meta: MetaEntityBulkAction;
|
||||
conditions: ConditionsEntityBulkAction;
|
||||
}
|
||||
|
||||
export interface MetaEntityBulkAction {
|
||||
label: string;
|
||||
entityType: string;
|
||||
api: any; // create interface
|
||||
repositoryAlias: string;
|
||||
}
|
||||
|
||||
export interface ConditionsEntityBulkAction {
|
||||
entityType: string;
|
||||
}
|
||||
|
||||
@@ -12,11 +12,13 @@ const entityActions: Array<ManifestEntityBulkAction> = [
|
||||
name: 'Move Document Entity Bulk Action',
|
||||
weight: 10,
|
||||
meta: {
|
||||
entityType,
|
||||
label: 'Move',
|
||||
repositoryAlias: DOCUMENT_REPOSITORY_ALIAS,
|
||||
api: UmbDocumentMoveEntityBulkAction,
|
||||
},
|
||||
conditions: {
|
||||
entityType,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'entityBulkAction',
|
||||
@@ -24,11 +26,13 @@ const entityActions: Array<ManifestEntityBulkAction> = [
|
||||
name: 'Copy Document Entity Bulk Action',
|
||||
weight: 9,
|
||||
meta: {
|
||||
entityType,
|
||||
label: 'Copy',
|
||||
repositoryAlias: DOCUMENT_REPOSITORY_ALIAS,
|
||||
api: UmbDocumentCopyEntityBulkAction,
|
||||
},
|
||||
conditions: {
|
||||
entityType,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -13,11 +13,13 @@ const entityActions: Array<ManifestEntityBulkAction> = [
|
||||
name: 'Move Media Entity Bulk Action',
|
||||
weight: 100,
|
||||
meta: {
|
||||
entityType,
|
||||
label: 'Move',
|
||||
repositoryAlias: MEDIA_REPOSITORY_ALIAS,
|
||||
api: UmbMediaMoveEntityBulkAction,
|
||||
},
|
||||
conditions: {
|
||||
entityType,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'entityBulkAction',
|
||||
@@ -25,11 +27,13 @@ const entityActions: Array<ManifestEntityBulkAction> = [
|
||||
name: 'Copy Media Entity Bulk Action',
|
||||
weight: 90,
|
||||
meta: {
|
||||
entityType,
|
||||
label: 'Copy',
|
||||
repositoryAlias: MEDIA_REPOSITORY_ALIAS,
|
||||
api: UmbMediaCopyEntityBulkAction,
|
||||
},
|
||||
conditions: {
|
||||
entityType,
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'entityBulkAction',
|
||||
@@ -37,11 +41,13 @@ const entityActions: Array<ManifestEntityBulkAction> = [
|
||||
name: 'Trash Media Entity Bulk Action',
|
||||
weight: 80,
|
||||
meta: {
|
||||
entityType,
|
||||
label: 'Trash',
|
||||
repositoryAlias: MEDIA_REPOSITORY_ALIAS,
|
||||
api: UmbMediaTrashEntityBulkAction,
|
||||
},
|
||||
conditions: {
|
||||
entityType,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ export class UmbCollectionSelectionActionsElement extends UmbLitElement {
|
||||
this.observe(
|
||||
umbExtensionsRegistry.extensionsOfType('entityBulkAction').pipe(
|
||||
map((extensions) => {
|
||||
return extensions.filter((extension) => extension.meta.entityType === this.entityType);
|
||||
return extensions.filter((extension) => extension.conditions.entityType === this.entityType);
|
||||
})
|
||||
),
|
||||
(bulkActions) => {
|
||||
|
||||
@@ -157,12 +157,14 @@ const manifest = {
|
||||
name: 'My Entity Bulk Action',
|
||||
weight: 10,
|
||||
meta: {
|
||||
entityType: 'my-entity',
|
||||
icon: 'umb:add',
|
||||
label: 'My Entity Bulk Action',
|
||||
repositoryAlias: 'My.Repository',
|
||||
api: MyEntityBulkAction,
|
||||
},
|
||||
conditions: {
|
||||
entityType: 'my-entity',
|
||||
},
|
||||
};
|
||||
|
||||
extensionRegistry.register(manifest);
|
||||
|
||||
Reference in New Issue
Block a user