feat(editor): Expose connectionType for 'createNodeActiveChanged' hook and 'User opened nodes panel' event (no-changelog) (#15300)

This commit is contained in:
Charlie Kolb
2025-05-14 13:26:31 +02:00
committed by GitHub
parent c8b9a7fdeb
commit fefe7b3370
3 changed files with 11 additions and 0 deletions

View File

@@ -1547,6 +1547,7 @@ export type ToggleNodeCreatorOptions = {
source?: NodeCreatorOpenSource; source?: NodeCreatorOpenSource;
nodeCreatorView?: NodeFilterType; nodeCreatorView?: NodeFilterType;
hasAddedNodes?: boolean; hasAddedNodes?: boolean;
connectionType?: NodeConnectionType;
}; };
export type AppliedThemeOption = 'light' | 'dark'; export type AppliedThemeOption = 'light' | 'dark';

View File

@@ -109,6 +109,7 @@ export const useNodeCreatorStore = defineStore(STORES.NODE_CREATOR, () => {
setNodeCreatorState({ setNodeCreatorState({
createNodeActive: true, createNodeActive: true,
nodeCreatorView: creatorView, nodeCreatorView: creatorView,
connectionType,
}); });
} else if (connectionType && nodeData) { } else if (connectionType && nodeData) {
openNodeCreatorForConnectingNode({ openNodeCreatorForConnectingNode({
@@ -130,6 +131,7 @@ export const useNodeCreatorStore = defineStore(STORES.NODE_CREATOR, () => {
source, source,
createNodeActive, createNodeActive,
nodeCreatorView, nodeCreatorView,
connectionType,
}: ToggleNodeCreatorOptions) { }: ToggleNodeCreatorOptions) {
if (!nodeCreatorView) { if (!nodeCreatorView) {
nodeCreatorView = nodeCreatorView =
@@ -148,6 +150,7 @@ export const useNodeCreatorStore = defineStore(STORES.NODE_CREATOR, () => {
void externalHooks.run('nodeView.createNodeActiveChanged', { void externalHooks.run('nodeView.createNodeActiveChanged', {
source, source,
mode: getMode(nodeCreatorView), mode: getMode(nodeCreatorView),
connectionType,
createNodeActive, createNodeActive,
}); });
@@ -155,6 +158,7 @@ export const useNodeCreatorStore = defineStore(STORES.NODE_CREATOR, () => {
onCreatorOpened({ onCreatorOpened({
source, source,
mode: getMode(nodeCreatorView), mode: getMode(nodeCreatorView),
connectionType,
workflow_id: workflowsStore.workflowId, workflow_id: workflowsStore.workflowId,
}); });
} }
@@ -195,6 +199,7 @@ export const useNodeCreatorStore = defineStore(STORES.NODE_CREATOR, () => {
source: eventSource, source: eventSource,
createNodeActive: true, createNodeActive: true,
nodeCreatorView: isScopedConnection ? AI_UNCATEGORIZED_CATEGORY : nodeCreatorView, nodeCreatorView: isScopedConnection ? AI_UNCATEGORIZED_CATEGORY : nodeCreatorView,
connectionType: type,
}); });
// TODO: The animation is a bit glitchy because we're updating view stack immediately // TODO: The animation is a bit glitchy because we're updating view stack immediately
@@ -264,16 +269,19 @@ export const useNodeCreatorStore = defineStore(STORES.NODE_CREATOR, () => {
function onCreatorOpened({ function onCreatorOpened({
source, source,
mode, mode,
connectionType,
workflow_id, workflow_id,
}: { }: {
source?: string; source?: string;
mode: string; mode: string;
connectionType?: NodeConnectionType;
workflow_id?: string; workflow_id?: string;
}) { }) {
resetNodesPanelSession(); resetNodesPanelSession();
trackNodeCreatorEvent('User opened nodes panel', { trackNodeCreatorEvent('User opened nodes panel', {
source, source,
mode, mode,
connectionType,
workflow_id, workflow_id,
}); });
} }

View File

@@ -6,6 +6,7 @@ import type {
INodeProperties, INodeProperties,
INodeTypeDescription, INodeTypeDescription,
ITelemetryTrackProperties, ITelemetryTrackProperties,
NodeConnectionType,
NodeParameterValue, NodeParameterValue,
NodeParameterValueType, NodeParameterValueType,
} from 'n8n-workflow'; } from 'n8n-workflow';
@@ -102,6 +103,7 @@ export interface ExternalHooks {
ExternalHooksMethod<{ ExternalHooksMethod<{
source?: string; source?: string;
mode: string; mode: string;
connectionType?: NodeConnectionType;
createNodeActive: boolean; createNodeActive: boolean;
}> }>
>; >;