Skip to content

Commit

Permalink
[Security Solution][Endpoint][Admin][Policy] Register as AV os restri…
Browse files Browse the repository at this point in the history
…ctions tooltip note (#93306) (#93689)
  • Loading branch information
parkiino authored Mar 4, 2021
1 parent 94e5c49 commit eeeabc7
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@ export const AntivirusRegistrationForm = memo(() => {
);

return (
<ConfigForm type={TRANSLATIONS.title} supportedOss={[OperatingSystem.WINDOWS]}>
<ConfigForm
type={TRANSLATIONS.title}
supportedOss={[OperatingSystem.WINDOWS]}
osRestriction={i18n.translate(
'xpack.securitySolution.endpoint.policy.details.av.windowsServerNotSupported',
{ defaultMessage: 'Windows Server operating systems unsupported' }
)}
>
<EuiText size="s">{TRANSLATIONS.description}</EuiText>
<EuiSpacer size="s" />
<EuiSwitch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import React, { FC, ReactNode, memo } from 'react';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import {
EuiFlexGroup,
EuiFlexItem,
Expand All @@ -15,6 +16,8 @@ import {
EuiText,
EuiShowFor,
EuiPanel,
EuiTextColor,
EuiIconTip,
} from '@elastic/eui';

import { OperatingSystem } from '../../../../../../../common/endpoint/types';
Expand All @@ -38,6 +41,7 @@ interface ConfigFormProps {
* Types of supported operating systems.
*/
supportedOss: OperatingSystem[];
osRestriction?: ReactNode;
dataTestSubj?: string;
/** React Node to be put on the right corner of the card */
rightCorner?: ReactNode;
Expand All @@ -52,19 +56,40 @@ export const ConfigFormHeading: FC = memo(({ children }) => (
ConfigFormHeading.displayName = 'ConfigFormHeading';

export const ConfigForm: FC<ConfigFormProps> = memo(
({ type, supportedOss, dataTestSubj, rightCorner, children }) => (
({ type, supportedOss, osRestriction, dataTestSubj, rightCorner, children }) => (
<EuiPanel data-test-subj={dataTestSubj}>
<EuiFlexGroup direction="row" gutterSize="none" alignItems="center">
<EuiFlexItem>
<EuiFlexItem grow={2}>
<ConfigFormHeading>{TITLES.type}</ConfigFormHeading>
<EuiText size="m">{type}</EuiText>
</EuiFlexItem>
<EuiFlexItem grow={2}>
<ConfigFormHeading>{TITLES.os}</ConfigFormHeading>
<EuiText>{supportedOss.map((os) => OS_TITLES[os]).join(', ')}</EuiText>
<EuiFlexGroup direction="row" gutterSize="s" alignItems="center">
<EuiFlexItem grow={false}>
<EuiText>{supportedOss.map((os) => OS_TITLES[os]).join(', ')} </EuiText>
</EuiFlexItem>
{osRestriction && (
<EuiFlexItem grow={false}>
<EuiFlexGroup direction="row" gutterSize="xs">
<EuiFlexItem grow={false}>
<EuiTextColor color="subdued">
<FormattedMessage
id="xpack.securitySolution.endpoint.policy.details.antivirusRegistration.osRestriction"
defaultMessage="Restrictions"
/>
</EuiTextColor>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiIconTip type="iInCircle" color="subdued" content={osRestriction} />
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
)}
</EuiFlexGroup>
</EuiFlexItem>
<EuiShowFor sizes={['m', 'l', 'xl']}>
<EuiFlexItem grow={2}>
<EuiFlexItem grow={3}>
<EuiFlexGroup direction="row" gutterSize="none" justifyContent="flexEnd">
<EuiFlexItem grow={false}>{rightCorner}</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ describe('Policy Details', () => {
const userNotificationCustomMessageTextArea = policyView.find(
'EuiTextArea[data-test-subj="malwareUserNotificationCustomMessage"]'
);
const tooltip = policyView.find('EuiIconTip');
const tooltip = policyView.find('EuiIconTip[data-test-subj="malwareTooltip"]');
expect(userNotificationCheckbox).toHaveLength(0);
expect(userNotificationCustomMessageTextArea).toHaveLength(0);
expect(tooltip).toHaveLength(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,14 @@ export const MalwareProtections = React.memo(() => {
</ConfigFormHeading>
<EuiSpacer size="xs" />
<RadioFlexGroup>
<EuiFlexItem className="no-right-margin-radio" grow={1}>
<EuiFlexItem className="no-right-margin-radio" grow={2}>
<ProtectionRadio
protectionMode={radios[0].id}
key={radios[0].protection + radios[0].id}
label={radios[0].label}
/>
</EuiFlexItem>
<EuiFlexItem className="no-horizontal-margin-radio" grow={4}>
<EuiFlexItem className="no-horizontal-margin-radio" grow={5}>
<ProtectionRadio
protectionMode={radios[1].id}
key={radios[1].protection + radios[1].id}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,14 @@ export const Ransomware = React.memo(() => {
</ConfigFormHeading>
<EuiSpacer size="xs" />
<RadioFlexGroup>
<EuiFlexItem className="no-right-margin-radio" grow={1}>
<EuiFlexItem className="no-right-margin-radio" grow={2}>
<ProtectionRadio
protectionMode={radios[0].id}
key={radios[0].protection + radios[0].id}
label={radios[0].label}
/>
</EuiFlexItem>
<EuiFlexItem className="no-horizontal-margin-radio" grow={4}>
<EuiFlexItem className="no-horizontal-margin-radio" grow={5}>
<ProtectionRadio
protectionMode={radios[1].id}
key={radios[1].protection + radios[1].id}
Expand Down

0 comments on commit eeeabc7

Please sign in to comment.