From 34733bef94147c50e607fe734821865ad053888b Mon Sep 17 00:00:00 2001
From: GitStart <1501599+gitstart@users.noreply.github.com>
Date: Tue, 22 Aug 2023 14:16:32 +0100
Subject: [PATCH] [Watcher] Migrate all usages of EuiPage*_Deprecated (#163128)
## What does this PR do?
* Migrate all usages of EuiPage*_Deprecated in Watcher
## Issue References
* https://github.com/elastic/kibana/issues/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 <54555805+LuisChiej@users.noreply.github.com>
Co-authored-by: gitstart_bot
Co-authored-by: Yulia Cech
---
.../license_prompt.test.tsx.snap | 124 ++++++++----------
.../page_error/page_error_forbidden.tsx | 5 +-
.../page_error/page_error_not_exist.tsx | 5 +-
.../public/application/license_prompt.tsx | 31 +++--
.../json_watch_edit/json_watch_edit.tsx | 10 +-
.../monitoring_watch_edit.tsx | 30 ++---
.../threshold_watch_edit.tsx | 6 +-
.../watch_edit_page/watch_edit_page.tsx | 12 +-
.../watch_list_page/watch_list_page.tsx | 45 +++----
.../watch_status_page/watch_status_page.tsx | 12 +-
10 files changed, 125 insertions(+), 155 deletions(-)
diff --git a/x-pack/plugins/watcher/__jest__/__snapshots__/license_prompt.test.tsx.snap b/x-pack/plugins/watcher/__jest__/__snapshots__/license_prompt.test.tsx.snap
index 7d3768c237574..419a83d62c9b8 100644
--- a/x-pack/plugins/watcher/__jest__/__snapshots__/license_prompt.test.tsx.snap
+++ b/x-pack/plugins/watcher/__jest__/__snapshots__/license_prompt.test.tsx.snap
@@ -1,80 +1,70 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`License prompt renders a prompt with a link to License Management 1`] = `
-
-
-
- ,
- ]
- }
- body={
-
- License error
-
- }
- iconType="warning"
- title={
-
+<_EuiPageEmptyPrompt
+ actions={
+ Array [
+
-
- }
- />
-
+ ,
+ ]
+ }
+ body={
+
+ License error
+
+ }
+ color="danger"
+ iconType="warning"
+ title={
+
+
+
+ }
+/>
`;
exports[`License prompt renders a prompt without a link to License Management 1`] = `
-
-
-
- License error
-
-
-
-
-
- }
- iconType="warning"
- title={
-
+<_EuiPageEmptyPrompt
+ actions={
+ Array [
+ undefined,
+ ]
+ }
+ body={
+
+
+ License error
+
+
-
- }
- />
-
+
+
+ }
+ color="danger"
+ iconType="warning"
+ title={
+
+
+
+ }
+/>
`;
diff --git a/x-pack/plugins/watcher/public/application/components/page_error/page_error_forbidden.tsx b/x-pack/plugins/watcher/public/application/components/page_error/page_error_forbidden.tsx
index 883f6f1401c7a..12a02318a6c7d 100644
--- a/x-pack/plugins/watcher/public/application/components/page_error/page_error_forbidden.tsx
+++ b/x-pack/plugins/watcher/public/application/components/page_error/page_error_forbidden.tsx
@@ -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 (
-
);
return (
-
-
-
-
- }
- body={promptBody}
- actions={[promptAction]}
- />
-
+
+
+
+ }
+ body={promptBody}
+ actions={[promptAction]}
+ />
);
};
diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/json_watch_edit/json_watch_edit.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/json_watch_edit/json_watch_edit.tsx
index fe54e48ce5f1d..66be8a0298bde 100644
--- a/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/json_watch_edit/json_watch_edit.tsx
+++ b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/json_watch_edit/json_watch_edit.tsx
@@ -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';
@@ -94,7 +90,7 @@ export const JsonWatchEdit = ({ pageTitle }: { pageTitle: string }) => {
);
return (
-
+
{pageTitle}}
bottomBorder
@@ -128,6 +124,6 @@ export const JsonWatchEdit = ({ pageTitle }: { pageTitle: string }) => {
)}
{selectedTab === WATCH_EDIT_TAB && }
-
+
);
};
diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/monitoring_watch_edit/monitoring_watch_edit.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/monitoring_watch_edit/monitoring_watch_edit.tsx
index efbc56033d12a..d330aa4f41e5d 100644
--- a/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/monitoring_watch_edit/monitoring_watch_edit.tsx
+++ b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/monitoring_watch_edit/monitoring_watch_edit.tsx
@@ -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';
@@ -28,20 +28,18 @@ export const MonitoringWatchEdit = ({ pageTitle }: { pageTitle: string }) => {
);
return (
-
- {pageTitle}}
- body={{systemWatchMessage}
}
- actions={[
-
-
- ,
- ]}
- />
-
+ {pageTitle}}
+ body={{systemWatchMessage}
}
+ actions={[
+
+
+ ,
+ ]}
+ />
);
};
diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/threshold_watch_edit.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/threshold_watch_edit.tsx
index 2934cc67cb8a0..9ebb0d8170fbe 100644
--- a/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/threshold_watch_edit.tsx
+++ b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/components/threshold_watch_edit/threshold_watch_edit.tsx
@@ -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';
@@ -236,7 +236,7 @@ export const ThresholdWatchEdit = ({ pageTitle }: { pageTitle: string }) => {
};
return (
-
+
{pageTitle}}
description={watch.titleDescription}
@@ -953,6 +953,6 @@ export const ThresholdWatchEdit = ({ pageTitle }: { pageTitle: string }) => {
close={() => setIsRequestVisible(false)}
/>
) : null}
-
+
);
};
diff --git a/x-pack/plugins/watcher/public/application/sections/watch_edit_page/watch_edit_page.tsx b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/watch_edit_page.tsx
index 1c543d167d642..e2adfe25ea197 100644
--- a/x-pack/plugins/watcher/public/application/sections/watch_edit_page/watch_edit_page.tsx
+++ b/x-pack/plugins/watcher/public/application/sections/watch_edit_page/watch_edit_page.tsx
@@ -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';
@@ -133,11 +133,7 @@ export const WatchEditPage = ({
const errorCode = getPageErrorCode(loadError);
if (errorCode) {
- return (
-
-
-
- );
+ return ;
} else if (loadError) {
return (
+
-
+
);
}
diff --git a/x-pack/plugins/watcher/public/application/sections/watch_list_page/watch_list_page.tsx b/x-pack/plugins/watcher/public/application/sections/watch_list_page/watch_list_page.tsx
index d2a60fcce5f28..76a8328fb532a 100644
--- a/x-pack/plugins/watcher/public/application/sections/watch_list_page/watch_list_page.tsx
+++ b/x-pack/plugins/watcher/public/application/sections/watch_list_page/watch_list_page.tsx
@@ -11,20 +11,19 @@ import {
CriteriaWithPagination,
EuiButton,
EuiButtonEmpty,
+ EuiCallOut,
EuiInMemoryTable,
EuiIcon,
EuiLink,
- EuiPageContent_Deprecated as EuiPageContent,
- EuiCallOut,
EuiSpacer,
EuiText,
EuiToolTip,
- EuiEmptyPrompt,
EuiButtonIcon,
EuiPopover,
EuiContextMenuPanel,
EuiContextMenuItem,
EuiPageHeader,
+ EuiPageTemplate,
EuiSearchBarOnChangeArgs,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
@@ -178,24 +177,20 @@ export const WatchListPage = () => {
if (isWatchesLoading) {
return (
-
+
-
+
);
}
const errorCode = getPageErrorCode(error);
if (errorCode) {
- return (
-
-
-
- );
+ return ;
} else if (error) {
return (
{
);
return (
-
-
-
-
- }
- body={emptyPromptBody}
- actions={createWatchContextMenu}
- data-test-subj="emptyPrompt"
- />
-
+
+
+
+ }
+ body={emptyPromptBody}
+ actions={createWatchContextMenu}
+ data-test-subj="emptyPrompt"
+ />
);
}
diff --git a/x-pack/plugins/watcher/public/application/sections/watch_status_page/watch_status_page.tsx b/x-pack/plugins/watcher/public/application/sections/watch_status_page/watch_status_page.tsx
index f20e4cae114e2..fd423a4f00788 100644
--- a/x-pack/plugins/watcher/public/application/sections/watch_status_page/watch_status_page.tsx
+++ b/x-pack/plugins/watcher/public/application/sections/watch_status_page/watch_status_page.tsx
@@ -7,12 +7,12 @@
import React, { useEffect, useState } from 'react';
import {
- EuiPageContent_Deprecated as EuiPageContent,
EuiSpacer,
EuiToolTip,
EuiBadge,
EuiButtonEmpty,
EuiPageHeader,
+ EuiPageTemplate,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
@@ -77,23 +77,19 @@ export const WatchStatusPage = ({
if (isWatchDetailLoading) {
return (
-
+
-
+
);
}
if (errorCode) {
- return (
-
-
-
- );
+ return ;
}
if (watchDetail) {