diff --git a/x-pack/plugins/snapshot_restore/public/application/components/policy_form/steps/step_settings/fields/indices_and_data_streams_field/data_streams_and_indices_list_help_text.tsx b/x-pack/plugins/snapshot_restore/public/application/components/policy_form/steps/step_settings/fields/indices_and_data_streams_field/data_streams_and_indices_list_help_text.tsx index 93b481f97605c..26b5752992a20 100644 --- a/x-pack/plugins/snapshot_restore/public/application/components/policy_form/steps/step_settings/fields/indices_and_data_streams_field/data_streams_and_indices_list_help_text.tsx +++ b/x-pack/plugins/snapshot_restore/public/application/components/policy_form/steps/step_settings/fields/indices_and_data_streams_field/data_streams_and_indices_list_help_text.tsx @@ -21,6 +21,29 @@ export const DataStreamsAndIndicesListHelpText: FunctionComponent = ({ indices, dataStreams, }) => { + if (selectedIndicesAndDataStreams.length === 0) { + return ( + { + onSelectionChange('all'); + }} + > + + + ), + }} + /> + ); + } + const indicesCount = selectedIndicesAndDataStreams.reduce( (acc, v) => (indices.includes(v) ? acc + 1 : acc), 0 @@ -29,50 +52,28 @@ export const DataStreamsAndIndicesListHelpText: FunctionComponent = ({ (acc, v) => (dataStreams.includes(v) ? acc + 1 : acc), 0 ); - const i18nValues = { - indicesCount, - dataStreamsCount, - selectOrDeselectAllLink: - selectedIndicesAndDataStreams.length > 0 ? ( - { - onSelectionChange('none'); - }} - > - - - ) : ( - { - onSelectionChange('all'); - }} - > - - - ), - }; - if (selectedIndicesAndDataStreams.length === 0) { - return ( - - ); - } return ( { + onSelectionChange('none'); + }} + > + + + ), + }} /> ); }; diff --git a/x-pack/plugins/snapshot_restore/public/application/components/restore_snapshot_form/steps/step_logistics/data_streams_and_indices_list_help_text.tsx b/x-pack/plugins/snapshot_restore/public/application/components/restore_snapshot_form/steps/step_logistics/data_streams_and_indices_list_help_text.tsx index 6f432d2468ab4..36f3c7704a569 100644 --- a/x-pack/plugins/snapshot_restore/public/application/components/restore_snapshot_form/steps/step_logistics/data_streams_and_indices_list_help_text.tsx +++ b/x-pack/plugins/snapshot_restore/public/application/components/restore_snapshot_form/steps/step_logistics/data_streams_and_indices_list_help_text.tsx @@ -21,6 +21,29 @@ export const DataStreamsAndIndicesListHelpText: FunctionComponent = ({ indices, dataStreams, }) => { + if (selectedIndicesAndDataStreams.length === 0) { + return ( + { + onSelectionChange('all'); + }} + > + + + ), + }} + /> + ); + } + const indicesCount = selectedIndicesAndDataStreams.reduce( (acc, v) => (indices.includes(v) ? acc + 1 : acc), 0 @@ -29,50 +52,28 @@ export const DataStreamsAndIndicesListHelpText: FunctionComponent = ({ (acc, v) => (dataStreams.includes(v) ? acc + 1 : acc), 0 ); - const i18nValues = { - indicesCount, - dataStreamsCount, - selectOrDeselectAllLink: - selectedIndicesAndDataStreams.length > 0 ? ( - { - onSelectionChange('none'); - }} - > - - - ) : ( - { - onSelectionChange('all'); - }} - > - - - ), - }; - if (selectedIndicesAndDataStreams.length === 0) { - return ( - - ); - } return ( { + onSelectionChange('none'); + }} + > + + + ), + }} /> ); };