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

Extract the button component for datasource picker to avoid duplicate code #6559

Merged
merged 3 commits into from
Apr 25, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Workspace] Add permission tab to workspace create update page ([#6378](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6378))
- [Workspace] Hide datasource and advanced settings menu in dashboard management when in workspace. ([#6455](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6455))
- [Multiple Datasource] Modify selectable picker to remove group label and close popover after selection ([#6515](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6515))
- [Multiple Datasource] Extract the button component for datasource picker to avoid duplicate code ([#6559](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6559))
- [Workspace] Add workspaces filter to saved objects page. ([#6458](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6458))

### 🐛 Bug Fixes
Expand Down

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 @@ -4,15 +4,7 @@
*/

import React from 'react';
import {
EuiButtonEmpty,
EuiContextMenuPanel,
EuiPanel,
EuiPopover,
EuiSelectable,
EuiSwitch,
} from '@elastic/eui';
import { i18n } from '@osd/i18n';
import { EuiContextMenuPanel, EuiPanel, EuiPopover, EuiSelectable, EuiSwitch } from '@elastic/eui';
import {
ApplicationStart,
IUiSettingsClient,
Expand All @@ -34,6 +26,7 @@ import { DataSourceOption } from '../data_source_menu/types';
import { DataSourceItem } from '../data_source_item';
import { DataSourceDropDownHeader } from '../drop_down_header';
import './data_source_aggregated_view.scss';
import { DataSourceMenuPopoverButton } from '../popover_button/popover_button';

interface DataSourceAggregatedViewProps {
savedObjectsClient: SavedObjectsClientContract;
Expand Down Expand Up @@ -155,19 +148,6 @@ export class DataSourceAggregatedView extends React.Component<
if (this.state.showError) {
return <DataSourceErrorMenu application={this.props.application} />;
}
const button = (
<EuiButtonEmpty
className="euiHeaderLink"
data-test-subj="dataSourceAggregatedViewContextMenuHeaderLink"
aria-label={i18n.translate('dataSourceAggregatedView.dataSourceOptionsButtonAriaLabel', {
defaultMessage: 'dataSourceAggregatedViewMenuButton',
})}
iconType="database"
iconSide="left"
size="s"
onClick={this.onDataSourcesClick.bind(this)}
/>
);

let items: DataSourceOptionDisplay[] = [];

Expand Down Expand Up @@ -216,7 +196,12 @@ export class DataSourceAggregatedView extends React.Component<
<>
<EuiPopover
id={'dataSourceSViewContextMenuPopover'}
button={button}
button={
<DataSourceMenuPopoverButton
className={'dataSourceAggregatedView'}
onClick={this.onDataSourcesClick.bind(this)}
/>
}
isOpen={this.state.isPopoverOpen}
closePopover={this.closePopover.bind(this)}
panelPaddingSize="none"
Expand Down
Loading
Loading