[Fleet] Remove usage of deprecated component EuiPageContent_Deprecated (#162390)

Fixes https://github.com/elastic/kibana/issues/161418

## Summary
Removing usage of deprecated component `EuiPageContent_Deprecated` and
replacing with `EuiPageSection`.

Also removed two unused components.

The two components look like this:

<img width="1001" alt="Screenshot 2023-07-20 at 17 03 05"
src="82798d53-30ae-455b-b0fc-216461f8d1b8">

<img width="1683" alt="Screenshot 2023-07-24 at 11 02 57"
src="f6ca00a5-49b3-481e-9152-d1f2a77d4495">


To display them, I simply hardcoded `true`
[here](59450f0a22/x-pack/plugins/fleet/public/applications/fleet/sections/agents/index.tsx (L60))
and
[here](59450f0a22/x-pack/plugins/fleet/public/applications/fleet/sections/agents/index.tsx (L66))

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Cristina Amico 2023-07-24 14:36:09 +02:00 committed by GitHub
parent 8fcd199d2a
commit cb54c98554
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 85 deletions

View file

@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import {
EuiPageBody,
EuiPageContent_Deprecated as EuiPageContent,
EuiPageSection,
EuiText,
EuiSpacer,
EuiIcon,
@ -22,6 +22,8 @@ import {
EuiLink,
} from '@elastic/eui';
import styled from 'styled-components';
import { WithoutHeaderLayout } from '../../../layouts';
import type { GetFleetStatusResponse } from '../../../types';
import { useStartServices } from '../../../hooks';
@ -48,15 +50,21 @@ export const RequirementItem: React.FunctionComponent<{ isMissing: boolean }> =
);
};
const borderColor = '#d3dae6';
const StyledPageBody = styled(EuiPageBody)`
border: 1px solid ${borderColor};
border-radius: 5px;
`;
export const MissingESRequirementsPage: React.FunctionComponent<{
missingRequirements: GetFleetStatusResponse['missing_requirements'];
}> = ({ missingRequirements }) => {
const { docLinks } = useStartServices();
return (
<WithoutHeaderLayout>
<EuiPageBody restrictWidth={820}>
<EuiPageContent hasBorder={true} hasShadow={false}>
<StyledPageBody restrictWidth={820}>
<EuiPageSection color="transparent">
<EuiCallOut
title={i18n.translate('xpack.fleet.setupPage.missingRequirementsCalloutTitle', {
defaultMessage: 'Missing security requirements',
@ -141,8 +149,8 @@ xpack.security.authc.api_key.enabled: true`}
),
}}
/>
</EuiPageContent>
</EuiPageBody>
</EuiPageSection>
</StyledPageBody>
</WithoutHeaderLayout>
);
};

View file

@ -5,36 +5,31 @@
* 2.0.
*/
import {
EuiEmptyPrompt,
EuiFlexGroup,
EuiFlexItem,
EuiPageContent_Deprecated as EuiPageContent,
} from '@elastic/eui';
import { EuiEmptyPrompt, EuiFlexGroup, EuiFlexItem, EuiPageSection } from '@elastic/eui';
import React from 'react';
import { withRouter } from 'react-router-dom';
interface LayoutProps {
title: string | React.ReactNode;
actionSection?: React.ReactNode;
modalClosePath?: string;
}
export const NoDataLayout: React.FunctionComponent<LayoutProps> = withRouter<
any,
React.FunctionComponent<LayoutProps>
>(({ actionSection, title, modalClosePath, children }: React.PropsWithChildren<LayoutProps>) => {
>(({ actionSection, title, children }: React.PropsWithChildren<LayoutProps>) => {
return (
<EuiFlexGroup justifyContent="spaceAround">
<EuiFlexItem grow={false}>
<EuiPageContent>
<EuiPageSection color="transparent">
<EuiEmptyPrompt
color="plain"
iconType="logoBeats"
title={<h2>{title}</h2>}
body={children}
actions={actionSection}
/>
</EuiPageContent>
</EuiPageSection>
</EuiFlexItem>
</EuiFlexGroup>
);

View file

@ -1,28 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React from 'react';
import { FormattedMessage, injectI18n } from '@kbn/i18n-react';
import { NoDataLayout } from './components/no_data_layout';
export const EnforceSecurityPage = injectI18n(({ intl }) => (
<NoDataLayout
title={intl.formatMessage({
id: 'xpack.fleet.disabledSecurityTitle',
defaultMessage: 'Security is not enabled',
})}
actionSection={[]}
>
<p>
<FormattedMessage
id="xpack.fleet.disabledSecurityDescription"
defaultMessage="You must enable security in Kibana and Elasticsearch to use Elastic Fleet."
/>
</p>
</NoDataLayout>
));

View file

@ -1,29 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React from 'react';
import { FormattedMessage, injectI18n } from '@kbn/i18n-react';
import { NoDataLayout } from './components/no_data_layout';
export const InvalidLicensePage = injectI18n(({ intl }) => (
<NoDataLayout
title={intl.formatMessage({
id: 'xpack.fleet.invalidLicenseTitle',
defaultMessage: 'Expired license',
})}
actionSection={[]}
>
<p>
<FormattedMessage
id="xpack.fleet.invalidLicenseDescription"
defaultMessage="Your current license is expired. Enrolled Beats Agents will continue to work, but you need a valid
license to access the Elastic Fleet interface."
/>
</p>
</NoDataLayout>
));

View file

@ -16371,8 +16371,6 @@
"xpack.fleet.deletePackagePolicy.failureSingleNotificationTitle": "Erreur lors de la suppression de l'intégration \"{id}\"",
"xpack.fleet.deletePackagePolicy.fatalErrorNotificationTitle": "Erreur lors de la suppression de l'intégration",
"xpack.fleet.deletePackagePolicy.successSingleNotificationTitle": "L'intégration \"{id}\" a été supprimée",
"xpack.fleet.disabledSecurityDescription": "Vous devez activer Security dans Kibana et Elasticsearch pour utiliser Elastic Fleet.",
"xpack.fleet.disabledSecurityTitle": "La fonctionnalité Security n'est pas activée",
"xpack.fleet.editAgentPolicy.cancelButtonText": "Annuler",
"xpack.fleet.editAgentPolicy.devtoolsRequestDescription": "Cette requête Kibana met à jour une politique d'agent.",
"xpack.fleet.editAgentPolicy.errorNotificationTitle": "Impossible de mettre à jour la stratégie d'agent",
@ -16665,8 +16663,6 @@
"xpack.fleet.integrations.updatePackage.upgradePoliciesCheckboxLabel": "Mettre à niveau les stratégies d'intégration",
"xpack.fleet.integrationsAppTitle": "Intégrations",
"xpack.fleet.integrationsHeaderTitle": "Intégrations",
"xpack.fleet.invalidLicenseDescription": "Votre licence actuelle a expiré. Les agents Beats enregistrés continuent à fonctionner, mais vous avez besoin d'une licence valide pour accéder à l'interface d'Elastic Fleet.",
"xpack.fleet.invalidLicenseTitle": "Licence expirée",
"xpack.fleet.multiRowInput.addAnotherUrl": "Ajouter une autre URL",
"xpack.fleet.multiRowInput.addRow": "Ajouter une ligne",
"xpack.fleet.multiRowInput.deleteButton": "Supprimer la ligne",

View file

@ -16384,8 +16384,6 @@
"xpack.fleet.deletePackagePolicy.failureSingleNotificationTitle": "統合「{id}」の削除エラー",
"xpack.fleet.deletePackagePolicy.fatalErrorNotificationTitle": "統合の削除エラー",
"xpack.fleet.deletePackagePolicy.successSingleNotificationTitle": "統合「{id}」を削除しました",
"xpack.fleet.disabledSecurityDescription": "Elastic Fleet を使用するには、Kibana と Elasticsearch でセキュリティを有効にする必要があります。",
"xpack.fleet.disabledSecurityTitle": "セキュリティが有効ではありません",
"xpack.fleet.editAgentPolicy.cancelButtonText": "キャンセル",
"xpack.fleet.editAgentPolicy.devtoolsRequestDescription": "このKibanaリクエストにより、エージェントポリシーが更新されます。",
"xpack.fleet.editAgentPolicy.errorNotificationTitle": "エージェントポリシーを更新できません",
@ -16678,8 +16676,6 @@
"xpack.fleet.integrations.updatePackage.upgradePoliciesCheckboxLabel": "統合ポリシーのアップグレード",
"xpack.fleet.integrationsAppTitle": "統合",
"xpack.fleet.integrationsHeaderTitle": "統合",
"xpack.fleet.invalidLicenseDescription": "現在のライセンスは期限切れです。登録されたビートエージェントは引き続き動作しますが、Elastic Fleetインターフェースにアクセスするには有効なライセンスが必要です。",
"xpack.fleet.invalidLicenseTitle": "ライセンスの期限切れ",
"xpack.fleet.multiRowInput.addAnotherUrl": "別のURLを追加",
"xpack.fleet.multiRowInput.addRow": "行の追加",
"xpack.fleet.multiRowInput.deleteButton": "行の削除",

View file

@ -16384,8 +16384,6 @@
"xpack.fleet.deletePackagePolicy.failureSingleNotificationTitle": "删除集成“{id}”时出错",
"xpack.fleet.deletePackagePolicy.fatalErrorNotificationTitle": "删除集成时出错",
"xpack.fleet.deletePackagePolicy.successSingleNotificationTitle": "已删除集成“{id}”",
"xpack.fleet.disabledSecurityDescription": "必须在 Kibana 和 Elasticsearch 启用安全性,才能使用 Elastic Fleet。",
"xpack.fleet.disabledSecurityTitle": "安全性未启用",
"xpack.fleet.editAgentPolicy.cancelButtonText": "取消",
"xpack.fleet.editAgentPolicy.devtoolsRequestDescription": "此 Kibana 请求将更新代理策略。",
"xpack.fleet.editAgentPolicy.errorNotificationTitle": "无法更新代理策略",
@ -16678,8 +16676,6 @@
"xpack.fleet.integrations.updatePackage.upgradePoliciesCheckboxLabel": "升级集成策略",
"xpack.fleet.integrationsAppTitle": "集成",
"xpack.fleet.integrationsHeaderTitle": "集成",
"xpack.fleet.invalidLicenseDescription": "您当前的许可证已过期。已注册 Beats 代理将继续工作,但您需要有效的许可证,才能访问 Elastic Fleet 界面。",
"xpack.fleet.invalidLicenseTitle": "已过期许可证",
"xpack.fleet.multiRowInput.addAnotherUrl": "添加另一个 URL",
"xpack.fleet.multiRowInput.addRow": "添加行",
"xpack.fleet.multiRowInput.deleteButton": "删除行",