Fix node-versioning issues in editor-UI

This commit is contained in:
Jan Oberhauser 2022-02-05 12:57:48 +01:00
parent c7e73d757a
commit ff74feefe4
10 changed files with 15 additions and 15 deletions

View file

@ -79,7 +79,7 @@ export default Vue.extend({
const trigger = foundTriggers[0]; 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) { if (triggerNodeType.activationMessage) {
return triggerNodeType.activationMessage; return triggerNodeType.activationMessage;
} }

View file

@ -85,7 +85,7 @@ export default mixins(externalHooks, nodeHelpers, workflowHelpers).extend({
}, },
nodeType (): INodeTypeDescription | null { nodeType (): INodeTypeDescription | null {
if (this.node) { if (this.node) {
return this.$store.getters.nodeType(this.node.type); return this.$store.getters.nodeType(this.node.type, this.node.typeVersion);
} }
return null; return null;
}, },

View file

@ -145,7 +145,7 @@ export default mixins(externalHooks, nodeBase, nodeHelpers, workflowHelpers).ext
}, },
isSingleActiveTriggerNode (): boolean { isSingleActiveTriggerNode (): boolean {
const nodes = this.$store.getters.workflowTriggerNodes.filter((node: INodeUi) => { 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; return nodeType && nodeType.eventTriggerDescription !== '' && !node.disabled;
}); });
@ -161,7 +161,7 @@ export default mixins(externalHooks, nodeBase, nodeHelpers, workflowHelpers).ext
return this.node && this.node.disabled; return this.node && this.node.disabled;
}, },
nodeType (): INodeTypeDescription | null { 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.. node (): INodeUi | undefined { // same as this.data but reactive..
return this.$store.getters.nodesByName[this.name] as INodeUi | undefined; return this.$store.getters.nodesByName[this.name] as INodeUi | undefined;

View file

@ -106,7 +106,7 @@ export default mixins(
credentialTypesNodeDescription (): INodeCredentialDescription[] { credentialTypesNodeDescription (): INodeCredentialDescription[] {
const node = this.node as INodeUi; 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) { if (activeNodeType && activeNodeType.credentials) {
return activeNodeType.credentials; return activeNodeType.credentials;
} }

View file

@ -364,7 +364,7 @@ export default mixins(
} else if (parameterData.name.startsWith('parameters.')) { } else if (parameterData.name.startsWith('parameters.')) {
// A node parameter changed // 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) { if (!nodeType) {
return; return;
} }

View file

@ -540,7 +540,7 @@ export default mixins(
return outputIndex + 1; 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) { if (!nodeType || !nodeType.outputNames || nodeType.outputNames.length <= outputIndex) {
return outputIndex + 1; return outputIndex + 1;
} }

View file

@ -279,7 +279,7 @@ export const nodeBase = mixins(
}); });
}, },
__addNode (node: INodeUi) { __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 (!nodeTypeData) {
// If node type is not know use by default the base.noOp data to display it // 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; nodeTypeData = this.$store.getters.nodeType(NO_OP_NODE_TYPE) as INodeTypeDescription;

View file

@ -148,7 +148,7 @@ export const nodeHelpers = mixins(
// Updates the parameter-issues of the node // Updates the parameter-issues of the node
updateNodeParameterIssues(node: INodeUi, nodeType?: INodeTypeDescription): void { updateNodeParameterIssues(node: INodeUi, nodeType?: INodeTypeDescription): void {
if (nodeType === undefined) { if (nodeType === undefined) {
nodeType = this.$store.getters.nodeType(node.type); nodeType = this.$store.getters.nodeType(node.type, node.typeVersion);
} }
if (nodeType === null) { if (nodeType === null) {
@ -179,7 +179,7 @@ export const nodeHelpers = mixins(
} }
if (nodeType === undefined) { 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) { if (nodeType === null || nodeType!.credentials === undefined) {

View file

@ -746,7 +746,7 @@ export const store = new Vuex.Store({
workflowTriggerNodes: (state, getters) => { workflowTriggerNodes: (state, getters) => {
return state.workflow.nodes.filter(node => { return state.workflow.nodes.filter(node => {
return getters.nodeType(node.type).group.includes('trigger'); return getters.nodeType(node.type, node.typeVersion).group.includes('trigger');
}); });
}, },

View file

@ -529,7 +529,7 @@ export default mixins(
} }
data.workflow.nodes.forEach((node) => { 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`); throw new Error(`The ${this.$locale.shortNodeType(node.type)} node is not supported`);
} }
}); });
@ -1325,7 +1325,7 @@ export default mixins(
let yOffset = 0; let yOffset = 0;
if (lastSelectedConnection) { 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]]; const offsets = [[-100, 100], [-140, 0, 140], [-240, -100, 100, 240]];
if (sourceNodeType && sourceNodeType.outputs.length > 1) { if (sourceNodeType && sourceNodeType.outputs.length > 1) {
const offset = offsets[sourceNodeType.outputs.length - 2]; const offset = offsets[sourceNodeType.outputs.length - 2];
@ -1714,7 +1714,7 @@ export default mixins(
const nodeName = (element as HTMLElement).dataset['name'] as string; const nodeName = (element as HTMLElement).dataset['name'] as string;
const node = this.$store.getters.getNodeByName(nodeName) as INodeUi | null; const node = this.$store.getters.getNodeByName(nodeName) as INodeUi | null;
if (node) { 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) { if (nodeType && nodeType.inputs && nodeType.inputs.length === 1) {
this.pullConnActiveNodeName = node.name; this.pullConnActiveNodeName = node.name;
const endpoint = this.instance.getEndpoint(this.getInputEndpointUUID(nodeName, 0)); const endpoint = this.instance.getEndpoint(this.getInputEndpointUUID(nodeName, 0));
@ -1945,7 +1945,7 @@ export default mixins(
const node = this.$store.getters.getNodeByName(nodeName); 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) { if (nodeTypeData && nodeTypeData.maxNodes !== undefined && this.getNodeTypeCount(node.type) >= nodeTypeData.maxNodes) {
this.showMaxNodeTypeError(nodeTypeData); this.showMaxNodeTypeError(nodeTypeData);
return; return;