From ff74feefe413ff707c483a024f4442315b929e51 Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Sat, 5 Feb 2022 12:57:48 +0100 Subject: [PATCH] :zap: Fix node-versioning issues in editor-UI --- packages/editor-ui/src/components/ActivationModal.vue | 2 +- packages/editor-ui/src/components/DataDisplay.vue | 2 +- packages/editor-ui/src/components/Node.vue | 4 ++-- packages/editor-ui/src/components/NodeCredentials.vue | 2 +- packages/editor-ui/src/components/NodeSettings.vue | 2 +- packages/editor-ui/src/components/RunData.vue | 2 +- packages/editor-ui/src/components/mixins/nodeBase.ts | 2 +- packages/editor-ui/src/components/mixins/nodeHelpers.ts | 4 ++-- packages/editor-ui/src/store.ts | 2 +- packages/editor-ui/src/views/NodeView.vue | 8 ++++---- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/editor-ui/src/components/ActivationModal.vue b/packages/editor-ui/src/components/ActivationModal.vue index d928976a79..57bc33c12a 100644 --- a/packages/editor-ui/src/components/ActivationModal.vue +++ b/packages/editor-ui/src/components/ActivationModal.vue @@ -79,7 +79,7 @@ export default Vue.extend({ const trigger = foundTriggers[0]; - const triggerNodeType = this.$store.getters.nodeType(trigger.type); + const triggerNodeType = this.$store.getters.nodeType(trigger.type, trigger.typeVersion); if (triggerNodeType.activationMessage) { return triggerNodeType.activationMessage; } diff --git a/packages/editor-ui/src/components/DataDisplay.vue b/packages/editor-ui/src/components/DataDisplay.vue index 487bce1375..be86cdf40d 100644 --- a/packages/editor-ui/src/components/DataDisplay.vue +++ b/packages/editor-ui/src/components/DataDisplay.vue @@ -85,7 +85,7 @@ export default mixins(externalHooks, nodeHelpers, workflowHelpers).extend({ }, nodeType (): INodeTypeDescription | null { if (this.node) { - return this.$store.getters.nodeType(this.node.type); + return this.$store.getters.nodeType(this.node.type, this.node.typeVersion); } return null; }, diff --git a/packages/editor-ui/src/components/Node.vue b/packages/editor-ui/src/components/Node.vue index af6ea8b2a9..2c7e9abfe7 100644 --- a/packages/editor-ui/src/components/Node.vue +++ b/packages/editor-ui/src/components/Node.vue @@ -145,7 +145,7 @@ export default mixins(externalHooks, nodeBase, nodeHelpers, workflowHelpers).ext }, isSingleActiveTriggerNode (): boolean { const nodes = this.$store.getters.workflowTriggerNodes.filter((node: INodeUi) => { - const nodeType = this.$store.getters.nodeType(node.type) as INodeTypeDescription | null; + const nodeType = this.$store.getters.nodeType(node.type, node.typeVersion) as INodeTypeDescription | null; return nodeType && nodeType.eventTriggerDescription !== '' && !node.disabled; }); @@ -161,7 +161,7 @@ export default mixins(externalHooks, nodeBase, nodeHelpers, workflowHelpers).ext return this.node && this.node.disabled; }, nodeType (): INodeTypeDescription | null { - return this.data && this.$store.getters.nodeType(this.data.type); + return this.data && this.$store.getters.nodeType(this.data.type, this.data.typeVersion); }, node (): INodeUi | undefined { // same as this.data but reactive.. return this.$store.getters.nodesByName[this.name] as INodeUi | undefined; diff --git a/packages/editor-ui/src/components/NodeCredentials.vue b/packages/editor-ui/src/components/NodeCredentials.vue index a9171957ad..95a8498e84 100644 --- a/packages/editor-ui/src/components/NodeCredentials.vue +++ b/packages/editor-ui/src/components/NodeCredentials.vue @@ -106,7 +106,7 @@ export default mixins( credentialTypesNodeDescription (): INodeCredentialDescription[] { const node = this.node as INodeUi; - const activeNodeType = this.$store.getters.nodeType(node.type) as INodeTypeDescription | null; + const activeNodeType = this.$store.getters.nodeType(node.type, node.typeVersion) as INodeTypeDescription | null; if (activeNodeType && activeNodeType.credentials) { return activeNodeType.credentials; } diff --git a/packages/editor-ui/src/components/NodeSettings.vue b/packages/editor-ui/src/components/NodeSettings.vue index 3196f7511e..ba1314b641 100644 --- a/packages/editor-ui/src/components/NodeSettings.vue +++ b/packages/editor-ui/src/components/NodeSettings.vue @@ -364,7 +364,7 @@ export default mixins( } else if (parameterData.name.startsWith('parameters.')) { // A node parameter changed - const nodeType = this.$store.getters.nodeType(node.type) as INodeTypeDescription | null; + const nodeType = this.$store.getters.nodeType(node.type, node.typeVersion) as INodeTypeDescription | null; if (!nodeType) { return; } diff --git a/packages/editor-ui/src/components/RunData.vue b/packages/editor-ui/src/components/RunData.vue index 0d209c9c2b..2b369aafac 100644 --- a/packages/editor-ui/src/components/RunData.vue +++ b/packages/editor-ui/src/components/RunData.vue @@ -540,7 +540,7 @@ export default mixins( return outputIndex + 1; } - const nodeType = this.$store.getters.nodeType(this.node.type) as INodeTypeDescription | null; + const nodeType = this.$store.getters.nodeType(this.node.type, this.node.typeVersion) as INodeTypeDescription | null; if (!nodeType || !nodeType.outputNames || nodeType.outputNames.length <= outputIndex) { return outputIndex + 1; } diff --git a/packages/editor-ui/src/components/mixins/nodeBase.ts b/packages/editor-ui/src/components/mixins/nodeBase.ts index 98a9b34de8..f6e738885d 100644 --- a/packages/editor-ui/src/components/mixins/nodeBase.ts +++ b/packages/editor-ui/src/components/mixins/nodeBase.ts @@ -279,7 +279,7 @@ export const nodeBase = mixins( }); }, __addNode (node: INodeUi) { - let nodeTypeData = this.$store.getters.nodeType(node.type) as INodeTypeDescription | null; + let nodeTypeData = this.$store.getters.nodeType(node.type, node.typeVersion) as INodeTypeDescription | null; if (!nodeTypeData) { // If node type is not know use by default the base.noOp data to display it nodeTypeData = this.$store.getters.nodeType(NO_OP_NODE_TYPE) as INodeTypeDescription; diff --git a/packages/editor-ui/src/components/mixins/nodeHelpers.ts b/packages/editor-ui/src/components/mixins/nodeHelpers.ts index 9c76285c19..f4c33408cb 100644 --- a/packages/editor-ui/src/components/mixins/nodeHelpers.ts +++ b/packages/editor-ui/src/components/mixins/nodeHelpers.ts @@ -148,7 +148,7 @@ export const nodeHelpers = mixins( // Updates the parameter-issues of the node updateNodeParameterIssues(node: INodeUi, nodeType?: INodeTypeDescription): void { if (nodeType === undefined) { - nodeType = this.$store.getters.nodeType(node.type); + nodeType = this.$store.getters.nodeType(node.type, node.typeVersion); } if (nodeType === null) { @@ -179,7 +179,7 @@ export const nodeHelpers = mixins( } if (nodeType === undefined) { - nodeType = this.$store.getters.nodeType(node.type); + nodeType = this.$store.getters.nodeType(node.type, node.typeVersion); } if (nodeType === null || nodeType!.credentials === undefined) { diff --git a/packages/editor-ui/src/store.ts b/packages/editor-ui/src/store.ts index 804a348e01..734b8f3be0 100644 --- a/packages/editor-ui/src/store.ts +++ b/packages/editor-ui/src/store.ts @@ -746,7 +746,7 @@ export const store = new Vuex.Store({ workflowTriggerNodes: (state, getters) => { return state.workflow.nodes.filter(node => { - return getters.nodeType(node.type).group.includes('trigger'); + return getters.nodeType(node.type, node.typeVersion).group.includes('trigger'); }); }, diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index 1f1e763c57..fd8de5d811 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -529,7 +529,7 @@ export default mixins( } data.workflow.nodes.forEach((node) => { - if (!this.$store.getters.nodeType(node.type)) { + if (!this.$store.getters.nodeType(node.type, node.typeVersion)) { throw new Error(`The ${this.$locale.shortNodeType(node.type)} node is not supported`); } }); @@ -1325,7 +1325,7 @@ export default mixins( let yOffset = 0; if (lastSelectedConnection) { - const sourceNodeType = this.$store.getters.nodeType(lastSelectedNode.type) as INodeTypeDescription | null; + const sourceNodeType = this.$store.getters.nodeType(lastSelectedNode.type, lastSelectedNode.typeVersion) as INodeTypeDescription | null; const offsets = [[-100, 100], [-140, 0, 140], [-240, -100, 100, 240]]; if (sourceNodeType && sourceNodeType.outputs.length > 1) { const offset = offsets[sourceNodeType.outputs.length - 2]; @@ -1714,7 +1714,7 @@ export default mixins( const nodeName = (element as HTMLElement).dataset['name'] as string; const node = this.$store.getters.getNodeByName(nodeName) as INodeUi | null; if (node) { - const nodeType = this.$store.getters.nodeType(node.type) as INodeTypeDescription | null; + const nodeType = this.$store.getters.nodeType(node.type, node.typeVersion) as INodeTypeDescription | null; if (nodeType && nodeType.inputs && nodeType.inputs.length === 1) { this.pullConnActiveNodeName = node.name; const endpoint = this.instance.getEndpoint(this.getInputEndpointUUID(nodeName, 0)); @@ -1945,7 +1945,7 @@ export default mixins( const node = this.$store.getters.getNodeByName(nodeName); - const nodeTypeData: INodeTypeDescription | null= this.$store.getters.nodeType(node.type); + const nodeTypeData: INodeTypeDescription | null= this.$store.getters.nodeType(node.type, node.typeVersion); if (nodeTypeData && nodeTypeData.maxNodes !== undefined && this.getNodeTypeCount(node.type) >= nodeTypeData.maxNodes) { this.showMaxNodeTypeError(nodeTypeData); return;