Skip to content

Commit

Permalink
[Watcher] Migrate all usages of EuiPage*_Deprecated (#163128)
Browse files Browse the repository at this point in the history
## What does this PR do?
 *  Migrate all usages of EuiPage*_Deprecated in Watcher
 
## Issue References
 * #163070
 
## Video/Screenshot Demo


---
This code was written and reviewed by GitStart Community. Growing great
engineers, one PR at a time.

---------

Co-authored-by: LuisChiej <[email protected]>
Co-authored-by: gitstart_bot <[email protected]>
Co-authored-by: Yulia Cech <[email protected]>
  • Loading branch information
4 people authored Aug 22, 2023
1 parent dd8239f commit 34733be
Show file tree
Hide file tree
Showing 10 changed files with 125 additions and 155 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,13 +7,14 @@

import React from 'react';

import { EuiEmptyPrompt } from '@elastic/eui';
import { EuiPageTemplate } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';

export function PageErrorForbidden() {
return (
<EuiEmptyPrompt
<EuiPageTemplate.EmptyPrompt
iconType="warning"
color="danger"
title={
<h1>
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@

import React from 'react';

import { EuiEmptyPrompt } from '@elastic/eui';
import { EuiPageTemplate } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';

export function PageErrorNotExist({ id }: { id?: string }) {
return (
<EuiEmptyPrompt
<EuiPageTemplate.EmptyPrompt
iconType="warning"
color="danger"
title={
<h1>
<FormattedMessage
Expand Down
31 changes: 15 additions & 16 deletions x-pack/plugins/watcher/public/application/license_prompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import React from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import { EuiEmptyPrompt, EuiLink, EuiPageContent_Deprecated as EuiPageContent } from '@elastic/eui';
import { EuiLink, EuiPageTemplate } from '@elastic/eui';
import { LicenseManagementLocator } from '@kbn/license-management-plugin/public/locator';

export const LicensePrompt = ({
Expand Down Expand Up @@ -41,20 +41,19 @@ export const LicensePrompt = ({
</>
);
return (
<EuiPageContent verticalPosition="center" horizontalPosition="center" color="danger">
<EuiEmptyPrompt
iconType="warning"
title={
<h1>
<FormattedMessage
id="xpack.watcher.app.licenseErrorTitle"
defaultMessage="License error"
/>
</h1>
}
body={promptBody}
actions={[promptAction]}
/>
</EuiPageContent>
<EuiPageTemplate.EmptyPrompt
iconType="warning"
color="danger"
title={
<h1>
<FormattedMessage
id="xpack.watcher.app.licenseErrorTitle"
defaultMessage="License error"
/>
</h1>
}
body={promptBody}
actions={[promptAction]}
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@

import React, { useContext, useState } from 'react';

import {
EuiPageHeader,
EuiSpacer,
EuiPageContentBody_Deprecated as EuiPageContentBody,
} from '@elastic/eui';
import { EuiPageHeader, EuiSpacer, EuiPageSection } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { ExecuteDetails } from '../../../../models/execute_details';
import { getActionType } from '../../../../../../common/lib/get_action_type';
Expand Down Expand Up @@ -94,7 +90,7 @@ export const JsonWatchEdit = ({ pageTitle }: { pageTitle: string }) => {
);

return (
<EuiPageContentBody restrictWidth style={{ width: '100%' }}>
<EuiPageSection restrictWidth style={{ width: '100%' }}>
<EuiPageHeader
pageTitle={<span data-test-subj="pageTitle">{pageTitle}</span>}
bottomBorder
Expand Down Expand Up @@ -128,6 +124,6 @@ export const JsonWatchEdit = ({ pageTitle }: { pageTitle: string }) => {
)}

{selectedTab === WATCH_EDIT_TAB && <JsonWatchEditForm />}
</EuiPageContentBody>
</EuiPageSection>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import React, { useContext } from 'react';

import { EuiPageContent_Deprecated as EuiPageContent, EuiEmptyPrompt, EuiLink } from '@elastic/eui';
import { EuiLink, EuiPageTemplate } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { reactRouterNavigate } from '@kbn/kibana-react-plugin/public';
import { WatchContext } from '../../watch_context';
Expand All @@ -28,20 +28,18 @@ export const MonitoringWatchEdit = ({ pageTitle }: { pageTitle: string }) => {
);

return (
<EuiPageContent verticalPosition="center" horizontalPosition="center" color="subdued">
<EuiEmptyPrompt
iconType=""
title={<h1>{pageTitle}</h1>}
body={<p>{systemWatchMessage}</p>}
actions={[
<EuiLink {...reactRouterNavigate(history, `/watches/watch/${watch.id}/status`)}>
<FormattedMessage
id="xpack.watcher.sections.watchEdit.monitoring.header.watchLinkTitle"
defaultMessage="View watch status"
/>
</EuiLink>,
]}
/>
</EuiPageContent>
<EuiPageTemplate.EmptyPrompt
iconType=""
title={<h1>{pageTitle}</h1>}
body={<p>{systemWatchMessage}</p>}
actions={[
<EuiLink {...reactRouterNavigate(history, `/watches/watch/${watch.id}/status`)}>
<FormattedMessage
id="xpack.watcher.sections.watchEdit.monitoring.header.watchLinkTitle"
defaultMessage="View watch status"
/>
</EuiLink>,
]}
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
EuiText,
EuiTitle,
EuiPageHeader,
EuiPageContentBody_Deprecated as EuiPageContentBody,
EuiPageSection,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
Expand Down Expand Up @@ -236,7 +236,7 @@ export const ThresholdWatchEdit = ({ pageTitle }: { pageTitle: string }) => {
};

return (
<EuiPageContentBody restrictWidth style={{ width: '100%' }}>
<EuiPageSection restrictWidth style={{ width: '100%' }}>
<EuiPageHeader
pageTitle={<span data-test-subj="pageTitle">{pageTitle}</span>}
description={watch.titleDescription}
Expand Down Expand Up @@ -953,6 +953,6 @@ export const ThresholdWatchEdit = ({ pageTitle }: { pageTitle: string }) => {
close={() => setIsRequestVisible(false)}
/>
) : null}
</EuiPageContentBody>
</EuiPageSection>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import React, { useEffect, useReducer } from 'react';
import { isEqual } from 'lodash';

import { EuiPageContent_Deprecated as EuiPageContent } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';

import { EuiPageTemplate } from '@elastic/eui';
import { WATCH_TYPES } from '../../../../common/constants';
import { BaseWatch } from '../../../../common/types/watch_types';
import { getPageErrorCode, PageError, SectionLoading } from '../../components';
Expand Down Expand Up @@ -133,11 +133,7 @@ export const WatchEditPage = ({

const errorCode = getPageErrorCode(loadError);
if (errorCode) {
return (
<EuiPageContent verticalPosition="center" horizontalPosition="center" color="danger">
<PageError errorCode={errorCode} id={id} />
</EuiPageContent>
);
return <PageError errorCode={errorCode} id={id} />;
} else if (loadError) {
return (
<GenericPageError
Expand All @@ -154,14 +150,14 @@ export const WatchEditPage = ({

if (!watch) {
return (
<EuiPageContent verticalPosition="center" horizontalPosition="center" color="subdued">
<EuiPageTemplate.EmptyPrompt>
<SectionLoading>
<FormattedMessage
id="xpack.watcher.sections.watchEdit.loadingWatchDescription"
defaultMessage="Loading watch…"
/>
</SectionLoading>
</EuiPageContent>
</EuiPageTemplate.EmptyPrompt>
);
}

Expand Down
Loading

0 comments on commit 34733be

Please sign in to comment.