diff --git a/packages/editor-ui/src/App.vue b/packages/editor-ui/src/App.vue index d07062db187f8..bc1b6527112c5 100644 --- a/packages/editor-ui/src/App.vue +++ b/packages/editor-ui/src/App.vue @@ -43,7 +43,7 @@ import Telemetry from '@/components/Telemetry.vue'; import { HIRING_BANNER, VIEWS } from '@/constants'; import { loadLanguage } from '@/plugins/i18n'; -import useGlobalLinkActions from '@/composables/useGlobalLinkActions'; +import { useGlobalLinkActions } from '@/composables/useGlobalLinkActions'; import { useExternalHooks } from '@/composables/useExternalHooks'; import { useToast } from '@/composables/useToast'; import { useCloudPlanStore } from '@/stores/cloudPlan.store'; diff --git a/packages/editor-ui/src/composables/useGlobalLinkActions.ts b/packages/editor-ui/src/composables/useGlobalLinkActions.ts index 801fe1f71b6a7..8e493f0cb7ee1 100644 --- a/packages/editor-ui/src/composables/useGlobalLinkActions.ts +++ b/packages/editor-ui/src/composables/useGlobalLinkActions.ts @@ -10,7 +10,7 @@ const state = reactive({ delegatedClickHandler: null as null | ((e: MouseEvent) => void), }); -export default () => { +export function useGlobalLinkActions() { function registerCustomAction({ key, action }: { key: string; action: Function }) { state.customActions[key] = action; } @@ -76,4 +76,4 @@ export default () => { registerCustomAction, unregisterCustomAction, }; -}; +} diff --git a/packages/editor-ui/src/views/NodeView.v2.vue b/packages/editor-ui/src/views/NodeView.v2.vue index eb2928b3e898f..d9557cbc0346d 100644 --- a/packages/editor-ui/src/views/NodeView.v2.vue +++ b/packages/editor-ui/src/views/NodeView.v2.vue @@ -17,6 +17,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, @@ -134,6 +135,7 @@ const templatesStore = useTemplatesStore(); const canvasEventBus = createEventBus(); +const { registerCustomAction } = useGlobalLinkActions(); const { runWorkflow, stopCurrentExecution, stopWaitingForWebhook } = useRunWorkflow({ router }); const { updateNodePosition, @@ -841,6 +843,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 }); } @@ -1344,29 +1350,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); + }); + }, + }); } /** diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index 5650be3b7acae..d68ad27fa9482 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -244,7 +244,7 @@ import { VALID_WORKFLOW_IMPORT_URL_REGEX, } from '@/constants'; -import useGlobalLinkActions from '@/composables/useGlobalLinkActions'; +import { useGlobalLinkActions } from '@/composables/useGlobalLinkActions'; import { useNodeHelpers } from '@/composables/useNodeHelpers'; import useCanvasMouseSelect from '@/composables/useCanvasMouseSelect'; import { useExecutionDebugging } from '@/composables/useExecutionDebugging';