diff --git a/src/plugins/data_source_management/public/components/data_source_aggregated_view/data_source_aggregated_view.tsx b/src/plugins/data_source_management/public/components/data_source_aggregated_view/data_source_aggregated_view.tsx index 72db5bd5b4c4..8d8cd2ed0ef9 100644 --- a/src/plugins/data_source_management/public/components/data_source_aggregated_view/data_source_aggregated_view.tsx +++ b/src/plugins/data_source_management/public/components/data_source_aggregated_view/data_source_aggregated_view.tsx @@ -45,7 +45,7 @@ interface DataSourceAggregatedViewState extends DataSourceBaseState { allDataSourcesIdToTitleMap: Map; switchChecked: boolean; defaultDataSource: string | null; - hasIncompatibleDataSources: boolean; + incompatibleDataSourcesExist: boolean; } interface DataSourceOptionDisplay extends DataSourceOption { @@ -69,7 +69,7 @@ export class DataSourceAggregatedView extends React.Component< showError: false, switchChecked: false, defaultDataSource: null, - hasIncompatibleDataSources: false, + incompatibleDataSourcesExist: false, }; } @@ -119,7 +119,7 @@ export class DataSourceAggregatedView extends React.Component< changeState: this.onEmptyState.bind(this, !!fetchedDataSources?.length), notifications: this.props.notifications, application: this.props.application, - hasIncompatibleDatasources: !!fetchedDataSources?.length, + incompatibleDataSourcesExist: !!fetchedDataSources?.length, }); return; } @@ -136,8 +136,8 @@ export class DataSourceAggregatedView extends React.Component< }); } - onEmptyState(hasIncompatibleDataSources: boolean) { - this.setState({ showEmptyState: true, hasIncompatibleDataSources }); + onEmptyState(incompatibleDataSourcesExist: boolean) { + this.setState({ showEmptyState: true, incompatibleDataSourcesExist }); } onError() { @@ -149,7 +149,7 @@ export class DataSourceAggregatedView extends React.Component< return ( ); } diff --git a/src/plugins/data_source_management/public/components/data_source_multi_selectable/data_source_multi_selectable.tsx b/src/plugins/data_source_management/public/components/data_source_multi_selectable/data_source_multi_selectable.tsx index d0432ee2cb20..481df093d741 100644 --- a/src/plugins/data_source_management/public/components/data_source_multi_selectable/data_source_multi_selectable.tsx +++ b/src/plugins/data_source_management/public/components/data_source_multi_selectable/data_source_multi_selectable.tsx @@ -34,7 +34,7 @@ interface DataSourceMultiSeletableState extends DataSourceBaseState { dataSourceOptions: SelectedDataSourceOption[]; selectedOptions: SelectedDataSourceOption[]; defaultDataSource: string | null; - hasIncompatibleDatasources: boolean; + incompatibleDataSourcesExist: boolean; } export class DataSourceMultiSelectable extends React.Component< @@ -52,7 +52,7 @@ export class DataSourceMultiSelectable extends React.Component< defaultDataSource: null, showEmptyState: false, showError: false, - hasIncompatibleDatasources: false, + incompatibleDataSourcesExist: false, }; } @@ -97,7 +97,7 @@ export class DataSourceMultiSelectable extends React.Component< notifications: this.props.notifications, application: this.props.application, callback: this.props.onSelectedDataSources, - hasIncompatibleDatasources: !!fetchedDataSources?.length, + incompatibleDataSourcesExist: !!fetchedDataSources?.length, }); return; } @@ -118,8 +118,8 @@ export class DataSourceMultiSelectable extends React.Component< } } - onEmptyState(hasIncompatibleDatasources: boolean) { - this.setState({ showEmptyState: true, hasIncompatibleDatasources }); + onEmptyState(incompatibleDataSourcesExist: boolean) { + this.setState({ showEmptyState: true, incompatibleDataSourcesExist }); } onError() { diff --git a/src/plugins/data_source_management/public/components/data_source_selectable/data_source_selectable.test.tsx b/src/plugins/data_source_management/public/components/data_source_selectable/data_source_selectable.test.tsx index f1f4bb06e138..6521aaddb258 100644 --- a/src/plugins/data_source_management/public/components/data_source_selectable/data_source_selectable.test.tsx +++ b/src/plugins/data_source_management/public/components/data_source_selectable/data_source_selectable.test.tsx @@ -154,7 +154,7 @@ describe('DataSourceSelectable', () => { }, ], showError: false, - hasIncompatibleDatasources: false, + incompatibleDataSourcesExist: false, }); containerInstance.onChange([{ id: 'test2', label: 'test2', checked: 'on' }]); @@ -177,7 +177,7 @@ describe('DataSourceSelectable', () => { }, ], showError: false, - hasIncompatibleDatasources: false, + incompatibleDataSourcesExist: false, }); expect(onSelectedDataSource).toBeCalledWith([{ id: 'test2', label: 'test2' }]); @@ -356,7 +356,7 @@ describe('DataSourceSelectable', () => { }, ], showError: false, - hasIncompatibleDatasources: false, + incompatibleDataSourcesExist: false, }); }); @@ -386,7 +386,7 @@ describe('DataSourceSelectable', () => { selectedOption: [], showEmptyState: false, showError: true, - hasIncompatibleDatasources: false, + incompatibleDataSourcesExist: false, }); containerInstance.onChange([{ id: 'test2', label: 'test2', checked: 'on' }]); @@ -409,7 +409,7 @@ describe('DataSourceSelectable', () => { }, ], showError: true, - hasIncompatibleDatasources: false, + incompatibleDataSourcesExist: false, }); expect(onSelectedDataSource).toBeCalledWith([{ id: 'test2', label: 'test2' }]); diff --git a/src/plugins/data_source_management/public/components/data_source_selectable/data_source_selectable.tsx b/src/plugins/data_source_management/public/components/data_source_selectable/data_source_selectable.tsx index 121f6724ce7a..92f6243362bd 100644 --- a/src/plugins/data_source_management/public/components/data_source_selectable/data_source_selectable.tsx +++ b/src/plugins/data_source_management/public/components/data_source_selectable/data_source_selectable.tsx @@ -56,7 +56,7 @@ interface DataSourceSelectableState extends DataSourceBaseState { isPopoverOpen: boolean; selectedOption?: DataSourceOption[]; defaultDataSource: string | null; - hasIncompatibleDatasources: boolean; + incompatibleDataSourcesExist: boolean; } export class DataSourceSelectable extends React.Component< @@ -75,7 +75,7 @@ export class DataSourceSelectable extends React.Component< defaultDataSource: null, showEmptyState: false, showError: false, - hasIncompatibleDatasources: false, + incompatibleDataSourcesExist: false, }; this.onChange.bind(this); @@ -194,7 +194,7 @@ export class DataSourceSelectable extends React.Component< notifications: this.props.notifications, application: this.props.application, callback: this.props.onSelectedDataSources, - hasIncompatibleDatasources: !!fetchedDataSources?.length, + incompatibleDataSourcesExist: !!fetchedDataSources?.length, }); return; } @@ -217,8 +217,8 @@ export class DataSourceSelectable extends React.Component< } } - onEmptyState(hasIncompatibleDatasources: boolean) { - this.setState({ showEmptyState: true, hasIncompatibleDatasources }); + onEmptyState(incompatibleDataSourcesExist: boolean) { + this.setState({ showEmptyState: true, incompatibleDataSourcesExist }); } onError() { @@ -248,7 +248,7 @@ export class DataSourceSelectable extends React.Component< return ( ); } diff --git a/src/plugins/data_source_management/public/components/no_data_source/__snapshots__/no_data_source.test.tsx.snap b/src/plugins/data_source_management/public/components/no_data_source/__snapshots__/no_data_source.test.tsx.snap index 22719ee81b37..f7f3e41b9cb5 100644 --- a/src/plugins/data_source_management/public/components/no_data_source/__snapshots__/no_data_source.test.tsx.snap +++ b/src/plugins/data_source_management/public/components/no_data_source/__snapshots__/no_data_source.test.tsx.snap @@ -83,7 +83,7 @@ exports[`NoDataSource should render correctly with the provided totalDataSourceC `; -exports[`NoDataSource should render normally when hasIncompatibleDatasources is %b 1`] = ` +exports[`NoDataSource should render normally when incompatibleDataSourcesExist is %b 1`] = ` `; -exports[`NoDataSource should render normally when hasIncompatibleDatasources is %b 2`] = ` +exports[`NoDataSource should render normally when incompatibleDataSourcesExist is %b 2`] = ` { }); it.each([false, true])( - 'should render normally when hasIncompatibleDatasources is %b', - (hasIncompatibleDatasources) => { + 'should render normally when incompatibleDataSourcesExist is %b', + (incompatibleDataSourcesExist) => { component = shallow( ); expect(component).toMatchSnapshot(); diff --git a/src/plugins/data_source_management/public/components/no_data_source/no_data_source.tsx b/src/plugins/data_source_management/public/components/no_data_source/no_data_source.tsx index 9b12f22506d1..a34099370e18 100644 --- a/src/plugins/data_source_management/public/components/no_data_source/no_data_source.tsx +++ b/src/plugins/data_source_management/public/components/no_data_source/no_data_source.tsx @@ -29,12 +29,12 @@ import { interface DataSourceDropDownHeaderProps { application?: ApplicationStart; - hasIncompatibleDatasources: boolean; + incompatibleDataSourcesExist: boolean; } export const NoDataSource: React.FC = ({ application, - hasIncompatibleDatasources, + incompatibleDataSourcesExist, }) => { const [showPopover, setShowPopover] = useState(false); const button = ( @@ -74,7 +74,7 @@ export const NoDataSource: React.FC = ({ = ({ { test.each([ { - hasIncompatibleDatasources: false, + incompatibleDataSourcesExist: false, defaultMessage: noDataSourcesConnectedMessage, }, { - hasIncompatibleDatasources: true, + incompatibleDataSourcesExist: true, defaultMessage: noCompatibleDataSourcesMessage, }, ])( 'should send warning when data source is not available', - ({ hasIncompatibleDatasources, defaultMessage }) => { + ({ incompatibleDataSourcesExist, defaultMessage }) => { const changeState = jest.fn(); handleNoAvailableDataSourceError({ changeState, notifications: toasts, - hasIncompatibleDatasources, + incompatibleDataSourcesExist, }); expect(toasts.add).toBeCalledTimes(1); expect(toasts.add).toBeCalledWith( diff --git a/src/plugins/data_source_management/public/components/utils.ts b/src/plugins/data_source_management/public/components/utils.ts index a7dc7fde9554..b04c9a51dc99 100644 --- a/src/plugins/data_source_management/public/components/utils.ts +++ b/src/plugins/data_source_management/public/components/utils.ts @@ -98,13 +98,13 @@ export interface HandleNoAvailableDataSourceErrorProps { notifications: ToastsStart; application?: ApplicationStart; callback?: (ds: DataSourceOption[]) => void; - hasIncompatibleDatasources: boolean; + incompatibleDataSourcesExist: boolean; } export function handleNoAvailableDataSourceError(props: HandleNoAvailableDataSourceErrorProps) { - const { changeState, notifications, application, callback, hasIncompatibleDatasources } = props; + const { changeState, notifications, application, callback, incompatibleDataSourcesExist } = props; - const defaultMessage = hasIncompatibleDatasources + const defaultMessage = incompatibleDataSourcesExist ? `${NO_COMPATIBLE_DATASOURCES_MESSAGE} ${ADD_COMPATIBLE_DATASOURCES_MESSAGE}` : `${NO_DATASOURCES_CONNECTED_MESSAGE} ${CONNECT_DATASOURCES_MESSAGE}`;