Skip to content

Commit

Permalink
Add icon in datasource table page to show the default datasource
Browse files Browse the repository at this point in the history
Signed-off-by: Yuanqi(Ella) Zhu <zhyuanqi@amazon.com>
  • Loading branch information
zhyuanqi committed Mar 21, 2024
1 parent 0cc91ab commit c5bdaee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Multiple Datasource] Add default functionality for customer to choose default datasource ([#6058](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/6058))
- [Multiple Datasource] Add import support for Vega when specifying a datasource ([#6123](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6123))
- [Workspace] Validate if workspace exists when setup inside a workspace ([#6154](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6154))
- [Multiple Datasource] Add icon in datasource table page to show the default datasource ([#6231](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6231))


### 🐛 Bug Fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import {
EuiBadge,
EuiButton,
EuiButtonEmpty,
EuiConfirmModal,
Expand Down Expand Up @@ -50,6 +51,7 @@ export const DataSourceTable = ({ history }: RouteComponentProps) => {
setBreadcrumbs,
savedObjects,
notifications: { toasts },
uiSettings,
} = useOpenSearchDashboards<DataSourceManagementContext>().services;

/* Component state variables */
Expand All @@ -75,6 +77,8 @@ export const DataSourceTable = ({ history }: RouteComponentProps) => {
fetchDataSources();
});

const defaultDataSourceID = uiSettings.get('defaultDataSource', null);

const fetchDataSources = () => {
setIsLoading(true);
getDataSources(savedObjects.client)
Expand Down Expand Up @@ -147,6 +151,11 @@ export const DataSourceTable = ({ history }: RouteComponentProps) => {
<EuiButtonEmpty size="xs" {...reactRouterNavigate(history, `${index.id}`)}>
{name}
</EuiButtonEmpty>
{index.id === defaultDataSourceID ? (
<EuiBadge iconType="starFilled" iconSide="left">
Default
</EuiBadge>
) : null}
</>
),
dataType: 'string' as const,
Expand Down

0 comments on commit c5bdaee

Please sign in to comment.