-
Notifications
You must be signed in to change notification settings - Fork 42.5k
feat(editor): Separate node execution and validation error states #19029
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Tuukkaa
wants to merge
8
commits into
master
Choose a base branch
from
ds-208-separate-state-for-node-execution-and-validation-errors
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+115
−46
Draft
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
02e07d5
Add new icon for node validation errors
Tuukkaa 8fa74fc
Separate node execution and validation errors
Tuukkaa 0017b40
Improve validation error icon
Tuukkaa b69c62b
Remove spinner from waiting state
Tuukkaa 47b45b8
Clean up unused code
Tuukkaa ae4afb8
Clean up unused variable
Tuukkaa dc06d69
test: Update canvas mapping tests for separate error states
Tuukkaa 12f3d50
Update one more test
Tuukkaa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...tend/@n8n/design-system/src/components/N8nIcon/custom/node-validation-error.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,8 @@ const $style = useCssModule(); | |
const { | ||
hasPinnedData, | ||
issues, | ||
hasIssues, | ||
hasExecutionErrors, | ||
hasValidationErrors, | ||
executionStatus, | ||
executionWaiting, | ||
executionWaitingForNext, | ||
|
@@ -66,12 +67,6 @@ const commonClasses = computed(() => [ | |
<N8nIcon icon="clock" :size="size" /> | ||
</N8nTooltip> | ||
</div> | ||
<div | ||
v-if="spinnerLayout === 'absolute'" | ||
:class="[...commonClasses, $style['node-waiting-spinner']]" | ||
> | ||
<N8nIcon icon="refresh-cw" spin /> | ||
</div> | ||
</div> | ||
<div | ||
v-else-if="isNodeExecuting" | ||
|
@@ -84,7 +79,7 @@ const commonClasses = computed(() => [ | |
<N8nIcon icon="power" :size="size" /> | ||
</div> | ||
<div | ||
v-else-if="hasIssues && !hideNodeIssues" | ||
v-else-if="hasExecutionErrors && !hideNodeIssues" | ||
:class="[...commonClasses, $style.issues]" | ||
data-test-id="node-issues" | ||
> | ||
|
@@ -95,6 +90,18 @@ const commonClasses = computed(() => [ | |
<N8nIcon icon="node-error" :size="size" /> | ||
</N8nTooltip> | ||
</div> | ||
<div | ||
v-else-if="hasValidationErrors && !hideNodeIssues" | ||
:class="[...commonClasses, $style.issues]" | ||
data-test-id="node-issues" | ||
> | ||
<N8nTooltip :show-after="500" placement="bottom"> | ||
<template #content> | ||
<TitledList :title="`${i18n.baseText('node.issues')}:`" :items="issues" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should items be |
||
</template> | ||
<N8nIcon icon="node-validation-error" :size="size" /> | ||
</N8nTooltip> | ||
</div> | ||
<div v-else-if="executionStatus === 'unknown'"> | ||
<!-- Do nothing, unknown means the node never executed --> | ||
</div> | ||
|
@@ -152,7 +159,6 @@ const commonClasses = computed(() => [ | |
color: var(--color-secondary); | ||
} | ||
|
||
.node-waiting-spinner, | ||
.running { | ||
color: hsl(var(--color-primary-h), var(--color-primary-s), var(--color-primary-l)); | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -395,41 +395,69 @@ export function useCanvasMapping({ | |||||||||
{ throttle: CANVAS_EXECUTION_DATA_THROTTLE_DURATION, immediate: true }, | ||||||||||
); | ||||||||||
|
||||||||||
const nodeIssuesById = computed(() => | ||||||||||
const nodeExecutionErrorsById = computed(() => | ||||||||||
nodes.value.reduce<Record<string, string[]>>((acc, node) => { | ||||||||||
const issues: string[] = []; | ||||||||||
const executionErrors: string[] = []; | ||||||||||
const nodeExecutionRunData = workflowsStore.getWorkflowRunData?.[node.name]; | ||||||||||
if (nodeExecutionRunData) { | ||||||||||
nodeExecutionRunData.forEach((executionRunData) => { | ||||||||||
if (executionRunData?.error) { | ||||||||||
const { message, description } = executionRunData.error; | ||||||||||
const issue = `${message}${description ? ` (${description})` : ''}`; | ||||||||||
issues.push(sanitizeHtml(issue)); | ||||||||||
executionErrors.push(sanitizeHtml(issue)); | ||||||||||
} | ||||||||||
}); | ||||||||||
} | ||||||||||
|
||||||||||
acc[node.id] = executionErrors; | ||||||||||
|
||||||||||
return acc; | ||||||||||
}, {}), | ||||||||||
); | ||||||||||
|
||||||||||
const nodeValidationErrorsById = computed(() => | ||||||||||
nodes.value.reduce<Record<string, string[]>>((acc, node) => { | ||||||||||
const validationErrors: string[] = []; | ||||||||||
|
||||||||||
if (node?.issues !== undefined) { | ||||||||||
issues.push(...nodeHelpers.nodeIssuesToString(node.issues, node)); | ||||||||||
validationErrors.push(...nodeHelpers.nodeIssuesToString(node.issues, node)); | ||||||||||
} | ||||||||||
|
||||||||||
acc[node.id] = issues; | ||||||||||
acc[node.id] = validationErrors; | ||||||||||
|
||||||||||
return acc; | ||||||||||
}, {}), | ||||||||||
); | ||||||||||
|
||||||||||
const nodeIssuesById = computed(() => | ||||||||||
nodes.value.reduce<Record<string, { execution: string[]; validation: string[] }>>( | ||||||||||
(acc, node) => { | ||||||||||
acc[node.id] = { | ||||||||||
execution: nodeExecutionErrorsById.value[node.id] ?? [], | ||||||||||
validation: nodeValidationErrorsById.value[node.id] ?? [], | ||||||||||
}; | ||||||||||
|
||||||||||
return acc; | ||||||||||
}, | ||||||||||
{}, | ||||||||||
), | ||||||||||
); | ||||||||||
|
||||||||||
const nodeHasIssuesById = computed(() => | ||||||||||
nodes.value.reduce<Record<string, boolean>>((acc, node) => { | ||||||||||
const hasExecutionErrors = nodeExecutionErrorsById.value[node.id]?.length > 0; | ||||||||||
const hasValidationErrors = nodeValidationErrorsById.value[node.id]?.length > 0; | ||||||||||
|
||||||||||
if (['crashed', 'error'].includes(nodeExecutionStatusById.value[node.id])) { | ||||||||||
acc[node.id] = true; | ||||||||||
} else if (nodePinnedDataById.value[node.id]) { | ||||||||||
acc[node.id] = false; | ||||||||||
} else if (node.issues && nodeHelpers.nodeIssuesToString(node.issues, node).length) { | ||||||||||
} else if (hasValidationErrors) { | ||||||||||
acc[node.id] = true; | ||||||||||
} else if (hasExecutionErrors) { | ||||||||||
acc[node.id] = true; | ||||||||||
} else { | ||||||||||
const tasks = workflowsStore.getWorkflowRunData?.[node.name] ?? []; | ||||||||||
|
||||||||||
acc[node.id] = Boolean(tasks.at(-1)?.error); | ||||||||||
} | ||||||||||
|
||||||||||
|
@@ -605,7 +633,8 @@ export function useCanvasMapping({ | |||||||||
[CanvasConnectionMode.Output]: outputConnections, | ||||||||||
}, | ||||||||||
issues: { | ||||||||||
items: nodeIssuesById.value[node.id], | ||||||||||
execution: nodeIssuesById.value[node.id].execution, | ||||||||||
validation: nodeIssuesById.value[node.id].validation, | ||||||||||
Comment on lines
+636
to
+637
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this be like below? So we don't have to calculate
Suggested change
|
||||||||||
visible: nodeHasIssuesById.value[node.id], | ||||||||||
}, | ||||||||||
pinnedData: { | ||||||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rename this to
node-execution-error
so people don't misuse this for validation errors?