Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Manual][Backport 2.x] add multi selectable data source component #6318

Merged
merged 2 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,18 @@ describe('DataSourceMenu', () => {
);
expect(container).toMatchSnapshot();
});

it('should render data source multi select component', () => {
const container = render(
<DataSourceMenu
showDataSourceMultiSelectable={true}
appName={'myapp'}
fullWidth={true}
className={'myclass'}
savedObjects={client}
notifications={notifications}
/>
);
expect(container).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
import { DataSourceSelectable } from './data_source_selectable';
import { DataSourceAggregatedView } from '../data_source_aggregated_view';
import { DataSourceView } from '../data_source_view';
import { DataSourceMultiSelectable } from '../data_source_multi_selectable/data_source_multi_selectable';
import {
DataSourceAggregatedViewConfig,
DataSourceComponentType,
DataSourceMenuProps,
DataSourceMultiSelectableConfig,
DataSourceSelectableConfig,
DataSourceViewConfig,
} from './types';
Expand All @@ -29,6 +31,27 @@
);
}

function renderDataSourceMultiSelectable(
config: DataSourceMultiSelectableConfig
): ReactElement | null {
const {
fullWidth,
hideLocalCluster,
savedObjects,
notifications,
onSelectedDataSources,
} = config;
return (

Check warning on line 44 in src/plugins/data_source_management/public/components/data_source_menu/data_source_menu.tsx

View check run for this annotation

Codecov / codecov/patch

src/plugins/data_source_management/public/components/data_source_menu/data_source_menu.tsx#L43-L44

Added lines #L43 - L44 were not covered by tests
<DataSourceMultiSelectable
fullWidth={fullWidth}
hideLocalCluster={hideLocalCluster || false}
savedObjectsClient={savedObjects!}
notifications={notifications!.toasts}
onSelectedDataSources={onSelectedDataSources!}
/>
);
}

function renderDataSourceSelectable(config: DataSourceSelectableConfig): ReactElement | null {
const {
onSelectedDataSources,
Expand Down Expand Up @@ -87,6 +110,8 @@
return renderDataSourceSelectable(componentConfig as DataSourceSelectableConfig);
case DataSourceComponentType.DataSourceView:
return renderDataSourceView(componentConfig as DataSourceViewConfig);
case DataSourceComponentType.DataSourceMultiSelectable:
return renderDataSourceMultiSelectable(componentConfig as DataSourceMultiSelectableConfig);

Check warning on line 114 in src/plugins/data_source_management/public/components/data_source_menu/data_source_menu.tsx

View check run for this annotation

Codecov / codecov/patch

src/plugins/data_source_management/public/components/data_source_menu/data_source_menu.tsx#L114

Added line #L114 was not covered by tests
default:
return null;
}
Expand Down
Loading
Loading