fix(editor): Show input panel with not connected message (#9495)

This commit is contained in:
Csaba Tuncsik 2024-05-23 06:39:05 +02:00 committed by GitHub
parent 301e846cf6
commit 8566301731
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 12 deletions

View file

@ -24,6 +24,14 @@ describe('NDV', () => {
ndv.getters.container().should('not.be.visible'); ndv.getters.container().should('not.be.visible');
}); });
it('should show input panel when node is not connected', () => {
workflowPage.actions.addInitialNodeToCanvas('Manual');
workflowPage.actions.deselectAll();
workflowPage.actions.addNodeToCanvas('Set');
workflowPage.getters.canvasNodes().last().dblclick();
ndv.getters.container().should('be.visible').should('contain', 'Wire me up');
});
it('should test webhook node', () => { it('should test webhook node', () => {
workflowPage.actions.addInitialNodeToCanvas('Webhook'); workflowPage.actions.addInitialNodeToCanvas('Webhook');
workflowPage.getters.canvasNodes().first().dblclick(); workflowPage.getters.canvasNodes().first().dblclick();

View file

@ -1,6 +1,5 @@
<template> <template>
<RunData <RunData
v-if="currentNode"
:node="currentNode" :node="currentNode"
:run-index="runIndex" :run-index="runIndex"
:linked-runs="linkedRuns" :linked-runs="linkedRuns"

View file

@ -1,6 +1,5 @@
<template> <template>
<RunData <RunData
v-if="node"
ref="runData" ref="runData"
:node="node" :node="node"
:run-index="runIndex" :run-index="runIndex"

View file

@ -274,7 +274,7 @@
</n8n-text> </n8n-text>
<slot v-else-if="$slots['content']" name="content"></slot> <slot v-else-if="$slots['content']" name="content"></slot>
<NodeErrorView <NodeErrorView
v-else-if="hasRunError" v-else-if="workflowRunErrorAsNodeError"
:error="workflowRunErrorAsNodeError" :error="workflowRunErrorAsNodeError"
:class="$style.dataDisplay" :class="$style.dataDisplay"
/> />
@ -370,7 +370,7 @@
</n8n-text> </n8n-text>
</div> </div>
<Suspense v-else-if="hasNodeRun && displayMode === 'table'"> <Suspense v-else-if="hasNodeRun && displayMode === 'table' && node">
<RunDataTable <RunDataTable
:node="node" :node="node"
:input-data="inputDataPage" :input-data="inputDataPage"
@ -644,8 +644,8 @@ export default defineComponent({
}, },
props: { props: {
node: { node: {
type: Object as PropType<INodeUi>, type: Object as PropType<INodeUi | null>,
required: true, default: null,
}, },
runIndex: { runIndex: {
type: Number, type: Number,
@ -836,7 +836,10 @@ export default defineComponent({
hasSubworkflowExecutionError(): boolean { hasSubworkflowExecutionError(): boolean {
return Boolean(this.workflowsStore.subWorkflowExecutionError); return Boolean(this.workflowsStore.subWorkflowExecutionError);
}, },
workflowRunErrorAsNodeError(): NodeError { workflowRunErrorAsNodeError(): NodeError | null {
if (!this.node) {
return null;
}
return this.workflowRunData?.[this.node?.name]?.[this.runIndex]?.error as NodeError; return this.workflowRunData?.[this.node?.name]?.[this.runIndex]?.error as NodeError;
}, },
hasRunError(): boolean { hasRunError(): boolean {
@ -982,7 +985,7 @@ export default defineComponent({
outputName = `${this.$locale.baseText('ndv.output')} ${outputName}`; outputName = `${this.$locale.baseText('ndv.output')} ${outputName}`;
} else { } else {
const appendBranchWord = NODE_TYPES_EXCLUDED_FROM_OUTPUT_NAME_APPEND.includes( const appendBranchWord = NODE_TYPES_EXCLUDED_FROM_OUTPUT_NAME_APPEND.includes(
this.node?.type, this.node?.type ?? '',
) )
? '' ? ''
: ` ${this.$locale.baseText('ndv.output.branch')}`; : ` ${this.$locale.baseText('ndv.output.branch')}`;
@ -1021,7 +1024,7 @@ export default defineComponent({
parentNodeOutputData(): INodeExecutionData[] { parentNodeOutputData(): INodeExecutionData[] {
const workflow = this.workflowsStore.getCurrentWorkflow(); const workflow = this.workflowsStore.getCurrentWorkflow();
const parentNode = workflow.getParentNodesByDepth(this.node.name)[0]; const parentNode = workflow.getParentNodesByDepth(this.node?.name ?? '')[0];
let parentNodeData: INodeExecutionData[] = []; let parentNodeData: INodeExecutionData[] = [];
if (parentNode?.name) { if (parentNode?.name) {
@ -1095,7 +1098,7 @@ export default defineComponent({
this.activatePane(); this.activatePane();
} }
if (this.hasRunError) { if (this.hasRunError && this.node) {
const error = this.workflowRunData?.[this.node.name]?.[this.runIndex]?.error; const error = this.workflowRunData?.[this.node.name]?.[this.runIndex]?.error;
const errorsToTrack = ['unknown error']; const errorsToTrack = ['unknown error'];
@ -1548,7 +1551,7 @@ export default defineComponent({
} }
}, },
async downloadJsonData() { async downloadJsonData() {
const fileName = this.node.name.replace(/[^\w\d]/g, '_'); const fileName = (this.node?.name ?? '').replace(/[^\w\d]/g, '_');
const blob = new Blob([JSON.stringify(this.rawInputData, null, 2)], { const blob = new Blob([JSON.stringify(this.rawInputData, null, 2)], {
type: 'application/json', type: 'application/json',
}); });
@ -1560,7 +1563,7 @@ export default defineComponent({
this.binaryDataDisplayVisible = true; this.binaryDataDisplayVisible = true;
this.binaryDataDisplayData = { this.binaryDataDisplayData = {
node: this.node.name, node: this.node?.name,
runIndex: this.runIndex, runIndex: this.runIndex,
outputIndex: this.currentOutputIndex, outputIndex: this.currentOutputIndex,
index, index,