diff --git a/packages/editor-ui/src/components/RunData.vue b/packages/editor-ui/src/components/RunData.vue
index e8e1770077..cfed2a76d2 100644
--- a/packages/editor-ui/src/components/RunData.vue
+++ b/packages/editor-ui/src/components/RunData.vue
@@ -246,8 +246,8 @@ export default defineComponent({
isSchemaView(): boolean {
return this.displayMode === 'schema';
},
- isInputSchemaView(): boolean {
- return this.isSchemaView && this.paneType === 'input';
+ displaysMultipleNodes(): boolean {
+ return this.isSchemaView && this.paneType === 'input' && this.nodes.length > 0;
},
isTriggerNode(): boolean {
if (this.node === null) {
@@ -1307,7 +1307,7 @@ export default defineComponent({
@@ -1349,7 +1349,7 @@ export default defineComponent({
-
+
@@ -1382,7 +1382,7 @@ export default defineComponent({
hasNodeRun &&
((dataCount > 0 && maxRunIndex === 0) || search) &&
!isArtificialRecoveredEventItem &&
- !isInputSchemaView
+ !displaysMultipleNodes
"
v-show="!editMode.enabled && !hasRunError"
:class="[$style.itemsCount, { [$style.muted]: paneType === 'input' && maxRunIndex === 0 }]"
@@ -1443,12 +1443,15 @@ export default defineComponent({
xxx
-
+
diff --git a/packages/editor-ui/src/components/RunDataSchema.vue b/packages/editor-ui/src/components/RunDataSchema.vue
index 50e5afd31f..d4b5f01e18 100644
--- a/packages/editor-ui/src/components/RunDataSchema.vue
+++ b/packages/editor-ui/src/components/RunDataSchema.vue
@@ -95,7 +95,7 @@ const nodes = computed(() => {
return {
node: fullNode,
- connectedOutputIndexes: node.indicies,
+ connectedOutputIndexes: node.indicies.length > 0 ? node.indicies : [0],
depth: node.depth,
itemsCount,
nodeType,
@@ -264,7 +264,10 @@ watch(
-
+
{{
$locale.baseText('ndv.search.noNodeMatch.title')
diff --git a/packages/editor-ui/src/components/__tests__/RunDataSchema.test.ts b/packages/editor-ui/src/components/__tests__/RunDataSchema.test.ts
index 5c8aedb36f..3cbe68836f 100644
--- a/packages/editor-ui/src/components/__tests__/RunDataSchema.test.ts
+++ b/packages/editor-ui/src/components/__tests__/RunDataSchema.test.ts
@@ -44,13 +44,20 @@ const ifNode = createTestNode({
disabled: false,
});
+const aiTool = createTestNode({
+ name: 'AI Tool',
+ type: '@n8n/n8n-nodes-langchain.memoryBufferWindow',
+ typeVersion: 1,
+ disabled: false,
+});
+
async function setupStore() {
const workflow = mock({
id: '123',
name: 'Test Workflow',
connections: {},
active: true,
- nodes: [mockNode1, mockNode2, disabledNode, ifNode],
+ nodes: [mockNode1, mockNode2, disabledNode, ifNode, aiTool],
});
const pinia = createPinia();
@@ -239,6 +246,49 @@ describe('RunDataSchema.vue', () => {
});
});
+ it('renders previous nodes schema for AI tools', async () => {
+ mockNodeOutputData(
+ 'If',
+ [
+ { id: 1, name: 'John' },
+ { id: 2, name: 'Jane' },
+ ],
+ 0,
+ );
+ const { getByTestId } = renderComponent({
+ props: {
+ nodes: [
+ {
+ name: 'If',
+ indicies: [], // indicies are not set for AI tools
+ depth: 2,
+ },
+ ],
+ node: aiTool,
+ },
+ });
+
+ await waitFor(() => {
+ expect(getByTestId('run-data-schema-node-name')).toHaveTextContent('If');
+ expect(getByTestId('run-data-schema-node-item-count')).toHaveTextContent('2 items');
+ expect(getByTestId('run-data-schema-node-schema')).toMatchSnapshot();
+ });
+ });
+
+ it('renders its own data for AI tools in debug mode', async () => {
+ const { getByTestId } = renderComponent({
+ props: {
+ nodes: [], // in debug mode nodes are empty
+ node: aiTool,
+ data: [{ output: 'AI tool output' }],
+ },
+ });
+
+ await waitFor(() => {
+ expect(getByTestId('run-data-schema-node-schema')).toMatchSnapshot();
+ });
+ });
+
test.each([[[{ tx: false }, { tx: false }]], [[{ tx: '' }, { tx: '' }]], [[{ tx: [] }]]])(
'renders schema instead of showing no data for %o',
(data) => {
diff --git a/packages/editor-ui/src/components/__tests__/__snapshots__/RunDataSchema.test.ts.snap b/packages/editor-ui/src/components/__tests__/__snapshots__/RunDataSchema.test.ts.snap
index ae35584978..96a20786fc 100644
--- a/packages/editor-ui/src/components/__tests__/__snapshots__/RunDataSchema.test.ts.snap
+++ b/packages/editor-ui/src/components/__tests__/__snapshots__/RunDataSchema.test.ts.snap
@@ -1,5 +1,295 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
+exports[`RunDataSchema.vue > renders its own data for AI tools in debug mode 1`] = `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ output
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AI tool output
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+`;
+
+exports[`RunDataSchema.vue > renders previous nodes schema for AI tools 1`] = `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ name
+
+
+
+
+
+
+
+
+
+
+
+
+
+ John
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+`;
+
exports[`RunDataSchema.vue > renders schema for correct output branch 1`] = `