mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(editor): Handle disabled nodes in schema view (#10052)
Co-authored-by: Shireen Missi <94372015+ShireenMissi@users.noreply.github.com>
This commit is contained in:
parent
9cbbb6335d
commit
ab5688c582
|
@ -253,11 +253,14 @@
|
||||||
<NodeErrorView :error="subworkflowExecutionError" :class="$style.errorDisplay" />
|
<NodeErrorView :error="subworkflowExecutionError" :class="$style.errorDisplay" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else-if="!hasNodeRun" :class="$style.center">
|
<div v-else-if="!hasNodeRun && !(isInputSchemaView && node?.disabled)" :class="$style.center">
|
||||||
<slot name="node-not-run"></slot>
|
<slot name="node-not-run"></slot>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else-if="paneType === 'input' && node?.disabled" :class="$style.center">
|
<div
|
||||||
|
v-else-if="paneType === 'input' && !isInputSchemaView && node?.disabled"
|
||||||
|
:class="$style.center"
|
||||||
|
>
|
||||||
<n8n-text>
|
<n8n-text>
|
||||||
{{ $locale.baseText('ndv.input.disabled', { interpolate: { nodeName: node.name } }) }}
|
{{ $locale.baseText('ndv.input.disabled', { interpolate: { nodeName: node.name } }) }}
|
||||||
<n8n-link @click="enableNode">
|
<n8n-link @click="enableNode">
|
||||||
|
|
|
@ -285,6 +285,7 @@ watch(
|
||||||
|
|
||||||
<div :class="$style.title">
|
<div :class="$style.title">
|
||||||
{{ currentNode.node.name }}
|
{{ currentNode.node.name }}
|
||||||
|
<span v-if="currentNode.node.disabled">({{ $locale.baseText('node.disabled') }})</span>
|
||||||
</div>
|
</div>
|
||||||
<font-awesome-icon
|
<font-awesome-icon
|
||||||
v-if="currentNode.nodeType.group.includes('trigger')"
|
v-if="currentNode.nodeType.group.includes('trigger')"
|
||||||
|
@ -329,8 +330,16 @@ watch(
|
||||||
>
|
>
|
||||||
<div :class="$style.innerSchema" @transitionstart.stop>
|
<div :class="$style.innerSchema" @transitionstart.stop>
|
||||||
<div
|
<div
|
||||||
v-if="isDataEmpty(currentNode.schema)"
|
v-if="currentNode.node.disabled"
|
||||||
:class="$style.empty"
|
:class="$style.notice"
|
||||||
|
data-test-id="run-data-schema-disabled"
|
||||||
|
>
|
||||||
|
{{ i18n.baseText('dataMapping.schemaView.disabled') }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-else-if="isDataEmpty(currentNode.schema)"
|
||||||
|
:class="$style.notice"
|
||||||
data-test-id="run-data-schema-empty"
|
data-test-id="run-data-schema-empty"
|
||||||
>
|
>
|
||||||
{{ i18n.baseText('dataMapping.schemaView.emptyData') }}
|
{{ i18n.baseText('dataMapping.schemaView.emptyData') }}
|
||||||
|
@ -421,7 +430,7 @@ watch(
|
||||||
scroll-margin-top: var(--header-height);
|
scroll-margin-top: var(--header-height);
|
||||||
}
|
}
|
||||||
|
|
||||||
.empty {
|
.notice {
|
||||||
padding-left: var(--spacing-l);
|
padding-left: var(--spacing-l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -443,7 +452,7 @@ watch(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.empty {
|
.notice {
|
||||||
font-size: var(--font-size-2xs);
|
font-size: var(--font-size-2xs);
|
||||||
color: var(--color-text-light);
|
color: var(--color-text-light);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,21 @@ const mockNode1 = createTestNode({
|
||||||
name: 'Set1',
|
name: 'Set1',
|
||||||
type: SET_NODE_TYPE,
|
type: SET_NODE_TYPE,
|
||||||
typeVersion: 1,
|
typeVersion: 1,
|
||||||
|
disabled: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mockNode2 = createTestNode({
|
const mockNode2 = createTestNode({
|
||||||
name: 'Set2',
|
name: 'Set2',
|
||||||
type: SET_NODE_TYPE,
|
type: SET_NODE_TYPE,
|
||||||
typeVersion: 1,
|
typeVersion: 1,
|
||||||
|
disabled: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
const disabledNode = createTestNode({
|
||||||
|
name: 'Disabled Node',
|
||||||
|
type: SET_NODE_TYPE,
|
||||||
|
typeVersion: 1,
|
||||||
|
disabled: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
async function setupStore() {
|
async function setupStore() {
|
||||||
|
@ -28,7 +37,7 @@ async function setupStore() {
|
||||||
name: 'Test Workflow',
|
name: 'Test Workflow',
|
||||||
connections: {},
|
connections: {},
|
||||||
active: true,
|
active: true,
|
||||||
nodes: [mockNode1, mockNode2],
|
nodes: [mockNode1, mockNode2, disabledNode],
|
||||||
});
|
});
|
||||||
|
|
||||||
const pinia = createPinia();
|
const pinia = createPinia();
|
||||||
|
@ -162,6 +171,18 @@ describe('RunDataSchema.vue', () => {
|
||||||
expect(getAllByTestId('run-data-schema-empty').length).toBe(1);
|
expect(getAllByTestId('run-data-schema-empty').length).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('renders disabled nodes correctly', () => {
|
||||||
|
const { getByTestId } = renderComponent({
|
||||||
|
props: {
|
||||||
|
nodes: [{ name: disabledNode.name, indicies: [], depth: 1 }],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
expect(getByTestId('run-data-schema-disabled')).toBeInTheDocument();
|
||||||
|
expect(getByTestId('run-data-schema-node-name')).toHaveTextContent(
|
||||||
|
`${disabledNode.name} (Deactivated)`,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test.each([[[{ tx: false }, { tx: false }]], [[{ tx: '' }, { tx: '' }]], [[{ tx: [] }]]])(
|
test.each([[[{ tx: false }, { tx: false }]], [[{ tx: '' }, { tx: '' }]], [[{ tx: [] }]]])(
|
||||||
'renders schema instead of showing no data for %o',
|
'renders schema instead of showing no data for %o',
|
||||||
(data) => {
|
(data) => {
|
||||||
|
|
|
@ -1382,7 +1382,8 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
||||||
class="title"
|
class="title"
|
||||||
data-v-46dade00=""
|
data-v-46dade00=""
|
||||||
>
|
>
|
||||||
Set1
|
Set1
|
||||||
|
<!--v-if-->
|
||||||
</div>
|
</div>
|
||||||
<!--v-if-->
|
<!--v-if-->
|
||||||
</div>
|
</div>
|
||||||
|
@ -1932,7 +1933,8 @@ exports[`RunDataSchema.vue > renders schema with spaces and dots 1`] = `
|
||||||
class="title"
|
class="title"
|
||||||
data-v-46dade00=""
|
data-v-46dade00=""
|
||||||
>
|
>
|
||||||
Set2
|
Set2
|
||||||
|
<!--v-if-->
|
||||||
</div>
|
</div>
|
||||||
<!--v-if-->
|
<!--v-if-->
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -606,6 +606,7 @@
|
||||||
"dataMapping.tableView.tableColumnsExceeded.tooltip": "Your data has more than {columnLimit} columns so some are hidden. Switch to {link} to see all data.",
|
"dataMapping.tableView.tableColumnsExceeded.tooltip": "Your data has more than {columnLimit} columns so some are hidden. Switch to {link} to see all data.",
|
||||||
"dataMapping.tableView.tableColumnsExceeded.tooltip.link": "JSON view",
|
"dataMapping.tableView.tableColumnsExceeded.tooltip.link": "JSON view",
|
||||||
"dataMapping.schemaView.emptyData": "No fields - item(s) exist, but they're empty",
|
"dataMapping.schemaView.emptyData": "No fields - item(s) exist, but they're empty",
|
||||||
|
"dataMapping.schemaView.disabled": "This node is disabled and will just pass data through",
|
||||||
"dataMapping.schemaView.noMatches": "No results for '{search}'",
|
"dataMapping.schemaView.noMatches": "No results for '{search}'",
|
||||||
"displayWithChange.cancelEdit": "Cancel Edit",
|
"displayWithChange.cancelEdit": "Cancel Edit",
|
||||||
"displayWithChange.clickToChange": "Click to Change",
|
"displayWithChange.clickToChange": "Click to Change",
|
||||||
|
|
Loading…
Reference in a new issue