[8.11] [Remote clusters] Fix empty states (#169015) (#169173)

# Backport

This will backport the following commits from `main` to `8.11`:
- [[Remote clusters] Fix empty states
(#169015)](https://github.com/elastic/kibana/pull/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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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>
This commit is contained in:
Kibana Machine 2023-10-17 17:52:00 -04:00 committed by GitHub
parent 36da4cc35e
commit f3a1e7f0e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 173 additions and 182 deletions

View file

@ -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>
@ -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'}
/>
);
};

View file

@ -96,55 +96,51 @@ 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>
}
/>
);
}
@ -152,36 +148,34 @@ export class RemoteClusterEdit extends Component {
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>
}
/>
);
}

View file

@ -93,28 +93,26 @@ export class RemoteClusterList extends Component {
renderNoPermission() {
return (
<EuiPageTemplate minHeight={0} panelled paddingSize="none" offset={0}>
<EuiPageTemplate.EmptyPrompt
iconType="warning"
color="danger"
title={
<h2>
<FormattedMessage
id="xpack.remoteClusters.remoteClusterList.noPermissionTitle"
defaultMessage="Permission error"
/>
</h2>
}
body={
<p>
<FormattedMessage
id="xpack.remoteClusters.remoteClusterList.noPermissionText"
defaultMessage="You do not have permission to view or add remote clusters."
/>
</p>
}
/>
</EuiPageTemplate>
<EuiPageTemplate.EmptyPrompt
iconType="warning"
color="danger"
title={
<h2>
<FormattedMessage
id="xpack.remoteClusters.remoteClusterList.noPermissionTitle"
defaultMessage="Permission error"
/>
</h2>
}
body={
<p>
<FormattedMessage
id="xpack.remoteClusters.remoteClusterList.noPermissionText"
defaultMessage="You do not have permission to view or add remote clusters."
/>
</p>
}
/>
);
}
@ -124,103 +122,91 @@ export class RemoteClusterList extends Component {
const { statusCode, error: errorString } = error.body;
return (
<EuiPageTemplate minHeight={0} panelled paddingSize="none" offset={0}>
<EuiPageTemplate.EmptyPrompt
iconType="warning"
color="danger"
title={
<h2>
<FormattedMessage
id="xpack.remoteClusters.remoteClusterList.loadingErrorTitle"
defaultMessage="Error loading remote clusters"
/>
</h2>
}
body={
<p>
{statusCode} {errorString}
</p>
}
/>
</EuiPageTemplate>
<EuiPageTemplate.EmptyPrompt
iconType="warning"
color="danger"
title={
<h2>
<FormattedMessage
id="xpack.remoteClusters.remoteClusterList.loadingErrorTitle"
defaultMessage="Error loading remote clusters"
/>
</h2>
}
body={
<p>
{statusCode} {errorString}
</p>
}
/>
);
}
renderEmpty() {
return (
<EuiPageTemplate minHeight={0} panelled paddingSize="none" offset={0}>
<EuiPageTemplate.EmptyPrompt
data-test-subj="remoteClusterListEmptyPrompt"
iconType="managementApp"
title={
<h2>
<FormattedMessage
id="xpack.remoteClusters.remoteClusterList.emptyPromptTitle"
defaultMessage="Add your first remote cluster"
/>
</h2>
}
body={
<p>
<FormattedMessage
id="xpack.remoteClusters.remoteClusterList.emptyPromptDescription"
defaultMessage="Remote clusters create a uni-directional connection from your
<EuiPageTemplate.EmptyPrompt
data-test-subj="remoteClusterListEmptyPrompt"
iconType="managementApp"
title={
<h2>
<FormattedMessage
id="xpack.remoteClusters.remoteClusterList.emptyPromptTitle"
defaultMessage="Add your first remote cluster"
/>
</h2>
}
body={
<p>
<FormattedMessage
id="xpack.remoteClusters.remoteClusterList.emptyPromptDescription"
defaultMessage="Remote clusters create a uni-directional connection from your
local cluster to other clusters."
/>
</p>
}
actions={
<EuiButton
{...reactRouterNavigate(this.props.history, '/add')}
fill
iconType="plusInCircle"
data-test-subj="remoteClusterEmptyPromptCreateButton"
>
<FormattedMessage
id="xpack.remoteClusters.remoteClusterList.emptyPrompt.connectButtonLabel"
defaultMessage="Add a remote cluster"
/>
</EuiButton>
}
footer={
<>
<EuiTitle size="xxs">
<span>
<FormattedMessage
id="xpack.remoteClusters.remoteClusters.emptyState.docsDescription"
defaultMessage="Want to learn more?"
/>
</span>
</EuiTitle>{' '}
<EuiLink href={remoteClustersUrl} target="_blank">
/>
</p>
}
actions={
<EuiButton
{...reactRouterNavigate(this.props.history, '/add')}
fill
iconType="plusInCircle"
data-test-subj="remoteClusterEmptyPromptCreateButton"
>
<FormattedMessage
id="xpack.remoteClusters.remoteClusterList.emptyPrompt.connectButtonLabel"
defaultMessage="Add a remote cluster"
/>
</EuiButton>
}
footer={
<>
<EuiTitle size="xxs">
<span>
<FormattedMessage
id="xpack.remoteClusters.remoteClusters.emptyState.docsLink"
defaultMessage="Read documentation"
id="xpack.remoteClusters.remoteClusters.emptyState.docsDescription"
defaultMessage="Want to learn more?"
/>
</EuiLink>
</>
}
/>
</EuiPageTemplate>
</span>
</EuiTitle>{' '}
<EuiLink href={remoteClustersUrl} target="_blank">
<FormattedMessage
id="xpack.remoteClusters.remoteClusters.emptyState.docsLink"
defaultMessage="Read documentation"
/>
</EuiLink>
</>
}
/>
);
}
renderLoading() {
return (
<EuiPageTemplate
minHeight={0}
panelled
paddingSize="none"
offset={0}
data-test-subj="remoteClustersTableLoading"
>
<SectionLoading>
<FormattedMessage
id="xpack.remoteClusters.remoteClusterList.loadingTitle"
defaultMessage="Loading remote clusters…"
/>
</SectionLoading>
</EuiPageTemplate>
<SectionLoading data-test-subj="remoteClustersTableLoading">
<FormattedMessage
id="xpack.remoteClusters.remoteClusterList.loadingTitle"
defaultMessage="Loading remote clusters…"
/>
</SectionLoading>
);
}