From 3f3bc1046e99ce92ead21e4eb3da1f9e7dd9d099 Mon Sep 17 00:00:00 2001 From: Manish Kushare <37823141+manishkushare@users.noreply.github.com> Date: Tue, 8 Jul 2025 19:56:16 +0530 Subject: [PATCH] query switcher bug fixed along with sample data source addition (#13266) --- frontend/ee | 2 +- .../Components/DataSourceSelect.jsx | 57 ++++++++++++++++++- 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/frontend/ee b/frontend/ee index 62115dd4d1..eb63fab1fd 160000 --- a/frontend/ee +++ b/frontend/ee @@ -1 +1 @@ -Subproject commit 62115dd4d18e7951c8742a65045fd43f9c33d3ac +Subproject commit eb63fab1fdbd022ad0c7b8028c63a25293cfa4cf diff --git a/frontend/src/Editor/QueryManager/Components/DataSourceSelect.jsx b/frontend/src/Editor/QueryManager/Components/DataSourceSelect.jsx index 7e14ed0a63..aef29d8f52 100644 --- a/frontend/src/Editor/QueryManager/Components/DataSourceSelect.jsx +++ b/frontend/src/Editor/QueryManager/Components/DataSourceSelect.jsx @@ -16,7 +16,15 @@ import './../queryManager.theme.scss'; import { DATA_SOURCE_TYPE } from '@/_helpers/constants'; import { workflowDefaultSources } from '../constants'; -function DataSourceSelect({ isDisabled, selectRef, closePopup, workflowDataSources, onNewNode, staticDataSources }) { +function DataSourceSelect({ + isDisabled, + selectRef, + closePopup, + workflowDataSources, + onNewNode, + staticDataSources, + sampleDataSources = [], +}) { const dataSources = useDataSources(); const globalDataSources = useGlobalDataSources(); const sampleDataSource = useSampleDataSource(); @@ -137,6 +145,37 @@ function DataSourceSelect({ isDisabled, selectRef, closePopup, workflowDataSourc ...userDefinedSourcesOpts, ]; + // Group sample data sources by kind + const groupedSampleDataSources = + sampleDataSources && sampleDataSources.length > 0 + ? Object.entries(groupBy(sampleDataSources, 'kind')).map(([kind, sources]) => ({ + label: ( +
+ + {dataSourcesKinds.find((dsk) => dsk.kind === kind)?.name || kind} +
+ ), + options: sources.map((source) => ({ + label: ( +
+ {decodeEntities(source.name)} + +
+ ), + value: source.id, + isNested: true, + source, + })), + })) + : []; + const dataSourcesAvailable = [ { label: ( @@ -159,6 +198,22 @@ function DataSourceSelect({ isDisabled, selectRef, closePopup, workflowDataSourc })), }, ...userDefinedSourcesOpts, + // Sample data sources group header + ...(groupedSampleDataSources.length > 0 + ? [ + { + label: ( +
+ + Sample data sources + +
+ ), + isDisabled: true, + }, + ...groupedSampleDataSources, + ] + : []), ]; const dataSourceList = workflowDataSources && workflowDataSources ? dataSourcesAvailable : DataSourceOptions;