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

[Security Solution][Endpoint][Admin][Policy] Register as AV os restrictions tooltip note #93306

Merged
merged 10 commits into from
Mar 4, 2021
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