refactor(editor): Refine INodeUpdatePropertiesInformation type and remove unnecessary type assertions (#17783)

This commit is contained in:
Suguru Inoue
2025-07-29 12:39:03 +02:00
committed by GitHub
parent 056302ebe5
commit 04c1121075
7 changed files with 10 additions and 30 deletions

View File

@@ -160,10 +160,7 @@ export interface IUpdateInformation<T extends NodeParameterValueType = NodeParam
export interface INodeUpdatePropertiesInformation { export interface INodeUpdatePropertiesInformation {
name: string; // Node-Name name: string; // Node-Name
properties: { properties: Partial<INodeUi>;
position: XYPosition;
[key: string]: IDataObject | XYPosition;
};
} }
export type XYPosition = [number, number]; export type XYPosition = [number, number];

View File

@@ -295,7 +295,6 @@ function clearSelectedCredential(credentialType: string) {
name: props.node.name, name: props.node.name,
properties: { properties: {
credentials, credentials,
position: props.node.position,
}, },
}; };
@@ -412,7 +411,6 @@ function onCredentialSelected(
name: props.node.name, name: props.node.name,
properties: { properties: {
credentials, credentials,
position: props.node.position,
}, },
}; };

View File

@@ -24,13 +24,7 @@ import {
} from 'n8n-workflow'; } from 'n8n-workflow';
import { computed, defineAsyncComponent, onBeforeUnmount, onMounted, ref, toRef, watch } from 'vue'; import { computed, defineAsyncComponent, onBeforeUnmount, onMounted, ref, toRef, watch } from 'vue';
import type { import type { INodeUi, IRunDataDisplayMode, ITab, NodePanelType } from '@/Interface';
INodeUi,
INodeUpdatePropertiesInformation,
IRunDataDisplayMode,
ITab,
NodePanelType,
} from '@/Interface';
import { import {
CORE_NODES_CATEGORY, CORE_NODES_CATEGORY,
@@ -1311,8 +1305,8 @@ function enableNode() {
name: node.value.name, name: node.value.name,
properties: { properties: {
disabled: !node.value.disabled, disabled: !node.value.disabled,
} as IDataObject, },
} as INodeUpdatePropertiesInformation; };
workflowsStore.updateNodeProperties(updateInformation); workflowsStore.updateNodeProperties(updateInformation);
} }

View File

@@ -5,7 +5,6 @@ import set from 'lodash/set';
import unset from 'lodash/unset'; import unset from 'lodash/unset';
import type { import type {
IDataObject,
NodeParameterValue, NodeParameterValue,
MessageEventBusDestinationOptions, MessageEventBusDestinationOptions,
INodeParameters, INodeParameters,
@@ -252,7 +251,7 @@ function valueChanged(parameterData: IUpdateInformation) {
nodeParameters.value = deepCopy(nodeParametersCopy); nodeParameters.value = deepCopy(nodeParametersCopy);
workflowsStore.updateNodeProperties({ workflowsStore.updateNodeProperties({
name: node.value.name, name: node.value.name,
properties: { parameters: nodeParameters.value as unknown as IDataObject, position: [0, 0] }, properties: { parameters: nodeParameters.value, position: [0, 0] },
}); });
if (hasOnceBeenSaved.value) { if (hasOnceBeenSaved.value) {
logStreamingStore.updateDestination(nodeParameters.value); logStreamingStore.updateDestination(nodeParameters.value);

View File

@@ -66,7 +66,6 @@ export const useSetupWorkflowCredentialsModalState = () => {
workflowsStore.updateNodeProperties({ workflowsStore.updateNodeProperties({
name: node.name, name: node.name,
properties: { properties: {
position: node.position,
credentials: { credentials: {
...node.credentials, ...node.credentials,
[usages.credentialType]: credential, [usages.credentialType]: credential,
@@ -101,7 +100,6 @@ export const useSetupWorkflowCredentialsModalState = () => {
workflowsStore.updateNodeProperties({ workflowsStore.updateNodeProperties({
name: node.name, name: node.name,
properties: { properties: {
position: node.position,
credentials, credentials,
}, },
}); });

View File

@@ -20,7 +20,6 @@ import type {
ITaskDataConnections, ITaskDataConnections,
IRunData, IRunData,
IBinaryKeyData, IBinaryKeyData,
IDataObject,
INode, INode,
INodePropertyOptions, INodePropertyOptions,
INodeCredentialsDetails, INodeCredentialsDetails,
@@ -722,8 +721,8 @@ export function useNodeHelpers() {
name: node.name, name: node.name,
properties: { properties: {
disabled: newDisabledState, disabled: newDisabledState,
} as IDataObject, },
} as INodeUpdatePropertiesInformation; };
telemetry.track('User set node enabled status', { telemetry.track('User set node enabled status', {
node_type: node.type, node_type: node.type,

View File

@@ -1,9 +1,4 @@
import type { import type { AppliedThemeOption, INodeUi, NodeAuthenticationOption } from '@/Interface';
AppliedThemeOption,
INodeUi,
INodeUpdatePropertiesInformation,
NodeAuthenticationOption,
} from '@/Interface';
import type { ITemplatesNode } from '@n8n/rest-api-client/api/templates'; import type { ITemplatesNode } from '@n8n/rest-api-client/api/templates';
import { import {
CORE_NODES_CATEGORY, CORE_NODES_CATEGORY,
@@ -386,8 +381,8 @@ export const updateNodeAuthType = (node: INodeUi | null, type: string) => {
...node.parameters, ...node.parameters,
[nodeAuthField.name]: type, [nodeAuthField.name]: type,
}, },
} as IDataObject, },
} as INodeUpdatePropertiesInformation; };
useWorkflowsStore().updateNodeProperties(updateInformation); useWorkflowsStore().updateNodeProperties(updateInformation);
} }
} }