mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
feat(editor): Add registerCustomAction to new canvas (no-changelog) (#10359)
This commit is contained in:
@@ -18,6 +18,7 @@ import CanvasRunWorkflowButton from '@/components/canvas/elements/buttons/Canvas
|
||||
import { useI18n } from '@/composables/useI18n';
|
||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||
import { useRunWorkflow } from '@/composables/useRunWorkflow';
|
||||
import { useGlobalLinkActions } from '@/composables/useGlobalLinkActions';
|
||||
import type {
|
||||
AddedNodesAndConnections,
|
||||
IExecutionResponse,
|
||||
@@ -135,6 +136,7 @@ const templatesStore = useTemplatesStore();
|
||||
|
||||
const canvasEventBus = createEventBus();
|
||||
|
||||
const { registerCustomAction } = useGlobalLinkActions();
|
||||
const { runWorkflow, stopCurrentExecution, stopWaitingForWebhook } = useRunWorkflow({ router });
|
||||
const {
|
||||
updateNodePosition,
|
||||
@@ -844,6 +846,10 @@ async function onOpenSelectiveNodeCreator(node: string, connectionType: NodeConn
|
||||
nodeCreatorStore.openSelectiveNodeCreator({ node, connectionType });
|
||||
}
|
||||
|
||||
async function onOpenNodeCreatorForTriggerNodes(source: NodeCreatorOpenSource) {
|
||||
nodeCreatorStore.openNodeCreatorForTriggerNodes(source);
|
||||
}
|
||||
|
||||
function onOpenNodeCreatorFromCanvas(source: NodeCreatorOpenSource) {
|
||||
onOpenNodeCreator({ createNodeActive: true, source });
|
||||
}
|
||||
@@ -1347,29 +1353,36 @@ function onClickPane(position: CanvasNode['position']) {
|
||||
*/
|
||||
|
||||
function registerCustomActions() {
|
||||
// @TODO Implement these
|
||||
// this.registerCustomAction({
|
||||
// key: 'openNodeDetail',
|
||||
// action: ({ node }: { node: string }) => {
|
||||
// this.nodeSelectedByName(node, true);
|
||||
// },
|
||||
// });
|
||||
//
|
||||
// this.registerCustomAction({
|
||||
// key: 'openSelectiveNodeCreator',
|
||||
// action: this.openSelectiveNodeCreator,
|
||||
// });
|
||||
//
|
||||
// this.registerCustomAction({
|
||||
// key: 'showNodeCreator',
|
||||
// action: () => {
|
||||
// this.ndvStore.activeNodeName = null;
|
||||
//
|
||||
// void this.$nextTick(() => {
|
||||
// this.showTriggerCreator(NODE_CREATOR_OPEN_SOURCES.TAB);
|
||||
// });
|
||||
// },
|
||||
// });
|
||||
registerCustomAction({
|
||||
key: 'openNodeDetail',
|
||||
action: ({ node }: { node: string }) => {
|
||||
setNodeActiveByName(node);
|
||||
},
|
||||
});
|
||||
|
||||
registerCustomAction({
|
||||
key: 'openSelectiveNodeCreator',
|
||||
action: ({
|
||||
connectiontype: connectionType,
|
||||
node,
|
||||
}: {
|
||||
connectiontype: NodeConnectionType;
|
||||
node: string;
|
||||
}) => {
|
||||
void onOpenSelectiveNodeCreator(node, connectionType);
|
||||
},
|
||||
});
|
||||
|
||||
registerCustomAction({
|
||||
key: 'showNodeCreator',
|
||||
action: () => {
|
||||
ndvStore.activeNodeName = null;
|
||||
|
||||
void nextTick(() => {
|
||||
void onOpenNodeCreatorForTriggerNodes(NODE_CREATOR_OPEN_SOURCES.TAB);
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user