Skip to content

Commit

Permalink
[8.11] [Remote clusters] Fix empty states (#169015) (#169173)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.11`:
- [[Remote clusters] Fix empty states
(#169015)](#169015)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Yulia
Čech","email":"6585477+yuliacech@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-10-17T20:37:56Z","message":"[Remote
clusters] Fix empty states (#169015)\n\n## Summary\r\n\r\nI noticed that
Remote clusters UI has a wrapper on empty states which is\r\nprobably a
regression from the EuiPage deprecations migration. This PR\r\nfixes the
list and edit views. See screenshots below.\r\n\r\n<details>\r\n\r\n####
List empty state \r\n\r\nBefore \r\n<img width=\"1919\" alt=\"Screenshot
2023-10-16 at 19 27
12\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/e0e50958-c605-413c-b79b-80b6743ac6b0\">\r\n\r\nAfter\r\n<img
width=\"1918\" alt=\"Screenshot 2023-10-16 at 19 42
24\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/7cc54494-fd0a-4e18-9ec9-cc501afbb978\">\r\n\r\n####
List error \r\n\r\nBefore\r\n<img width=\"1916\" alt=\"Screenshot
2023-10-16 at 19 34
07\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/362169af-924e-40d0-9c25-d3d3fbabf112\">\r\n\r\nAfter\r\n<img
width=\"1918\" alt=\"Screenshot 2023-10-16 at 19 45
18\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/c4931d64-e298-4962-9ba0-ddaf9a948a6a\">\r\n\r\n\r\n####
List error permissions \r\n\r\nBefore \r\n<img width=\"1921\"
alt=\"Screenshot 2023-10-16 at 19 27
50\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/1eaf2fff-c8d6-45b7-b670-4b8dd4ab0844\">\r\n\r\nAfter
\r\n<img width=\"1916\" alt=\"Screenshot 2023-10-16 at 19 44
14\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/9bbcce09-9326-45a4-bb31-a42a13a999ac\">\r\n\r\n####
List loading \r\n\r\nBefore\r\n<img width=\"1918\" alt=\"Screenshot
2023-10-16 at 20 08
54\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/11b2dab3-9e93-4e37-821c-fb367afa4fb9\">\r\n\r\nAfter\r\n<img
width=\"1918\" alt=\"Screenshot 2023-10-16 at 20 10
18\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/30021cfe-cd8c-4aff-8877-f4b052ce3b7b\">\r\n\r\n####
Edit form error\r\n\r\nBefore\r\n<img width=\"1918\" alt=\"Screenshot
2023-10-16 at 19 59
54\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/1d54919f-f1fb-4938-93b3-f949705b12b2\">\r\n\r\nAfter\r\n<img
width=\"1918\" alt=\"Screenshot 2023-10-16 at 20 03
59\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/a2369e1c-3e28-418e-a359-1564259c00cb\">\r\n\r\n\r\n####
Edit form loading \r\n\r\nBefore\r\n<img width=\"1918\" alt=\"Screenshot
2023-10-16 at 20 00
34\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/ead45d19-43a3-4cc9-bd6a-338321b6757d\">\r\n\r\nAfter\r\n<img
width=\"1918\" alt=\"Screenshot 2023-10-16 at 20 03
41\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/e563a54e-598c-42fc-88a9-fb1659a86fdd\">\r\n\r\n\r\n</details>","sha":"bdf064e075b1d393ae3a7168b14b50d182868ab9","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","Feature:CCR
and Remote Clusters","Team:Deployment
Management","release_note:skip","v8.11.0","v8.12.0"],"number":169015,"url":"https://github.com/elastic/kibana/pull/169015","mergeCommit":{"message":"[Remote
clusters] Fix empty states (#169015)\n\n## Summary\r\n\r\nI noticed that
Remote clusters UI has a wrapper on empty states which is\r\nprobably a
regression from the EuiPage deprecations migration. This PR\r\nfixes the
list and edit views. See screenshots below.\r\n\r\n<details>\r\n\r\n####
List empty state \r\n\r\nBefore \r\n<img width=\"1919\" alt=\"Screenshot
2023-10-16 at 19 27
12\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/e0e50958-c605-413c-b79b-80b6743ac6b0\">\r\n\r\nAfter\r\n<img
width=\"1918\" alt=\"Screenshot 2023-10-16 at 19 42
24\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/7cc54494-fd0a-4e18-9ec9-cc501afbb978\">\r\n\r\n####
List error \r\n\r\nBefore\r\n<img width=\"1916\" alt=\"Screenshot
2023-10-16 at 19 34
07\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/362169af-924e-40d0-9c25-d3d3fbabf112\">\r\n\r\nAfter\r\n<img
width=\"1918\" alt=\"Screenshot 2023-10-16 at 19 45
18\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/c4931d64-e298-4962-9ba0-ddaf9a948a6a\">\r\n\r\n\r\n####
List error permissions \r\n\r\nBefore \r\n<img width=\"1921\"
alt=\"Screenshot 2023-10-16 at 19 27
50\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/1eaf2fff-c8d6-45b7-b670-4b8dd4ab0844\">\r\n\r\nAfter
\r\n<img width=\"1916\" alt=\"Screenshot 2023-10-16 at 19 44
14\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/9bbcce09-9326-45a4-bb31-a42a13a999ac\">\r\n\r\n####
List loading \r\n\r\nBefore\r\n<img width=\"1918\" alt=\"Screenshot
2023-10-16 at 20 08
54\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/11b2dab3-9e93-4e37-821c-fb367afa4fb9\">\r\n\r\nAfter\r\n<img
width=\"1918\" alt=\"Screenshot 2023-10-16 at 20 10
18\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/30021cfe-cd8c-4aff-8877-f4b052ce3b7b\">\r\n\r\n####
Edit form error\r\n\r\nBefore\r\n<img width=\"1918\" alt=\"Screenshot
2023-10-16 at 19 59
54\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/1d54919f-f1fb-4938-93b3-f949705b12b2\">\r\n\r\nAfter\r\n<img
width=\"1918\" alt=\"Screenshot 2023-10-16 at 20 03
59\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/a2369e1c-3e28-418e-a359-1564259c00cb\">\r\n\r\n\r\n####
Edit form loading \r\n\r\nBefore\r\n<img width=\"1918\" alt=\"Screenshot
2023-10-16 at 20 00
34\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/ead45d19-43a3-4cc9-bd6a-338321b6757d\">\r\n\r\nAfter\r\n<img
width=\"1918\" alt=\"Screenshot 2023-10-16 at 20 03
41\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/e563a54e-598c-42fc-88a9-fb1659a86fdd\">\r\n\r\n\r\n</details>","sha":"bdf064e075b1d393ae3a7168b14b50d182868ab9"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/169015","number":169015,"mergeCommit":{"message":"[Remote
clusters] Fix empty states (#169015)\n\n## Summary\r\n\r\nI noticed that
Remote clusters UI has a wrapper on empty states which is\r\nprobably a
regression from the EuiPage deprecations migration. This PR\r\nfixes the
list and edit views. See screenshots below.\r\n\r\n<details>\r\n\r\n####
List empty state \r\n\r\nBefore \r\n<img width=\"1919\" alt=\"Screenshot
2023-10-16 at 19 27
12\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/e0e50958-c605-413c-b79b-80b6743ac6b0\">\r\n\r\nAfter\r\n<img
width=\"1918\" alt=\"Screenshot 2023-10-16 at 19 42
24\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/7cc54494-fd0a-4e18-9ec9-cc501afbb978\">\r\n\r\n####
List error \r\n\r\nBefore\r\n<img width=\"1916\" alt=\"Screenshot
2023-10-16 at 19 34
07\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/362169af-924e-40d0-9c25-d3d3fbabf112\">\r\n\r\nAfter\r\n<img
width=\"1918\" alt=\"Screenshot 2023-10-16 at 19 45
18\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/c4931d64-e298-4962-9ba0-ddaf9a948a6a\">\r\n\r\n\r\n####
List error permissions \r\n\r\nBefore \r\n<img width=\"1921\"
alt=\"Screenshot 2023-10-16 at 19 27
50\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/1eaf2fff-c8d6-45b7-b670-4b8dd4ab0844\">\r\n\r\nAfter
\r\n<img width=\"1916\" alt=\"Screenshot 2023-10-16 at 19 44
14\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/9bbcce09-9326-45a4-bb31-a42a13a999ac\">\r\n\r\n####
List loading \r\n\r\nBefore\r\n<img width=\"1918\" alt=\"Screenshot
2023-10-16 at 20 08
54\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/11b2dab3-9e93-4e37-821c-fb367afa4fb9\">\r\n\r\nAfter\r\n<img
width=\"1918\" alt=\"Screenshot 2023-10-16 at 20 10
18\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/30021cfe-cd8c-4aff-8877-f4b052ce3b7b\">\r\n\r\n####
Edit form error\r\n\r\nBefore\r\n<img width=\"1918\" alt=\"Screenshot
2023-10-16 at 19 59
54\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/1d54919f-f1fb-4938-93b3-f949705b12b2\">\r\n\r\nAfter\r\n<img
width=\"1918\" alt=\"Screenshot 2023-10-16 at 20 03
59\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/a2369e1c-3e28-418e-a359-1564259c00cb\">\r\n\r\n\r\n####
Edit form loading \r\n\r\nBefore\r\n<img width=\"1918\" alt=\"Screenshot
2023-10-16 at 20 00
34\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/ead45d19-43a3-4cc9-bd6a-338321b6757d\">\r\n\r\nAfter\r\n<img
width=\"1918\" alt=\"Screenshot 2023-10-16 at 20 03
41\"\r\nsrc=\"https://github.com/elastic/kibana/assets/6585477/e563a54e-598c-42fc-88a9-fb1659a86fdd\">\r\n\r\n\r\n</details>","sha":"bdf064e075b1d393ae3a7168b14b50d182868ab9"}}]}]
BACKPORT-->

Co-authored-by: Yulia Čech <6585477+yuliacech@users.noreply.github.com>
  • Loading branch information
kibanamachine and yuliacech authored Oct 17, 2023
1 parent 36da4cc commit f3a1e7f
Show file tree
Hide file tree
Showing 3 changed files with 173 additions and 182 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Props> = ({ inline, children, ...rest }) => {
export const SectionLoading: React.FunctionComponent<Props> = ({
inline,
'data-test-subj': dataTestSubj,
children,
...rest
}) => {
if (inline) {
return (
<EuiFlexGroup justifyContent="flexStart" alignItems="center" gutterSize="s">
<EuiFlexGroup
justifyContent="flexStart"
alignItems="center"
gutterSize="s"
data-test-subj={dataTestSubj}
>
<EuiFlexItem grow={false}>
<EuiLoadingSpinner size="m" />
</EuiFlexItem>
Expand All @@ -38,7 +49,7 @@ export const SectionLoading: React.FunctionComponent<Props> = ({ inline, childre
<KibanaPageTemplate.EmptyPrompt
title={<EuiLoadingSpinner size="xl" />}
body={<EuiText color="subdued">{children}</EuiText>}
data-test-subj="sectionLoading"
data-test-subj={dataTestSubj ?? 'sectionLoading'}
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -96,92 +96,86 @@ export class RemoteClusterEdit extends Component {

if (isLoading) {
return (
<EuiPageTemplate minHeight={0} panelled paddingSize="none" offset={0}>
<SectionLoading>
<FormattedMessage
id="xpack.remoteClusters.edit.loadingLabel"
defaultMessage="Loading remote cluster…"
/>
</SectionLoading>
</EuiPageTemplate>
<SectionLoading>
<FormattedMessage
id="xpack.remoteClusters.edit.loadingLabel"
defaultMessage="Loading remote cluster…"
/>
</SectionLoading>
);
}

if (!cluster) {
return (
<EuiPageTemplate minHeight={0} panelled paddingSize="none" offset={0}>
<EuiPageTemplate.EmptyPrompt
iconType="warning"
color="danger"
title={
<h2>
<FormattedMessage
id="xpack.remoteClusters.edit.loadingErrorTitle"
defaultMessage="Error loading remote cluster"
/>
</h2>
}
body={
<p>
<FormattedMessage
id="xpack.remoteClusters.edit.loadingErrorMessage"
defaultMessage="The remote cluster '{name}' does not exist."
values={{ name: clusterName }}
/>
</p>
}
actions={
<EuiButton
{...reactRouterNavigate(this.props.history, '/list')}
color="danger"
iconType="arrowLeft"
flush="left"
>
<FormattedMessage
id="xpack.remoteClusters.edit.viewRemoteClustersButtonLabel"
defaultMessage="View remote clusters"
/>
</EuiButton>
}
/>
</EuiPageTemplate>
<EuiPageTemplate.EmptyPrompt
iconType="warning"
color="danger"
title={
<h2>
<FormattedMessage
id="xpack.remoteClusters.edit.loadingErrorTitle"
defaultMessage="Error loading remote cluster"
/>
</h2>
}
body={
<p>
<FormattedMessage
id="xpack.remoteClusters.edit.loadingErrorMessage"
defaultMessage="The remote cluster '{name}' does not exist."
values={{ name: clusterName }}
/>
</p>
}
actions={
<EuiButton
{...reactRouterNavigate(this.props.history, '/list')}
color="danger"
iconType="arrowLeft"
flush="left"
>
<FormattedMessage
id="xpack.remoteClusters.edit.viewRemoteClustersButtonLabel"
defaultMessage="View remote clusters"
/>
</EuiButton>
}
/>
);
}

const { isConfiguredByNode, hasDeprecatedProxySetting } = cluster;

if (isConfiguredByNode) {
return (
<EuiPageTemplate minHeight={0} panelled paddingSize="none" offset={0}>
<EuiPageTemplate.EmptyPrompt
iconType="iInCircle"
title={
<h2>
<FormattedMessage
id="xpack.remoteClusters.edit.configuredByNodeWarningTitle"
defaultMessage="Defined in configuration"
/>
</h2>
}
body={
<p>
<FormattedMessage
id="xpack.remoteClusters.configuredByNodeWarningBody"
defaultMessage="You can't edit or delete this remote cluster because it's defined in a node's
<EuiPageTemplate.EmptyPrompt
iconType="iInCircle"
title={
<h2>
<FormattedMessage
id="xpack.remoteClusters.edit.configuredByNodeWarningTitle"
defaultMessage="Defined in configuration"
/>
</h2>
}
body={
<p>
<FormattedMessage
id="xpack.remoteClusters.configuredByNodeWarningBody"
defaultMessage="You can't edit or delete this remote cluster because it's defined in a node's
elasticsearch.yml configuration file."
/>
</p>
}
actions={
<EuiButton color="primary" iconType="arrowLeft" flush="left" onClick={this.cancel}>
<FormattedMessage
id="xpack.remoteClusters.edit.backToRemoteClustersButtonLabel"
defaultMessage="Back to remote clusters"
/>
</EuiButton>
}
/>
</EuiPageTemplate>
/>
</p>
}
actions={
<EuiButton color="primary" iconType="arrowLeft" flush="left" onClick={this.cancel}>
<FormattedMessage
id="xpack.remoteClusters.edit.backToRemoteClustersButtonLabel"
defaultMessage="Back to remote clusters"
/>
</EuiButton>
}
/>
);
}

Expand Down
Loading

0 comments on commit f3a1e7f

Please sign in to comment.