Skip to content

Commit

Permalink
[ILM] Migrate all usages of EuiPage*_Deprecated (#163132)
Browse files Browse the repository at this point in the history
  • Loading branch information
gitstart authored Aug 22, 2023
1 parent 635eedb commit 5eeb3f7
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 157 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@

import React, { useEffect } from 'react';
import { RouteComponentProps } from 'react-router-dom';
import {
EuiButton,
EuiEmptyPrompt,
EuiLoadingSpinner,
EuiPageContent_Deprecated as EuiPageContent,
} from '@elastic/eui';
import { EuiButton, EuiLoadingSpinner, EuiPageTemplate } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';

import { MIN_SEARCHABLE_SNAPSHOT_LICENSE } from '../../../../common/constants';
Expand Down Expand Up @@ -45,47 +40,44 @@ export const EditPolicy: React.FunctionComponent<RouteComponentProps<RouterProps

if (isLoading) {
return (
<EuiPageContent verticalPosition="center" horizontalPosition="center" color="subdued">
<EuiEmptyPrompt
title={<EuiLoadingSpinner size="xl" />}
body={
<FormattedMessage
id="xpack.indexLifecycleMgmt.editPolicy.policiesLoading"
defaultMessage="Loading policies..."
/>
}
/>
</EuiPageContent>
<EuiPageTemplate.EmptyPrompt
title={<EuiLoadingSpinner size="xl" />}
body={
<FormattedMessage
id="xpack.indexLifecycleMgmt.editPolicy.policiesLoading"
defaultMessage="Loading policies..."
/>
}
/>
);
}
if (error || !policies) {
const { statusCode, message } = error ? error : { statusCode: '', message: '' };
return (
<EuiPageContent verticalPosition="center" horizontalPosition="center" color="danger">
<EuiEmptyPrompt
title={
<h2>
<FormattedMessage
id="xpack.indexLifecycleMgmt.editPolicy.lifecyclePoliciesLoadingFailedTitle"
defaultMessage="Unable to load existing lifecycle policies"
/>
</h2>
}
body={
<p>
{message} ({statusCode})
</p>
}
actions={
<EuiButton onClick={resendRequest} iconType="refresh" color="danger">
<FormattedMessage
id="xpack.indexLifecycleMgmt.editPolicy.lifecyclePoliciesReloadButton"
defaultMessage="Try again"
/>
</EuiButton>
}
/>
</EuiPageContent>
<EuiPageTemplate.EmptyPrompt
color="danger"
title={
<h2>
<FormattedMessage
id="xpack.indexLifecycleMgmt.editPolicy.lifecyclePoliciesLoadingFailedTitle"
defaultMessage="Unable to load existing lifecycle policies"
/>
</h2>
}
body={
<p>
{message} ({statusCode})
</p>
}
actions={
<EuiButton onClick={resendRequest} iconType="refresh" color="danger">
<FormattedMessage
id="xpack.indexLifecycleMgmt.editPolicy.lifecyclePoliciesReloadButton"
defaultMessage="Try again"
/>
</EuiButton>
}
/>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@
*/

import React, { useEffect } from 'react';
import {
EuiButton,
EuiEmptyPrompt,
EuiLoadingSpinner,
EuiPageContent_Deprecated as EuiPageContent,
} from '@elastic/eui';
import { EuiButton, EuiLoadingSpinner, EuiPageTemplate } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { PolicyList as PresentationComponent } from './policy_list';
import { useKibana } from '../../../shared_imports';
Expand All @@ -30,47 +25,44 @@ export const PolicyList: React.FunctionComponent = () => {

if (isLoading) {
return (
<EuiPageContent verticalPosition="center" horizontalPosition="center" color="subdued">
<EuiEmptyPrompt
title={<EuiLoadingSpinner size="xl" />}
body={
<FormattedMessage
id="xpack.indexLifecycleMgmt.policyTable.policiesLoading"
defaultMessage="Loading policies..."
/>
}
/>
</EuiPageContent>
<EuiPageTemplate.EmptyPrompt
title={<EuiLoadingSpinner size="xl" />}
body={
<FormattedMessage
id="xpack.indexLifecycleMgmt.policyTable.policiesLoading"
defaultMessage="Loading policies..."
/>
}
/>
);
}
if (error) {
const { statusCode, message } = error ? error : { statusCode: '', message: '' };
return (
<EuiPageContent verticalPosition="center" horizontalPosition="center" color="danger">
<EuiEmptyPrompt
title={
<h2>
<FormattedMessage
id="xpack.indexLifecycleMgmt.policyTable.policiesLoadingFailedTitle"
defaultMessage="Unable to load existing lifecycle policies"
/>
</h2>
}
body={
<p>
{message} ({statusCode})
</p>
}
actions={
<EuiButton onClick={resendRequest} iconType="refresh" color="danger">
<FormattedMessage
id="xpack.indexLifecycleMgmt.policyTable.policiesReloadButton"
defaultMessage="Try again"
/>
</EuiButton>
}
/>
</EuiPageContent>
<EuiPageTemplate.EmptyPrompt
color="danger"
title={
<h2>
<FormattedMessage
id="xpack.indexLifecycleMgmt.policyTable.policiesLoadingFailedTitle"
defaultMessage="Unable to load existing lifecycle policies"
/>
</h2>
}
body={
<p>
{message} ({statusCode})
</p>
}
actions={
<EuiButton onClick={resendRequest} iconType="refresh" color="danger">
<FormattedMessage
id="xpack.indexLifecycleMgmt.policyTable.policiesReloadButton"
defaultMessage="Try again"
/>
</EuiButton>
}
/>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@
import React, { Fragment } from 'react';
import { FormattedMessage } from '@kbn/i18n-react';

import {
EuiButton,
EuiEmptyPrompt,
EuiSpacer,
EuiPageHeader,
EuiPageContent_Deprecated as EuiPageContent,
} from '@elastic/eui';
import { EuiButton, EuiSpacer, EuiPageHeader, EuiPageTemplate } from '@elastic/eui';
import { useHistory } from 'react-router-dom';
import { reactRouterNavigate } from '@kbn/kibana-react-plugin/public';
import { PolicyFromES } from '../../../../common/types';
Expand Down Expand Up @@ -46,30 +40,28 @@ export const PolicyList: React.FunctionComponent<Props> = ({ policies, updatePol

if (policies.length === 0) {
return (
<EuiPageContent verticalPosition="center" horizontalPosition="center" color="subdued">
<EuiEmptyPrompt
iconType="managementApp"
title={
<h1>
<EuiPageTemplate.EmptyPrompt
iconType="managementApp"
title={
<h1>
<FormattedMessage
id="xpack.indexLifecycleMgmt.policyTable.emptyPromptTitle"
defaultMessage="Create your first index lifecycle policy"
/>
</h1>
}
body={
<Fragment>
<p>
<FormattedMessage
id="xpack.indexLifecycleMgmt.policyTable.emptyPromptTitle"
defaultMessage="Create your first index lifecycle policy"
id="xpack.indexLifecycleMgmt.policyTable.emptyPromptDescription"
defaultMessage=" An index lifecycle policy helps you manage your indices as they age."
/>
</h1>
}
body={
<Fragment>
<p>
<FormattedMessage
id="xpack.indexLifecycleMgmt.policyTable.emptyPromptDescription"
defaultMessage=" An index lifecycle policy helps you manage your indices as they age."
/>
</p>
</Fragment>
}
actions={createPolicyButton}
/>
</EuiPageContent>
</p>
</Fragment>
}
actions={createPolicyButton}
/>
);
}

Expand Down

0 comments on commit 5eeb3f7

Please sign in to comment.