Skip to content

Commit

Permalink
disable s3 redirection when new nav is on and query enhancement is off
Browse files Browse the repository at this point in the history
Signed-off-by: Eric <menwe@amazon.com>
  • Loading branch information
mengweieric committed Jul 30, 2024
1 parent 2411e2f commit 2324593
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,13 @@ export const DataSourceSelectable = ({
onGetDataSetError, // onGetDataSetError, Callback for handling get data set errors. Ensure it's memoized.
singleSelection = { asPlainText: true },
onRefresh,
uiSettings,
...comboBoxProps
}: DataSourceSelectableProps) => {
// This effect gets data sets and prepares the datasource list for UI rendering.
useEffect(() => {
const newHomePageEnabled = uiSettings.get('home:useNewHomePage');
const queryEnhancementsEnabled = uiSettings.get('query:enhancements:enabled');
Promise.all(
getAllDataSets(
dataSources.filter((ds) => ds.getMetadata().ui.selector.displayDatasetsAsSource)
Expand All @@ -136,12 +139,14 @@ export const DataSourceSelectable = ({
setDataSourceOptionList(
consolidateDataSourceGroups(
dataSetResults as DataSetWithDataSource[],
dataSources.filter((ds) => !ds.getMetadata().ui.selector.displayDatasetsAsSource)
newHomePageEnabled && !queryEnhancementsEnabled
? []
: dataSources.filter((ds) => !ds.getMetadata().ui.selector.displayDatasetsAsSource)
)
);
})
.catch((e) => onGetDataSetError(e));
}, [dataSources, setDataSourceOptionList, onGetDataSetError]);
}, [dataSources, setDataSourceOptionList, onGetDataSetError, uiSettings]);

const handleSourceChange = useCallback(
(selectedOptions: any) => onDataSourceSelect(selectedOptions),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

import { EuiComboBoxProps, EuiComboBoxSingleSelectionShape } from '@elastic/eui';
import { IUiSettingsClient } from 'opensearch-dashboards/public';
import { DataSource } from '../datasource/datasource';

export interface DataSourceGroup {
Expand Down Expand Up @@ -35,4 +36,5 @@ export interface DataSourceSelectableProps extends Pick<EuiComboBoxProps<unknown
selectedSources: DataSourceOption[];
setDataSourceOptionList: (dataSourceList: DataSourceGroup[]) => void;
onRefresh: () => void;
uiSettings: IUiSettingsClient;
}
2 changes: 2 additions & 0 deletions src/plugins/data_explorer/public/components/sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const Sidebar: FC = ({ children }) => {
data: { indexPatterns, dataSources, ui },
notifications: { toasts },
application,
uiSettings,
},
} = useOpenSearchDashboards<DataExplorerServices>();

Expand Down Expand Up @@ -168,6 +169,7 @@ export const Sidebar: FC = ({ children }) => {
selectedSources={selectedSources}
onGetDataSetError={handleGetDataSetError}
onRefresh={memorizedReload}
uiSettings={uiSettings}
fullWidth
/>
</EuiSplitPanel.Inner>
Expand Down

0 comments on commit 2324593

Please sign in to comment.