D_Inventor
04/24/2024, 3:49 PMEntity Action
working that opens a panel, much like the old menu items with the LaunchDialogView
options. In particular for content items in the content tree. I'm struggling to get this to work, does anybody happen to have something already that I can Extension of alias "contentgenerator.entity.action" did not succeed creating an Element with Api, Api was created but the Element was missing a JavaScript file via the 'element' or the 'js' property. Alternatively define a Element Name in 'elementName' in the manifest.
I'll give some more context in a threadD_Inventor
04/24/2024, 3:51 PMts
import { UMB_DOCUMENT_ENTITY_TYPE } from "@umbraco-cms/backoffice/document";
import { ManifestEntityAction, ManifestModal } from "@umbraco-cms/backoffice/extension-registry";
import { ContentGeneratorEntityAction } from "./content.api";
import { CONTENTGENERATOR_MODAL_ALIAS } from "./content.modal";
import { ContentGeneratorContent } from "./content.lit";
const entityAction: ManifestEntityAction = {
type: 'entityAction',
alias: 'contentgenerator.entity.action',
name: 'Content generator context menu',
weight: 2000,
api: ContentGeneratorEntityAction,
forEntityTypes: [UMB_DOCUMENT_ENTITY_TYPE],
meta: {
icon: 'fire',
label: 'Generate random content'
}
}
const modal: ManifestModal = {
type: 'modal',
alias: CONTENTGENERATOR_MODAL_ALIAS,
name: 'Content generator modal',
element: ContentGeneratorContent
}
export const manifests = [entityAction, modal];
And then in my index.ts, I have this registration code:
ts
import { UmbEntryPointOnInit } from '@umbraco-cms/backoffice/extension-api'
import { manifests as contentmenumanifests } from './contentmenu/manifest'
export const onInit: UmbEntryPointOnInit = (_host, extensionRegistry) => {
extensionRegistry.registerMany([
...contentmenumanifests
])
}
It seems to recognize this, because it seems to attempt to create the entity action, but is failing somewhereD_Inventor
04/24/2024, 3:54 PMUMB_MODAL_SERVICE_CONTEXT
, the constructor doesn't have the same arguments and the @umbraco-cms/modal
import isn't recognized
https://cdn.discordapp.com/attachments/1232719996543827968/1232721403938082816/image.png?ex=662a7cc5&is=66292b45&hm=66fb8525fe189dec4ca012f2bac94c4d4ef81f86ae60f3324b4c765811857dcb&Kevin Jump
04/24/2024, 4:08 PMts
{
type: 'entityAction',
kind: 'default',
alias: 'usync.publish.push.action',
name: 'Push action',
api: () => import('./push.action.ts'),
forEntityTypes: [UMB_DOCUMENT_ENTITY_TYPE],
weight: 20,
meta: {
icon: 'icon-arrow-right',
label: '#usyncpublish_pushItems',
},
},
Entity action :
ts
export class uSyncPushEntityAction extends UmbEntityActionBase<never> {
#modalContext: UmbModalManagerContext | undefined;
constructor(host: UmbControllerHost, args: UmbEntityActionArgs<never>) {
super(host, args);
this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (_modalContext) => {
this.#modalContext = _modalContext;
});
}
async execute(): Promise<void> {
const actionModalContext = this.#modalContext?.open(
this,
USYNC_PUBLISHER_ACTION_MODAL,
{
data: {
action: 'push',
unqiue: this.args.unique,
entityType: this.args.entityType,
mode: PublishMode.PUSH,
},
},
);
await actionModalContext?.onSubmit().catch((_rejected) => {
return; // user pressed cancel.
});
return;
}
}
Kevin Jump
04/24/2024, 4:09 PMContentGeneratorEntityAction
? does it have the execute method, and inherit from umUmbEntityActionBase
?Kevin Jump
04/24/2024, 4:10 PMKevin Jump
04/24/2024, 4:11 PMWarren Buckley
04/24/2024, 4:35 PMWarren Buckley
04/24/2024, 4:37 PMD_Inventor
04/24/2024, 4:43 PMD_Inventor
04/25/2024, 5:13 AMD_Inventor
04/25/2024, 5:13 AMD_Inventor
04/25/2024, 5:20 AMts
const entityAction: ManifestEntityAction = {
type: 'entityAction',
kind: 'default',
alias: 'contentgenerator.entity.action',
name: 'Content generator context menu',
api: () => import('./content.api'),
forEntityTypes: [UMB_DOCUMENT_ENTITY_TYPE],
weight: 2000,
meta: {
icon: 'fire',
label: 'Generate random content'
}
}
const modal: ManifestModal = {
type: 'modal',
alias: CONTENTGENERATOR_MODAL_ALIAS,
name: 'Content generator modal',
element: () => import('./content.lit')
}
This seems to workD_Inventor
04/25/2024, 5:23 AMWarren Buckley
04/25/2024, 6:34 AMWarren Buckley
04/25/2024, 6:35 AMD_Inventor
04/25/2024, 10:10 AMWarren Buckley
04/25/2024, 10:16 AMKevin Jump
04/25/2024, 11:25 AMWarren Buckley
04/25/2024, 11:39 AM