From b4248465cd6ec63932ba774928c00dd2616aed83 Mon Sep 17 00:00:00 2001 From: Candace Park <56409205+parkiino@users.noreply.github.com> Date: Fri, 5 Feb 2021 13:57:42 -0500 Subject: [PATCH] [Security Solution][Endpoint][Admin] Locked ransomware card (#90210) * [Security Solution][Endpoint][Admin] Locked card for ransomware policy --- .../pages/policy/view/policy_details.test.tsx | 5 ++ .../pages/policy/view/policy_details_form.tsx | 3 +- .../policy/view/policy_forms/locked_card.tsx | 82 +++++++++++++++++++ 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/locked_card.tsx diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.test.tsx index 154e26dd0f38..1ae4144a2683 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details.test.tsx @@ -336,6 +336,11 @@ describe('Policy Details', () => { const ransomware = policyView.find('EuiPanel[data-test-subj="ransomwareProtectionsForm"]'); expect(ransomware).toHaveLength(0); }); + + it('shows the locked card in place of 1 paid feature', () => { + const lockedCard = policyView.find('EuiCard[data-test-subj="lockedPolicyCard"]'); + expect(lockedCard).toHaveLength(1); + }); }); }); }); diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details_form.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details_form.tsx index aa1d62c2e143..528f3afc1e64 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details_form.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_details_form.tsx @@ -13,6 +13,7 @@ import { LinuxEvents, MacEvents, WindowsEvents } from './policy_forms/events'; import { AdvancedPolicyForms } from './policy_advanced'; import { AntivirusRegistrationForm } from './components/antivirus_registration_form'; import { Ransomware } from './policy_forms/protections/ransomware'; +import { LockedPolicyCard } from './policy_forms/locked_card'; import { useLicense } from '../../../../common/hooks/use_license'; export const PolicyDetailsForm = memo(() => { @@ -36,7 +37,7 @@ export const PolicyDetailsForm = memo(() => { - {isPlatinumPlus && } + {isPlatinumPlus ? : } diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/locked_card.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/locked_card.tsx new file mode 100644 index 000000000000..5c19a1030760 --- /dev/null +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/locked_card.tsx @@ -0,0 +1,82 @@ +/* + * 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, { memo } from 'react'; +import { EuiCard, EuiIcon, EuiTextColor, EuiLink, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; +import styled from 'styled-components'; +import { i18n } from '@kbn/i18n'; + +const LockedPolicyDiv = styled.div` + .euiCard__betaBadgeWrapper { + .euiCard__betaBadge { + width: auto; + } + } + .lockedCardDescription { + padding: 0 ${(props) => props.theme.eui.fractions.thirds.percentage}; + } +`; + +export const LockedPolicyCard = memo(() => { + return ( + + } + title={ +

+ + + +

+ } + description={ + + +

+ + + +

+
+ +

+ + + + ), + }} + /> +

+
+
+ } + /> +
+ ); +}); +LockedPolicyCard.displayName = 'LockedPolicyCard';