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

[Watcher] Migrate all usages of EuiPage*_Deprecated #163128

Merged
merged 6 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

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
Copy link
Contributor

Choose a reason for hiding this comment

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

Verified ✅
Screenshot 2023-08-22 at 13 11 02

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
Copy link
Contributor

Choose a reason for hiding this comment

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

Verified ✅
Screenshot 2023-08-22 at 13 13 08

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
Copy link
Contributor

Choose a reason for hiding this comment

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

Verified ✅
Screenshot 2023-08-22 at 13 14 05

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%' }}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Verified ✅
Screenshot 2023-08-22 at 13 16 01

<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
Copy link
Contributor

Choose a reason for hiding this comment

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

didn't verify this visually since I'm not sure, monitoring watches are still in use. The code changes LGTM

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%' }}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Verified ✅
Screenshot 2023-08-22 at 13 17 38

<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} />;
Copy link
Contributor

Choose a reason for hiding this comment

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

Verified ✅
Screenshot 2023-08-22 at 13 29 44

} 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>
Copy link
Contributor

Choose a reason for hiding this comment

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

Added EuiPageTemplate.EmptyPrompt otherwise the loading prompt doesn't have the color.
Screenshot 2023-08-22 at 13 33 51

<SectionLoading>
<FormattedMessage
id="xpack.watcher.sections.watchEdit.loadingWatchDescription"
defaultMessage="Loading watch…"
/>
</SectionLoading>
</EuiPageContent>
</EuiPageTemplate.EmptyPrompt>
);
}

Expand Down
Loading