[Security Solution] Display a correct label for memory and behavior protections (#107724)

This commit is contained in:
Esteban Beltran 2021-08-10 09:54:08 +02:00 committed by GitHub
parent 6008b5ae55
commit 04260d30a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 40 additions and 9 deletions

View file

@ -24,9 +24,11 @@ import { PolicyProtection, MacPolicyProtection, LinuxPolicyProtection } from '..
export const ProtectionSwitch = React.memo(
({
protection,
protectionLabel,
osList,
}: {
protection: PolicyProtection;
protectionLabel?: string;
osList: ImmutableArray<Partial<keyof UIPolicyConfig>>;
}) => {
const policyDetailsConfig = usePolicyDetailsSelector(policyConfig);
@ -93,10 +95,9 @@ export const ProtectionSwitch = React.memo(
return (
<EuiSwitch
label={i18n.translate('xpack.securitySolution.endpoint.policy.details.protectionsEnabled', {
defaultMessage:
'{protectionName} protections {mode, select, true {enabled} false {disabled}}',
defaultMessage: '{protectionLabel} {mode, select, true {enabled} false {disabled}}',
values: {
protectionName: protection.charAt(0).toUpperCase() + protection.substring(1),
protectionLabel,
mode: selected !== ProtectionModes.off,
},
})}

View file

@ -25,6 +25,12 @@ import { SecurityPageName } from '../../../../../../app/types';
export const BehaviorProtection = React.memo(() => {
const OSes: Immutable<BehaviorProtectionOSes[]> = [OS.windows, OS.mac, OS.linux];
const protection = 'behavior_protection';
const protectionLabel = i18n.translate(
'xpack.securitySolution.endpoint.policy.protections.behavior',
{
defaultMessage: 'Behaviour protections',
}
);
return (
<ConfigForm
type={i18n.translate('xpack.securitySolution.endpoint.policy.details.behavior_protection', {
@ -32,7 +38,9 @@ export const BehaviorProtection = React.memo(() => {
})}
supportedOss={[OperatingSystem.WINDOWS, OperatingSystem.MAC, OperatingSystem.LINUX]}
dataTestSubj="behaviorProtectionsForm"
rightCorner={<ProtectionSwitch protection={protection} osList={OSes} />}
rightCorner={
<ProtectionSwitch protection={protection} protectionLabel={protectionLabel} osList={OSes} />
}
>
<RadioButtons protection={protection} osList={OSes} />
<UserNotification protection={protection} osList={OSes} />

View file

@ -26,6 +26,12 @@ import { ProtectionSwitch } from '../components/protection_switch';
export const MalwareProtections = React.memo(() => {
const OSes: Immutable<MalwareProtectionOSes[]> = [OS.windows, OS.mac, OS.linux];
const protection = 'malware';
const protectionLabel = i18n.translate(
'xpack.securitySolution.endpoint.policy.protections.malware',
{
defaultMessage: 'Malware protections',
}
);
const isPlatinumPlus = useLicense().isPlatinumPlus();
return (
@ -35,7 +41,9 @@ export const MalwareProtections = React.memo(() => {
})}
supportedOss={[OperatingSystem.WINDOWS, OperatingSystem.MAC, OperatingSystem.LINUX]}
dataTestSubj="malwareProtectionsForm"
rightCorner={<ProtectionSwitch protection={protection} osList={OSes} />}
rightCorner={
<ProtectionSwitch protection={protection} protectionLabel={protectionLabel} osList={OSes} />
}
>
<RadioButtons protection={protection} osList={OSes} />
{isPlatinumPlus && <UserNotification protection={protection} osList={OSes} />}

View file

@ -25,6 +25,12 @@ import { ProtectionSwitch } from '../components/protection_switch';
export const MemoryProtection = React.memo(() => {
const OSes: Immutable<MemoryProtectionOSes[]> = [OS.windows];
const protection = 'memory_protection';
const protectionLabel = i18n.translate(
'xpack.securitySolution.endpoint.policy.protections.memory',
{
defaultMessage: 'Memory protections',
}
);
return (
<ConfigForm
type={i18n.translate('xpack.securitySolution.endpoint.policy.details.memory_protection', {
@ -32,7 +38,9 @@ export const MemoryProtection = React.memo(() => {
})}
supportedOss={[OperatingSystem.WINDOWS]}
dataTestSubj="memoryProtectionsForm"
rightCorner={<ProtectionSwitch protection={protection} osList={OSes} />}
rightCorner={
<ProtectionSwitch protection={protection} protectionLabel={protectionLabel} osList={OSes} />
}
>
<RadioButtons protection={protection} osList={OSes} />
<UserNotification protection={protection} osList={OSes} />

View file

@ -25,6 +25,12 @@ import { ProtectionSwitch } from '../components/protection_switch';
export const Ransomware = React.memo(() => {
const OSes: Immutable<RansomwareProtectionOSes[]> = [OS.windows];
const protection = 'ransomware';
const protectionLabel = i18n.translate(
'xpack.securitySolution.endpoint.policy.protections.ransomware',
{
defaultMessage: 'Ransomware protections',
}
);
return (
<ConfigForm
@ -33,7 +39,9 @@ export const Ransomware = React.memo(() => {
})}
supportedOss={[OperatingSystem.WINDOWS]}
dataTestSubj="ransomwareProtectionsForm"
rightCorner={<ProtectionSwitch protection={protection} osList={OSes} />}
rightCorner={
<ProtectionSwitch protectionLabel={protectionLabel} protection={protection} osList={OSes} />
}
>
<RadioButtons protection={protection} osList={OSes} />
<UserNotification protection={protection} osList={OSes} />

View file

@ -21527,7 +21527,6 @@
"xpack.securitySolution.endpoint.policy.details.platinum": "プラチナ",
"xpack.securitySolution.endpoint.policy.details.prevent": "防御",
"xpack.securitySolution.endpoint.policy.details.protections": "保護",
"xpack.securitySolution.endpoint.policy.details.protectionsEnabled": "{protectionName}保護は{mode, select, true {有効です} false {無効です}}",
"xpack.securitySolution.endpoint.policy.details.ransomware": "ランサムウェア",
"xpack.securitySolution.endpoint.policy.details.save": "保存",
"xpack.securitySolution.endpoint.policy.details.settings": "設定",

View file

@ -22013,7 +22013,6 @@
"xpack.securitySolution.endpoint.policy.details.platinum": "白金级",
"xpack.securitySolution.endpoint.policy.details.prevent": "防御",
"xpack.securitySolution.endpoint.policy.details.protections": "防护",
"xpack.securitySolution.endpoint.policy.details.protectionsEnabled": "{protectionName}防护{mode, select, true {已启用} false {已禁用}}",
"xpack.securitySolution.endpoint.policy.details.ransomware": "勒索软件",
"xpack.securitySolution.endpoint.policy.details.save": "保存",
"xpack.securitySolution.endpoint.policy.details.settings": "设置",