update entity action to new interface

This commit is contained in:
Mads Rasmussen
2024-03-03 17:09:43 +01:00
parent 229d1a21fc
commit cbaf00cdd9
4 changed files with 10 additions and 14 deletions

View File

@@ -14,9 +14,9 @@ export const manifest: UmbBackofficeManifestKind = {
meta: {
icon: 'icon-edit',
label: 'Rename...',
itemRepositoryAlias: '',
renameRepositoryAlias: '',
entityTypes: [],
renameRepositoryAlias: '',
itemRepositoryAlias: '',
},
},
};

View File

@@ -1,5 +1,5 @@
import { UMB_PARTIAL_VIEW_ENTITY_TYPE } from '../../entity.js';
import { UmbRenameEntityAction } from '@umbraco-cms/backoffice/entity-action';
import { UMB_PARTIAL_VIEW_ITEM_REPOSITORY_ALIAS } from '../../repository/item/manifests.js';
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
export const UMB_RENAME_PARTIAL_VIEW_REPOSITORY_ALIAS = 'Umb.Repository.PartialView.Rename';
@@ -16,12 +16,10 @@ export const manifests: Array<ManifestTypes> = [
type: 'entityAction',
alias: UMB_RENAME_PARTIAL_VIEW_ENTITY_ACTION_ALIAS,
name: 'Rename PartialView Entity Action',
api: UmbRenameEntityAction,
weight: 200,
kind: 'rename',
meta: {
icon: 'icon-edit',
label: 'Rename...',
repositoryAlias: UMB_RENAME_PARTIAL_VIEW_REPOSITORY_ALIAS,
renameRepositoryAlias: UMB_RENAME_PARTIAL_VIEW_REPOSITORY_ALIAS,
itemRepositoryAlias: UMB_PARTIAL_VIEW_ITEM_REPOSITORY_ALIAS,
entityTypes: [UMB_PARTIAL_VIEW_ENTITY_TYPE],
},
},

View File

@@ -4,18 +4,18 @@ import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
export class UmbStylesheetCreateOptionsEntityAction extends UmbEntityActionBase<never> {
async execute() {
if (!this.repository) throw new Error('Repository is not available');
const modalManager = await this.getContext(UMB_MODAL_MANAGER_CONTEXT);
const modalContext = modalManager.open(this, UMB_STYLESHEET_CREATE_OPTIONS_MODAL, {
data: {
parent: {
unique: this.unique,
entityType: this.entityType,
unique: this.args.unique,
entityType: this.args.entityType,
},
},
});
await modalContext.onSubmit();
}
destroy(): void {}
}

View File

@@ -1,5 +1,4 @@
import { UMB_STYLESHEET_FOLDER_ENTITY_TYPE, UMB_STYLESHEET_ROOT_ENTITY_TYPE } from '../../entity.js';
import { UMB_STYLESHEET_DETAIL_REPOSITORY_ALIAS } from '../../repository/manifests.js';
import { UmbStylesheetCreateOptionsEntityAction } from './create.action.js';
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
@@ -13,7 +12,6 @@ export const manifests: Array<ManifestTypes> = [
meta: {
icon: 'icon-add',
label: 'Create...',
repositoryAlias: UMB_STYLESHEET_DETAIL_REPOSITORY_ALIAS,
entityTypes: [UMB_STYLESHEET_ROOT_ENTITY_TYPE, UMB_STYLESHEET_FOLDER_ENTITY_TYPE],
},
},