Skip to content

Commit

Permalink
Extract the button component for datasource picker to avoid duplicate…
Browse files Browse the repository at this point in the history
… code

Signed-off-by: Yuanqi(Ella) Zhu <[email protected]>
  • Loading branch information
zhyuanqi committed Apr 22, 2024
1 parent 8db9688 commit 959984d
Show file tree
Hide file tree
Showing 12 changed files with 183 additions and 282 deletions.
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 @@ -28,6 +28,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 { PopoverButton } from '../popover_button/popover_button';

interface DataSourceAggregatedViewProps {
savedObjectsClient: SavedObjectsClientContract;
Expand Down Expand Up @@ -135,19 +136,6 @@ export class DataSourceAggregatedView extends React.Component<
if (this.state.showError) {
return <DataSourceErrorMenu />;
}
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 @@ -196,7 +184,12 @@ export class DataSourceAggregatedView extends React.Component<
<>
<EuiPopover
id={'dataSourceSViewContextMenuPopover'}
button={button}
button={
<PopoverButton
className={'dataSourceAggregatedView'}
onClick={this.onDataSourcesClick.bind(this)}
/>
}
isOpen={this.state.isPopoverOpen}
closePopover={this.closePopover.bind(this)}
panelPaddingSize="none"
Expand Down

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

Loading

0 comments on commit 959984d

Please sign in to comment.