feat(editor): Supress validation errors for freshly added nodes (#5149)

* feat(editor): Supress validation errors when node is added from node creator

* Supress initial errors also for resource locator inputs

* Use nodeMetadata prop to store node's `pristine` state

* Revert `setNodeParameters` check for `nodeMetadata`

* Rename getIsNodePristine to isNodePristine
This commit is contained in:
OlegIvaniv
2023-01-16 14:55:58 +01:00
committed by GitHub
parent 96d773f82d
commit 582865c7e9
11 changed files with 179 additions and 27 deletions

View File

@@ -227,6 +227,10 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
this.nodeMetadata[nodeName] && this.nodeMetadata[nodeName].parametersLastUpdatedAt;
},
isNodePristine(): (name: string) => boolean {
return (nodeName: string) =>
this.nodeMetadata[nodeName] === undefined || this.nodeMetadata[nodeName].pristine === true;
},
// Executions getters
getExecutionDataById(): (id: string) => IExecutionsSummary | undefined {
return (id: string): IExecutionsSummary | undefined =>
@@ -731,7 +735,12 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
// TODO: Check if there is an error or whatever that is supposed to be returned
return;
}
this.workflow.nodes.push(nodeData);
// Init node metadata
if (!this.nodeMetadata[nodeData.name]) {
Vue.set(this.nodeMetadata, nodeData.name, {});
}
},
removeNode(node: INodeUi): void {
@@ -821,6 +830,7 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
if (!this.nodeMetadata[node.name]) {
Vue.set(this.nodeMetadata, node.name, {});
}
Vue.set(this.nodeMetadata[node.name], 'parametersLastUpdatedAt', Date.now());
},
@@ -960,5 +970,8 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
}
});
},
setNodePristine(nodeName: string, isPristine: boolean): void {
Vue.set(this.nodeMetadata[nodeName], 'pristine', isPristine);
},
},
});