Display node-error only on executing nodes (#2274)

*  Dot not display errors on disconnected nodes

*  Fix some more inconsistencies
This commit is contained in:
Jan
2021-10-06 12:02:31 -05:00
committed by GitHub
parent 9dbf6e5f6d
commit f7148bdd77
5 changed files with 70 additions and 10 deletions

View File

@@ -1,6 +1,9 @@
import {
ERROR_TRIGGER_NODE_NAME,
PLACEHOLDER_FILLED_AT_EXECUTION_TIME,
PLACEHOLDER_EMPTY_WORKFLOW_ID,
START_NODE_TYPE,
WEBHOOK_NODE_NAME,
} from '@/constants';
import {
@@ -144,13 +147,39 @@ export const workflowHelpers = mixins(
},
// Checks if everything in the workflow is complete and ready to be executed
checkReadyForExecution (workflow: Workflow) {
checkReadyForExecution (workflow: Workflow, lastNodeName?: string) {
let node: INode;
let nodeType: INodeType | undefined;
let nodeIssues: INodeIssues | null = null;
const workflowIssues: IWorfklowIssues = {};
for (const nodeName of Object.keys(workflow.nodes)) {
let checkNodes = Object.keys(workflow.nodes);
if (lastNodeName) {
checkNodes = workflow.getParentNodes(lastNodeName);
checkNodes.push(lastNodeName);
} else {
// As webhook nodes always take presidence check first
// if there are any
let checkWebhook: string[] = [];
for (const nodeName of Object.keys(workflow.nodes)) {
if (workflow.nodes[nodeName].disabled !== true && workflow.nodes[nodeName].type === WEBHOOK_NODE_NAME) {
checkWebhook = [nodeName, ...checkWebhook, ...workflow.getChildNodes(nodeName)];
}
}
if (checkWebhook.length) {
checkNodes = checkWebhook;
} else {
// If no webhook nodes got found try to find another trigger node
const startNode = workflow.getStartNode();
if (startNode !== undefined) {
checkNodes = workflow.getChildNodes(startNode.name);
checkNodes.push(startNode.name);
}
}
}
for (const nodeName of checkNodes) {
nodeIssues = null;
node = workflow.nodes[nodeName];
@@ -214,6 +243,10 @@ export const workflowHelpers = mixins(
return {
description: nodeTypeDescription,
// As we do not have the trigger/poll functions available in the frontend
// we use the information available to figure out what are trigger nodes
// @ts-ignore
trigger: ![ERROR_TRIGGER_NODE_NAME, START_NODE_TYPE].includes(nodeType) && nodeTypeDescription.inputs.length === 0 && !nodeTypeDescription.webhooks || undefined,
};
},
};
@@ -498,7 +531,7 @@ export const workflowHelpers = mixins(
} as IUpdateInformation;
this.$store.commit('setNodeValue', changes);
});
const createdTags = (workflowData.tags || []) as ITag[];
const tagIds = createdTags.map((tag: ITag): string => tag.id);
this.$store.commit('setWorkflowTagIds', tagIds);