Skip to content

Commit c32cf64

Browse files
michael-radencyShireenMissielsmr
authored
fix: NDV search bugs (#11613)
Co-authored-by: Shireen Missi <[email protected]> Co-authored-by: Elias Meire <[email protected]>
1 parent 04029d8 commit c32cf64

File tree

6 files changed

+184
-1
lines changed

6 files changed

+184
-1
lines changed

cypress/e2e/5-ndv.cy.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,4 +795,46 @@ describe('NDV', () => {
795795
.find('[data-test-id=run-data-schema-item]')
796796
.should('contain.text', 'onlyOnItem3');
797797
});
798+
799+
it('should keep search expanded after Test step node run', () => {
800+
cy.createFixtureWorkflow('Test_ndv_search.json');
801+
workflowPage.actions.zoomToFit();
802+
workflowPage.actions.executeWorkflow();
803+
workflowPage.actions.openNode('Edit Fields');
804+
ndv.getters.outputPanel().should('be.visible');
805+
ndv.getters.outputPanel().findChildByTestId('ndv-search').click().type('US');
806+
ndv.getters.outputTableRow(1).find('mark').should('have.text', 'US');
807+
808+
ndv.actions.execute();
809+
ndv.getters
810+
.outputPanel()
811+
.findChildByTestId('ndv-search')
812+
.should('be.visible')
813+
.should('have.value', 'US');
814+
});
815+
816+
it('should not show items count when seaching in schema view', () => {
817+
cy.createFixtureWorkflow('Test_ndv_search.json');
818+
workflowPage.actions.zoomToFit();
819+
workflowPage.actions.openNode('Edit Fields');
820+
ndv.getters.outputPanel().should('be.visible');
821+
ndv.actions.execute();
822+
ndv.actions.switchOutputMode('Schema');
823+
ndv.getters.outputPanel().find('[data-test-id=ndv-search]').click().type('US');
824+
ndv.getters.outputPanel().find('[data-test-id=ndv-items-count]').should('not.exist');
825+
});
826+
827+
it('should show additional tooltip when seaching in schema view if no matches', () => {
828+
cy.createFixtureWorkflow('Test_ndv_search.json');
829+
workflowPage.actions.zoomToFit();
830+
workflowPage.actions.openNode('Edit Fields');
831+
ndv.getters.outputPanel().should('be.visible');
832+
ndv.actions.execute();
833+
ndv.actions.switchOutputMode('Schema');
834+
ndv.getters.outputPanel().find('[data-test-id=ndv-search]').click().type('foo');
835+
ndv.getters
836+
.outputPanel()
837+
.contains('To search field contents rather than just names, use Table or JSON view')
838+
.should('exist');
839+
});
798840
});

cypress/fixtures/Test_ndv_search.json

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
{
2+
"name": "NDV search bugs (introduced by schema view?)",
3+
"nodes": [
4+
{
5+
"parameters": {},
6+
"id": "55635c7b-92ee-4d2d-a0c0-baff9ab071da",
7+
"name": "When clicking ‘Test workflow’",
8+
"type": "n8n-nodes-base.manualTrigger",
9+
"position": [
10+
800,
11+
380
12+
],
13+
"typeVersion": 1
14+
},
15+
{
16+
"parameters": {
17+
"operation": "getAllPeople"
18+
},
19+
"id": "4737af43-e49b-4c92-b76f-32605c047114",
20+
"name": "Customer Datastore (n8n training)",
21+
"type": "n8n-nodes-base.n8nTrainingCustomerDatastore",
22+
"typeVersion": 1,
23+
"position": [
24+
1020,
25+
380
26+
]
27+
},
28+
{
29+
"parameters": {
30+
"assignments": {
31+
"assignments": []
32+
},
33+
"includeOtherFields": true,
34+
"options": {}
35+
},
36+
"id": "8cc9b374-1856-4f3f-9315-08e6e27840d8",
37+
"name": "Edit Fields",
38+
"type": "n8n-nodes-base.set",
39+
"typeVersion": 3.4,
40+
"position": [
41+
1240,
42+
380
43+
]
44+
}
45+
],
46+
"pinData": {
47+
"Customer Datastore (n8n training)": [
48+
{
49+
"json": {
50+
"id": "23423532",
51+
"name": "Jay Gatsby",
52+
"email": "[email protected]",
53+
"notes": "Keeps asking about a green light??",
54+
"country": "US",
55+
"created": "1925-04-10"
56+
}
57+
},
58+
{
59+
"json": {
60+
"id": "23423533",
61+
"name": "José Arcadio Buendía",
62+
"email": "[email protected]",
63+
"notes": "Lots of people named after him. Very confusing",
64+
"country": "CO",
65+
"created": "1967-05-05"
66+
}
67+
},
68+
{
69+
"json": {
70+
"id": "23423534",
71+
"name": "Max Sendak",
72+
"email": "[email protected]",
73+
"notes": "Keeps rolling his terrible eyes",
74+
"country": "US",
75+
"created": "1963-04-09"
76+
}
77+
},
78+
{
79+
"json": {
80+
"id": "23423535",
81+
"name": "Zaphod Beeblebrox",
82+
"email": "[email protected]",
83+
"notes": "Felt like I was talking to more than one person",
84+
"country": null,
85+
"created": "1979-10-12"
86+
}
87+
},
88+
{
89+
"json": {
90+
"id": "23423536",
91+
"name": "Edmund Pevensie",
92+
"email": "[email protected]",
93+
"notes": "Passionate sailor",
94+
"country": "UK",
95+
"created": "1950-10-16"
96+
}
97+
}
98+
]
99+
},
100+
"connections": {
101+
"When clicking ‘Test workflow’": {
102+
"main": [
103+
[
104+
{
105+
"node": "Customer Datastore (n8n training)",
106+
"type": "main",
107+
"index": 0
108+
}
109+
]
110+
]
111+
},
112+
"Customer Datastore (n8n training)": {
113+
"main": [
114+
[
115+
{
116+
"node": "Edit Fields",
117+
"type": "main",
118+
"index": 0
119+
}
120+
]
121+
]
122+
}
123+
},
124+
"active": false,
125+
"settings": {
126+
"executionOrder": "v1"
127+
},
128+
"versionId": "20178044-fb64-4443-88dd-e941517520d0",
129+
"meta": {
130+
"templateCredsSetupCompleted": true,
131+
"instanceId": "be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd"
132+
},
133+
"id": "aBVnTRON9Y2cSmse",
134+
"tags": []
135+
}

packages/editor-ui/src/components/RunData.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ export default defineComponent({
251251
isSchemaView(): boolean {
252252
return this.displayMode === 'schema';
253253
},
254+
isSearchInSchemaView(): boolean {
255+
return this.displayMode === 'schema' && this.search.length > 0;
256+
},
254257
displaysMultipleNodes(): boolean {
255258
return this.isSchemaView && this.paneType === 'input' && this.nodes.length > 0;
256259
},
@@ -1403,6 +1406,7 @@ export default defineComponent({
14031406
v-else-if="
14041407
!hasRunError &&
14051408
hasNodeRun &&
1409+
!isSearchInSchemaView &&
14061410
((dataCount > 0 && maxRunIndex === 0) || search) &&
14071411
!isArtificialRecoveredEventItem &&
14081412
!displaysMultipleNodes

packages/editor-ui/src/components/RunDataSchema.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ watch(
409409
</template>
410410
</i18n-t>
411411
</n8n-text>
412+
<n8n-text>{{ $locale.baseText('ndv.search.noMatchSchema.description') }}</n8n-text>
412413
</div>
413414

414415
<div v-else :class="$style.schema" data-test-id="run-data-schema-node-schema">

packages/editor-ui/src/components/RunDataSearch.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const { debounce } = useDebounce();
3131
3232
const inputRef = ref<HTMLInputElement | null>(null);
3333
const search = ref(props.modelValue ?? '');
34-
const opened = ref(false);
34+
const opened = ref(!!search.value);
3535
const placeholder = computed(() => {
3636
if (props.paneType === 'output') {
3737
return locale.baseText('ndv.search.placeholder.output');

packages/editor-ui/src/plugins/i18n/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2071,6 +2071,7 @@
20712071
"ndv.search.noMatch.title": "No matching items",
20722072
"ndv.search.noNodeMatch.title": "No matching nodes",
20732073
"ndv.search.noMatch.description": "Try changing or {link} the filter to see more",
2074+
"ndv.search.noMatchSchema.description": "To search field contents rather than just names, use Table or JSON view",
20742075
"ndv.search.noMatch.description.link": "clearing",
20752076
"ndv.search.items": "{matched} of {total} item | {matched} of {total} items",
20762077
"updatesPanel.andIs": "and is",

0 commit comments

Comments
 (0)