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

[Multiple Datasource]set fixed totalcount number for empty state #6561

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 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 @@ -87,6 +87,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Multiple Datasource] Add installedPlugins list to data source saved object ([#6348](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6348))
- [Multiple Datasource] Add default icon in multi-selectable picker ([#6357](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6357))
- [Multiple Datasource] Add empty state component for no connected data source ([#6499](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6499))
- [Multiple Datasource] Set fixed totalcount number for empty state ([#6561](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6561))
- [Multiple Datasource] Add popover for empty state and redirect to data source management page([#6514](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6514))
- [Multiple Datasource] Update empty state font size and footer button size to small ([6549](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6549))
- [Workspace] Add APIs to support plugin state in request ([#6303](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6303))
Expand Down
2 changes: 2 additions & 0 deletions changelogs/fragments/6561.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Set fixed totalcount number for empty state ([#6561](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6561))
yujin-emma marked this conversation as resolved.
Show resolved Hide resolved

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
} from '@elastic/eui';
import { i18n } from '@osd/i18n';
import {
ApplicationStart,
IUiSettingsClient,
SavedObjectsClientContract,
ToastsStart,
Expand All @@ -35,6 +36,7 @@ interface DataSourceAggregatedViewProps {
hideLocalCluster: boolean;
fullWidth: boolean;
activeDataSourceIds?: string[];
application?: ApplicationStart;
dataSourceFilter?: (dataSource: SavedObject<DataSourceAttributes>) => boolean;
displayAllCompatibleDataSources: boolean;
uiSettings?: IUiSettingsClient;
Expand Down Expand Up @@ -130,7 +132,7 @@ export class DataSourceAggregatedView extends React.Component<

render() {
if (this.state.showEmptyState) {
return <NoDataSource />;
return <NoDataSource application={this.props.application} />;
}
if (this.state.showError) {
return <DataSourceErrorMenu />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export function DataSourceMenu<T>(props: DataSourceMenuProps<T>): ReactElement |
notifications={notifications!.toasts}
onSelectedDataSources={onSelectedDataSources!}
uiSettings={uiSettings}
application={application}
/>
);
}
Expand Down Expand Up @@ -108,6 +109,7 @@ export function DataSourceMenu<T>(props: DataSourceMenuProps<T>): ReactElement |
dataSourceFilter={dataSourceFilter}
displayAllCompatibleDataSources={displayAllCompatibleDataSources}
uiSettings={uiSettings}
application={application}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
*/

import React from 'react';
import { SavedObjectsClientContract, ToastsStart } from 'opensearch-dashboards/public';
import {
ApplicationStart,
SavedObjectsClientContract,
ToastsStart,
} from 'opensearch-dashboards/public';
import { IUiSettingsClient } from 'src/core/public';
import { DataSourceFilterGroup, SelectedDataSourceOption } from './data_source_filter_group';
import { NoDataSource } from '../no_data_source';
Expand All @@ -18,6 +22,7 @@ export interface DataSourceMultiSeletableProps {
onSelectedDataSources: (dataSources: SelectedDataSourceOption[]) => void;
hideLocalCluster: boolean;
fullWidth: boolean;
application?: ApplicationStart;
uiSettings?: IUiSettingsClient;
}

Expand Down Expand Up @@ -111,7 +116,7 @@ export class DataSourceMultiSelectable extends React.Component<

render() {
if (this.state.showEmptyState) {
return <NoDataSource />;
return <NoDataSource application={this.props.application} />;
}
if (this.state.showError) {
return <DataSourceErrorMenu />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,7 @@ export class DataSourceSelectable extends React.Component<

render() {
if (this.state.showEmptyState) {
return (
<NoDataSource
totalDataSourceCount={this.state.dataSourceOptions.length}
application={this.props.application}
/>
);
return <NoDataSource application={this.props.application} />;
}
if (this.state.showError) {
return <DataSourceErrorMenu />;
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 @@ -146,12 +146,7 @@ export class DataSourceView extends React.Component<DataSourceViewProps, DataSou

render() {
if (this.state.showEmptyState) {
return (
<NoDataSource
totalDataSourceCount={this.state.selectedOption.length}
application={this.props.application}
/>
);
return <NoDataSource application={this.props.application} />;
}
if (this.state.showError) {
return <DataSourceErrorMenu />;
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 @@ -21,16 +21,10 @@ import { DataSourceDropDownHeader } from '../drop_down_header';
import { DSM_APP_ID } from '../../plugin';

interface DataSourceDropDownHeaderProps {
yujin-emma marked this conversation as resolved.
Show resolved Hide resolved
totalDataSourceCount: number;
activeDataSourceCount?: number;
application?: ApplicationStart;
}

export const NoDataSource: React.FC<DataSourceDropDownHeaderProps> = ({
activeDataSourceCount,
totalDataSourceCount,
application,
}) => {
export const NoDataSource: React.FC<DataSourceDropDownHeaderProps> = ({ application }) => {
const [showPopover, setShowPopover] = useState<boolean>(false);
const label = ' No data sources';
const button = (
Expand Down Expand Up @@ -83,7 +77,7 @@ export const NoDataSource: React.FC<DataSourceDropDownHeaderProps> = ({
{
<FormattedMessage
id="dataSourcesManagement.dataSourceMenu.connect"
defaultMessage="Connect data source to get started"
defaultMessage="Connect data source to get started."
/>
}
</EuiText>
Expand All @@ -101,11 +95,7 @@ export const NoDataSource: React.FC<DataSourceDropDownHeaderProps> = ({
anchorPosition="downLeft"
data-test-subj={'dataSourceEmptyStatePopover'}
>
<DataSourceDropDownHeader
activeDataSourceCount={activeDataSourceCount}
totalDataSourceCount={totalDataSourceCount}
application={application}
/>
<DataSourceDropDownHeader totalDataSourceCount={0} application={application} />
<EuiPanel
className={'dataSourceSelectableOuiPanel'}
hasBorder={false}
Expand Down
Loading