From 0b97d997d45f8041cafd0f40191b116dbc7c25c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yulia=20=C4=8Cech?= <6585477+yuliacech@users.noreply.github.com> Date: Tue, 17 Oct 2023 22:37:56 +0200 Subject: [PATCH] [Remote clusters] Fix empty states (#169015) ## Summary I noticed that Remote clusters UI has a wrapper on empty states which is probably a regression from the EuiPage deprecations migration. This PR fixes the list and edit views. See screenshots below.
#### List empty state Before Screenshot 2023-10-16 at 19 27 12 After Screenshot 2023-10-16 at 19 42 24 #### List error Before Screenshot 2023-10-16 at 19 34 07 After Screenshot 2023-10-16 at 19 45 18 #### List error permissions Before Screenshot 2023-10-16 at 19 27 50 After Screenshot 2023-10-16 at 19 44 14 #### List loading Before Screenshot 2023-10-16 at 20 08 54 After Screenshot 2023-10-16 at 20 10 18 #### Edit form error Before Screenshot 2023-10-16 at 19 59 54 After Screenshot 2023-10-16 at 20 03 59 #### Edit form loading Before Screenshot 2023-10-16 at 20 00 34 After Screenshot 2023-10-16 at 20 03 41
(cherry picked from commit bdf064e075b1d393ae3a7168b14b50d182868ab9) --- .../section_loading/section_loading.tsx | 17 +- .../remote_cluster_edit.js | 140 ++++++------- .../remote_cluster_list.js | 198 ++++++++---------- 3 files changed, 173 insertions(+), 182 deletions(-) diff --git a/src/plugins/es_ui_shared/public/components/section_loading/section_loading.tsx b/src/plugins/es_ui_shared/public/components/section_loading/section_loading.tsx index 119e053312dc8..cbdaf444ca228 100644 --- a/src/plugins/es_ui_shared/public/components/section_loading/section_loading.tsx +++ b/src/plugins/es_ui_shared/public/components/section_loading/section_loading.tsx @@ -15,13 +15,24 @@ import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template'; interface Props { inline?: boolean; children: React.ReactNode; + 'data-test-subj'?: string; [key: string]: any; } -export const SectionLoading: React.FunctionComponent = ({ inline, children, ...rest }) => { +export const SectionLoading: React.FunctionComponent = ({ + inline, + 'data-test-subj': dataTestSubj, + children, + ...rest +}) => { if (inline) { return ( - + @@ -38,7 +49,7 @@ export const SectionLoading: React.FunctionComponent = ({ inline, childre } body={{children}} - data-test-subj="sectionLoading" + data-test-subj={dataTestSubj ?? 'sectionLoading'} /> ); }; diff --git a/x-pack/plugins/remote_clusters/public/application/sections/remote_cluster_edit/remote_cluster_edit.js b/x-pack/plugins/remote_clusters/public/application/sections/remote_cluster_edit/remote_cluster_edit.js index 02ae974380683..04daad5dee8fc 100644 --- a/x-pack/plugins/remote_clusters/public/application/sections/remote_cluster_edit/remote_cluster_edit.js +++ b/x-pack/plugins/remote_clusters/public/application/sections/remote_cluster_edit/remote_cluster_edit.js @@ -96,55 +96,51 @@ export class RemoteClusterEdit extends Component { if (isLoading) { return ( - - - - - + + + ); } if (!cluster) { return ( - - - - - } - body={ -

- -

- } - actions={ - - - - } - /> -
+ + + + } + body={ +

+ +

+ } + actions={ + + + + } + /> ); } @@ -152,36 +148,34 @@ export class RemoteClusterEdit extends Component { if (isConfiguredByNode) { return ( - - - - - } - body={ -

- + + + } + body={ +

+ -

- } - actions={ - - - - } - /> -
+ /> +

+ } + actions={ + + + + } + /> ); } diff --git a/x-pack/plugins/remote_clusters/public/application/sections/remote_cluster_list/remote_cluster_list.js b/x-pack/plugins/remote_clusters/public/application/sections/remote_cluster_list/remote_cluster_list.js index 06948e25a0583..21ed52d08fa83 100644 --- a/x-pack/plugins/remote_clusters/public/application/sections/remote_cluster_list/remote_cluster_list.js +++ b/x-pack/plugins/remote_clusters/public/application/sections/remote_cluster_list/remote_cluster_list.js @@ -93,28 +93,26 @@ export class RemoteClusterList extends Component { renderNoPermission() { return ( - - - - - } - body={ -

- -

- } - /> -
+ + + + } + body={ +

+ +

+ } + /> ); } @@ -124,103 +122,91 @@ export class RemoteClusterList extends Component { const { statusCode, error: errorString } = error.body; return ( - - - - - } - body={ -

- {statusCode} {errorString} -

- } - /> -
+ + + + } + body={ +

+ {statusCode} {errorString} +

+ } + /> ); } renderEmpty() { return ( - - - - - } - body={ -

- + + + } + body={ +

+ -

- } - actions={ - - - - } - footer={ - <> - - - - - {' '} - + /> +

+ } + actions={ + + + + } + footer={ + <> + + -
- - } - /> -
+ + {' '} + + + + + } + /> ); } renderLoading() { return ( - - - - - + + + ); }