refactor(editor): Showing errors in input pane (#4059)

* refactor(editor): removing output error reporting from input panel

* refactor(editor): input panel error notification with linking back to the errored node

* fix(editor): switching to the correct node after backlinking from the error in a further node

* fix(editor): input pane error message font size and translation keys

* fix(editor): output error message layout

* fix(editor-ui): update input panel node error title translation

* fix(editor-ui): achieve proper update when changing node from input error link

* fix(editor-ui): adding local utility class to not break output error layout
This commit is contained in:
Csaba Tuncsik 2022-09-19 12:26:02 +02:00 committed by GitHub
parent 651d788ddb
commit 762e00570a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 11 deletions

View file

@ -338,8 +338,8 @@ export default mixins(
}, },
}, },
watch: { watch: {
activeNode(node, oldNode) { activeNode(node: INodeUi | null) {
if (node && !oldNode && !this.isActiveStickyNode) { if (node && !this.isActiveStickyNode) {
this.runInputIndex = -1; this.runInputIndex = -1;
this.runOutputIndex = -1; this.runOutputIndex = -1;
this.isLinkingEnabled = true; this.isLinkingEnabled = true;

View file

@ -199,8 +199,14 @@
</n8n-text> </n8n-text>
</div> </div>
<div v-else-if="hasNodeRun && hasRunError" :class="$style.errorDisplay"> <div v-else-if="hasNodeRun && hasRunError" :class="$style.stretchVertically">
<NodeErrorView :error="workflowRunData[node.name][runIndex].error" /> <n8n-text v-if="isPaneTypeInput" :class="$style.center" size="large" tag="p" bold>
{{ $locale.baseText('nodeErrorView.inputPanel.previousNodeError.title', { interpolate: { nodeName: node.name } }) }}
<n8n-link @click="goToErroredNode">
{{ $locale.baseText('nodeErrorView.inputPanel.previousNodeError.text') }}
</n8n-link>
</n8n-text>
<NodeErrorView v-else :error="workflowRunData[node.name][runIndex].error" :class="$style.errorDisplay" />
</div> </div>
<div v-else-if="hasNodeRun && jsonData && jsonData.length === 0 && branches.length > 1" :class="$style.center"> <div v-else-if="hasNodeRun && jsonData && jsonData.length === 0 && branches.length > 1" :class="$style.center">
@ -335,7 +341,6 @@
//@ts-ignore //@ts-ignore
import VueJsonPretty from 'vue-json-pretty'; import VueJsonPretty from 'vue-json-pretty';
import { import {
GenericValue,
IBinaryData, IBinaryData,
IBinaryKeyData, IBinaryKeyData,
IDataObject, IDataObject,
@ -351,7 +356,6 @@ import {
INodeUi, INodeUi,
IRunDataDisplayMode, IRunDataDisplayMode,
ITab, ITab,
ITableData,
} from '@/Interface'; } from '@/Interface';
import { import {
@ -479,7 +483,7 @@ export default mixins(
mounted() { mounted() {
this.init(); this.init();
if (this.paneType === 'output') { if (!this.isPaneTypeInput) {
this.eventBus.$on('data-pinning-error', this.onDataPinningError); this.eventBus.$on('data-pinning-error', this.onDataPinningError);
this.eventBus.$on('data-unpinning', this.onDataUnpinning); this.eventBus.$on('data-unpinning', this.onDataUnpinning);
@ -532,7 +536,7 @@ export default mixins(
return !!(this.nodeType && this.nodeType.group.includes('trigger')); return !!(this.nodeType && this.nodeType.group.includes('trigger'));
}, },
canPinData (): boolean { canPinData (): boolean {
return this.paneType === 'output' && return !this.isPaneTypeInput &&
this.isPinDataNodeType && this.isPinDataNodeType &&
!(this.binaryData && this.binaryData.length > 0); !(this.binaryData && this.binaryData.length > 0);
}, },
@ -690,9 +694,12 @@ export default mixins(
return branches; return branches;
}, },
editMode(): { enabled: boolean; value: string; } { editMode(): { enabled: boolean; value: string; } {
return this.paneType === 'output' return this.isPaneTypeInput
? this.$store.getters['ui/outputPanelEditMode'] ? { enabled: false, value: '' }
: { enabled: false, value: '' }; : this.$store.getters['ui/outputPanelEditMode'];
},
isPaneTypeInput(): boolean {
return this.paneType === 'input';
}, },
}, },
methods: { methods: {
@ -1231,6 +1238,11 @@ export default mixins(
this.$store.commit('updateNodeProperties', updateInformation); this.$store.commit('updateNodeProperties', updateInformation);
} }
}, },
goToErroredNode() {
if (this.node) {
this.$store.commit('setActiveNode', this.node.name);
}
},
}, },
watch: { watch: {
node() { node() {
@ -1523,6 +1535,11 @@ export default mixins(
align-items: center; align-items: center;
margin-left: var(--spacing-s); margin-left: var(--spacing-s);
} }
.stretchVertically {
height: 100%;
}
</style> </style>
<style lang="scss"> <style lang="scss">

View file

@ -470,6 +470,8 @@
"nodeErrorView.stack": "Stack", "nodeErrorView.stack": "Stack",
"nodeErrorView.theErrorCauseIsTooLargeToBeDisplayed": "The error cause is too large to be displayed", "nodeErrorView.theErrorCauseIsTooLargeToBeDisplayed": "The error cause is too large to be displayed",
"nodeErrorView.time": "Time", "nodeErrorView.time": "Time",
"nodeErrorView.inputPanel.previousNodeError.title": "Error running node '{nodeName}'",
"nodeErrorView.inputPanel.previousNodeError.text": "View error",
"nodeHelpers.credentialsUnset": "Credentials for '{credentialType}' are not set.", "nodeHelpers.credentialsUnset": "Credentials for '{credentialType}' are not set.",
"nodeSettings.alwaysOutputData.description": "If active, will output a single, empty item when the output would have been empty. Use to prevent the workflow finishing on this node.", "nodeSettings.alwaysOutputData.description": "If active, will output a single, empty item when the output would have been empty. Use to prevent the workflow finishing on this node.",
"nodeSettings.alwaysOutputData.displayName": "Always Output Data", "nodeSettings.alwaysOutputData.displayName": "Always Output Data",