Skip to content

Commit

Permalink
new component for popup version
Browse files Browse the repository at this point in the history
  • Loading branch information
parkiino committed Oct 26, 2020
1 parent 8fb2a9f commit 9644f13
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,25 @@ const ProtectionRadio = React.memo(({ id, label }: { id: ProtectionModes; label:

ProtectionRadio.displayName = 'ProtectionRadio';

const SupportedVersionNotice = ({ optionName }: { optionName: string }) => {
const version = popupVersionsMap.get(optionName);
if (!version) {
return null;
}

return (
<EuiText color="subdued" size="xs">
<i>
<FormattedMessage
id="xpack.securitySolution.endpoint.policyDetails.supportedVersion"
defaultMessage="Endpoint version {version}"
values={{ version }}
/>
</i>
</EuiText>
);
};

/** The Malware Protections form for policy details
* which will configure for all relevant OSes.
*/
Expand Down Expand Up @@ -191,9 +210,7 @@ export const MalwareProtections = React.memo(() => {
/>
</h6>
</EuiTitle>
<EuiText color="subdued" size="xs">
<i>{`Endpoint versions ${popupVersionsMap.get('malware')}`}</i>
</EuiText>
<SupportedVersionNotice optionName="malware" />
<EuiSpacer size="s" />
<EuiCheckbox
id="xpack.securitySolution.endpoint.policyDetail.malware.userNotification"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { i18n } from '@kbn/i18n';
const popupVersions: Array<[string, string]> = [['malware', '7.11+']];

const popupVersions: Array<[string, string]> = [
[
'malware',
i18n.translate('xpack.securitySolution.endpoint.policyDetails.popup.version.7.11', {
defaultMessage: '7.11+',
}),
],
];

export const popupVersionsMap = new Map<string, string>(popupVersions);
export const popupVersionsMap: ReadonlyMap<string, string> = new Map<string, string>(popupVersions);

0 comments on commit 9644f13

Please sign in to comment.