Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Snapshot Restore] Migrate all usages of EuiPage*_Deprecated #163130

Merged
merged 10 commits into from
Aug 21, 2023
41 changes: 19 additions & 22 deletions x-pack/plugins/snapshot_restore/public/application/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import React from 'react';
import { Redirect } from 'react-router-dom';
import { Routes, Route } from '@kbn/shared-ux-router';
import { EuiPageContent_Deprecated as EuiPageContent } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';

import { APP_WRAPPER_CLASS } from '@kbn/core/public';
Expand Down Expand Up @@ -87,27 +86,25 @@ export const App: React.FunctionComponent = () => {
</Routes>
</div>
) : (
<EuiPageContent verticalPosition="center" horizontalPosition="center" color="subdued">
<NotAuthorizedSection
title={
<FormattedMessage
id="xpack.snapshotRestore.app.deniedPrivilegeTitle"
defaultMessage="You're missing cluster privileges"
/>
}
message={
<FormattedMessage
id="xpack.snapshotRestore.app.deniedPrivilegeDescription"
defaultMessage="To use Snapshot and Restore, you must have {privilegesCount,
plural, one {this cluster privilege} other {these cluster privileges}}: {missingPrivileges}."
values={{
missingPrivileges: privilegesMissing.cluster!.join(', '),
privilegesCount: privilegesMissing.cluster!.length,
}}
/>
}
/>
</EuiPageContent>
<NotAuthorizedSection
alisonelizabeth marked this conversation as resolved.
Show resolved Hide resolved
title={
<FormattedMessage
id="xpack.snapshotRestore.app.deniedPrivilegeTitle"
defaultMessage="You're missing cluster privileges"
/>
}
message={
<FormattedMessage
id="xpack.snapshotRestore.app.deniedPrivilegeDescription"
defaultMessage="To use Snapshot and Restore, you must have {privilegesCount,
plural, one {this cluster privilege} other {these cluster privileges}}: {missingPrivileges}."
values={{
missingPrivileges: privilegesMissing.cluster!.join(', '),
privilegesCount: privilegesMissing.cluster!.length,
}}
/>
}
/>
)
}
</WithPrivileges>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
EuiFlexGroup,
EuiFlexItem,
EuiTextColor,
EuiPageContent_Deprecated as EuiPageContent,
EuiPageTemplate,
} from '@elastic/eui';

interface Props {
Expand Down Expand Up @@ -55,12 +55,10 @@ export const SectionLoading: React.FunctionComponent<Props> = ({ children }) =>
*/
export const PageLoading: React.FunctionComponent<Props> = ({ children }) => {
return (
<EuiPageContent verticalPosition="center" horizontalPosition="center" color="subdued">
<EuiEmptyPrompt
title={<EuiLoadingSpinner size="xl" />}
body={<EuiText color="subdued">{children}</EuiText>}
data-test-subj="sectionLoading"
/>
</EuiPageContent>
<EuiPageTemplate.EmptyPrompt
title={<EuiLoadingSpinner size="xl" />}
body={<EuiText color="subdued">{children}</EuiText>}
data-test-subj="sectionLoading"
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@
import React, { Fragment, useEffect } from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import { RouteComponentProps } from 'react-router-dom';
import {
EuiPageContent_Deprecated as EuiPageContent,
EuiEmptyPrompt,
EuiButton,
EuiCallOut,
EuiSpacer,
} from '@elastic/eui';
import { EuiPageSection, EuiEmptyPrompt, EuiButton, EuiCallOut, EuiSpacer, EuiPageTemplate } from '@elastic/eui';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove unused imports

Suggested change
import { EuiPageSection, EuiEmptyPrompt, EuiButton, EuiCallOut, EuiSpacer, EuiPageTemplate } from '@elastic/eui';
import { EuiButton, EuiCallOut, EuiSpacer, EuiPageTemplate } from '@elastic/eui';


import { reactRouterNavigate } from '@kbn/kibana-react-plugin/public';

Expand Down Expand Up @@ -123,48 +117,41 @@ export const PolicyList: React.FunctionComponent<RouteComponentProps<MatchParams
);
} else if (policies && policies.length === 0) {
content = (
<EuiPageContent
hasShadow={false}
paddingSize="none"
verticalPosition="center"
horizontalPosition="center"
>
<EuiEmptyPrompt
iconType="managementApp"
title={
<h1>
<FormattedMessage
id="xpack.snapshotRestore.policyList.emptyPromptTitle"
defaultMessage="Create your first snapshot policy"
/>
</h1>
}
body={
<Fragment>
<p>
<FormattedMessage
id="xpack.snapshotRestore.policyList.emptyPromptDescription"
defaultMessage="A policy automates the creation and deletion of snapshots."
/>
</p>
</Fragment>
}
actions={
<EuiButton
{...reactRouterNavigate(history, linkToAddPolicy())}
fill
iconType="plusInCircle"
data-test-subj="createPolicyButton"
>
<EuiPageTemplate.EmptyPrompt
iconType="managementApp"
title={
<h1>
<FormattedMessage
id="xpack.snapshotRestore.policyList.emptyPromptTitle"
defaultMessage="Create your first snapshot policy"
/>
</h1>
}
body={
<Fragment>
<p>
<FormattedMessage
id="xpack.snapshotRestore.createPolicyButton"
defaultMessage="Create a policy"
id="xpack.snapshotRestore.policyList.emptyPromptDescription"
defaultMessage="A policy automates the creation and deletion of snapshots."
/>
</EuiButton>
}
data-test-subj="emptyPrompt"
/>
</EuiPageContent>
</p>
</Fragment>
}
actions={
<EuiButton
{...reactRouterNavigate(history, linkToAddPolicy())}
fill
iconType="plusInCircle"
data-test-subj="createPolicyButton"
>
<FormattedMessage
id="xpack.snapshotRestore.createPolicyButton"
defaultMessage="Create a policy"
/>
</EuiButton>
}
data-test-subj="emptyPrompt"
/>
);
} else {
const policySchedules = policies.map((policy: SlmPolicy) => policy.schedule);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
import React, { Fragment, useEffect } from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import { RouteComponentProps } from 'react-router-dom';
import {
EuiPageContent_Deprecated as EuiPageContent,
EuiButton,
EuiEmptyPrompt,
} from '@elastic/eui';
import { EuiButton, EuiPageTemplate } from '@elastic/eui';

import { reactRouterNavigate } from '@kbn/kibana-react-plugin/public';

Expand Down Expand Up @@ -102,48 +98,41 @@ export const RepositoryList: React.FunctionComponent<RouteComponentProps<MatchPa
);
} else if (repositories && repositories.length === 0) {
content = (
<EuiPageContent
hasShadow={false}
paddingSize="none"
verticalPosition="center"
horizontalPosition="center"
>
<EuiEmptyPrompt
iconType="managementApp"
title={
<h1>
<FormattedMessage
id="xpack.snapshotRestore.repositoryList.emptyPromptTitle"
defaultMessage="Register your first repository"
/>
</h1>
}
body={
<Fragment>
<p>
<FormattedMessage
id="xpack.snapshotRestore.repositoryList.emptyPromptDescription"
defaultMessage="Create a place where your snapshots will live."
/>
</p>
</Fragment>
}
actions={
<EuiButton
{...reactRouterNavigate(history, linkToAddRepository())}
fill
iconType="plusInCircle"
data-test-subj="registerRepositoryButton"
>
<EuiPageTemplate.EmptyPrompt
iconType="managementApp"
title={
<h1>
<FormattedMessage
id="xpack.snapshotRestore.repositoryList.emptyPromptTitle"
defaultMessage="Register your first repository"
/>
</h1>
}
body={
<Fragment>
<p>
<FormattedMessage
id="xpack.snapshotRestore.addRepositoryButtonLabel"
defaultMessage="Register a repository"
id="xpack.snapshotRestore.repositoryList.emptyPromptDescription"
defaultMessage="Create a place where your snapshots will live."
/>
</EuiButton>
}
data-test-subj="emptyPrompt"
/>
</EuiPageContent>
</p>
</Fragment>
}
actions={
<EuiButton
{...reactRouterNavigate(history, linkToAddRepository())}
fill
iconType="plusInCircle"
data-test-subj="registerRepositoryButton"
>
<FormattedMessage
id="xpack.snapshotRestore.addRepositoryButtonLabel"
defaultMessage="Register a repository"
/>
</EuiButton>
}
data-test-subj="emptyPrompt"
/>
);
} else {
content = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import React, { useEffect, useState, Fragment } from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import {
EuiPageContent_Deprecated as EuiPageContent,
EuiPageSection,
EuiEmptyPrompt,
EuiPopover,
EuiButtonEmpty,
Expand All @@ -19,6 +19,7 @@ import {
EuiSpacer,
EuiLoadingSpinner,
EuiLink,
EuiPageTemplate,
} from '@elastic/eui';
import { reactRouterNavigate } from '@kbn/kibana-react-plugin/public';
import { APP_RESTORE_INDEX_PRIVILEGES } from '../../../../../common';
Expand Down Expand Up @@ -106,45 +107,38 @@ export const RestoreList: React.FunctionComponent = () => {
} else {
if (restores && restores.length === 0) {
content = (
<EuiPageContent
hasShadow={false}
paddingSize="none"
verticalPosition="center"
horizontalPosition="center"
>
<EuiEmptyPrompt
iconType="managementApp"
title={
<h1 data-test-subj="noRestoredSnapshotsHeader">
<EuiPageTemplate.EmptyPrompt
iconType="managementApp"
title={
<h1 data-test-subj="noRestoredSnapshotsHeader">
<FormattedMessage
id="xpack.snapshotRestore.restoreList.emptyPromptTitle"
defaultMessage="No restored snapshots"
/>
</h1>
}
body={
<Fragment>
<p>
<FormattedMessage
id="xpack.snapshotRestore.restoreList.emptyPromptTitle"
defaultMessage="No restored snapshots"
id="xpack.snapshotRestore.restoreList.emptyPromptDescription"
defaultMessage="Go to {snapshotsLink} to start a restore."
values={{
snapshotsLink: (
<EuiLink {...reactRouterNavigate(history, linkToSnapshots())}>
<FormattedMessage
id="xpack.snapshotRestore.restoreList.emptyPromptDescriptionLink"
defaultMessage="Snapshots"
/>
</EuiLink>
),
}}
/>
</h1>
}
body={
<Fragment>
<p>
<FormattedMessage
id="xpack.snapshotRestore.restoreList.emptyPromptDescription"
defaultMessage="Go to {snapshotsLink} to start a restore."
values={{
snapshotsLink: (
<EuiLink {...reactRouterNavigate(history, linkToSnapshots())}>
<FormattedMessage
id="xpack.snapshotRestore.restoreList.emptyPromptDescriptionLink"
defaultMessage="Snapshots"
/>
</EuiLink>
),
}}
/>
</p>
</Fragment>
}
data-test-subj="emptyPrompt"
/>
</EuiPageContent>
</p>
</Fragment>
}
data-test-subj="emptyPrompt"
/>
);
} else {
content = (
Expand Down
Loading