From 484f5cfdf1133f8681fe90e5b9390a4edc9588f9 Mon Sep 17 00:00:00 2001 From: Yulong Ruan Date: Thu, 6 Jun 2024 17:09:37 +0800 Subject: [PATCH] set opensearch_dashboards_sample_data_logs as default selected Signed-off-by: Yulong Ruan --- .../public/application/components/source_selector.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/visualize/public/application/components/source_selector.tsx b/src/plugins/visualize/public/application/components/source_selector.tsx index 673c804283a7..b7370dab3cd7 100644 --- a/src/plugins/visualize/public/application/components/source_selector.tsx +++ b/src/plugins/visualize/public/application/components/source_selector.tsx @@ -45,7 +45,14 @@ export const SourceSelector = ({ dataSourceOptions.length > 0 && dataSourceOptions[0].options.length > 0 ) { - onChange(dataSourceOptions[0].options[0]); + const defaultSelectedSource = dataSourceOptions[0].options.find( + (item) => item.label === 'opensearch_dashboards_sample_data_logs' + ); + if (defaultSelectedSource) { + onChange(defaultSelectedSource); + } else { + onChange(dataSourceOptions[0].options[0]); + } } }, [selectedSourceId, dataSourceOptions]);