From 383a912f17fc65a9fea87577ad0ded9e22932dc5 Mon Sep 17 00:00:00 2001 From: Bohdan Tsymbala Date: Tue, 6 Oct 2020 23:31:27 +0200 Subject: [PATCH] [SECURITY_SOLUTION] Reused the naming scheme for field column in conditions table. (#79722) * Reused the naming scheme for field column in conditions table. * Updated snapshot. * update Operator value to show as `is` * Update Jest snapshot Co-authored-by: Paul Tavares Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../logical_condition/components/condition_entry.tsx | 11 +++-------- .../__snapshots__/index.test.tsx.snap | 4 ++++ .../view/components/trusted_app_card/index.tsx | 10 ++++++++++ .../pages/trusted_apps/view/translations.ts | 11 +++++++++++ 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/logical_condition/components/condition_entry.tsx b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/logical_condition/components/condition_entry.tsx index 55d0622c3f9a9..020ab3f1cf1fd 100644 --- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/logical_condition/components/condition_entry.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/logical_condition/components/condition_entry.tsx @@ -16,6 +16,7 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { TrustedApp } from '../../../../../../../../common/endpoint/types'; +import { CONDITION_FIELD_TITLE } from '../../../translations'; const ConditionEntryCell = memo<{ showLabel: boolean; @@ -72,17 +73,11 @@ export const ConditionEntry = memo( const fieldOptions = useMemo>>(() => { return [ { - inputDisplay: i18n.translate( - 'xpack.securitySolution.trustedapps.logicalConditionBuilder.entry.field.hash', - { defaultMessage: 'Hash' } - ), + inputDisplay: CONDITION_FIELD_TITLE['process.hash.*'], value: 'process.hash.*', }, { - inputDisplay: i18n.translate( - 'xpack.securitySolution.trustedapps.logicalConditionBuilder.entry.field.path', - { defaultMessage: 'Path' } - ), + inputDisplay: CONDITION_FIELD_TITLE['process.executable.caseless'], value: 'process.executable.caseless', }, ]; diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/trusted_app_card/__snapshots__/index.test.tsx.snap b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/trusted_app_card/__snapshots__/index.test.tsx.snap index c5a10c740ec7e..8f04fa0a7133a 100644 --- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/trusted_app_card/__snapshots__/index.test.tsx.snap +++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/trusted_app_card/__snapshots__/index.test.tsx.snap @@ -36,6 +36,7 @@ exports[`trusted_app_card TrustedAppCard should render correctly 1`] = ` Object { "field": "field", "name": "Field", + "render": [Function], "sortable": false, "textOnly": true, "truncateText": true, @@ -44,6 +45,7 @@ exports[`trusted_app_card TrustedAppCard should render correctly 1`] = ` Object { "field": "operator", "name": "Operator", + "render": [Function], "sortable": false, "truncateText": true, "width": "20%", @@ -107,6 +109,7 @@ exports[`trusted_app_card TrustedAppCard should trim long descriptions 1`] = ` Object { "field": "field", "name": "Field", + "render": [Function], "sortable": false, "textOnly": true, "truncateText": true, @@ -115,6 +118,7 @@ exports[`trusted_app_card TrustedAppCard should trim long descriptions 1`] = ` Object { "field": "operator", "name": "Operator", + "render": [Function], "sortable": false, "truncateText": true, "width": "20%", diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/trusted_app_card/index.tsx b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/trusted_app_card/index.tsx index 438331b706cc3..e31ff9e3b313b 100644 --- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/trusted_app_card/index.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/trusted_app_card/index.tsx @@ -7,6 +7,7 @@ import React, { memo, useCallback, useMemo } from 'react'; import { EuiTableFieldDataColumnType } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; import { Immutable, TrustedApp, @@ -27,6 +28,7 @@ import { PROPERTY_TITLES, ENTRY_PROPERTY_TITLES, CARD_DELETE_BUTTON_LABEL, + CONDITION_FIELD_TITLE, } from '../../translations'; type Entry = MacosLinuxConditionEntry | WindowsConditionEntry; @@ -47,6 +49,9 @@ const getEntriesColumnDefinitions = (): Array truncateText: true, textOnly: true, width: '30%', + render(field: MacosLinuxConditionEntry['field'], entry: Entry) { + return CONDITION_FIELD_TITLE[field]; + }, }, { field: 'operator', @@ -54,6 +59,11 @@ const getEntriesColumnDefinitions = (): Array sortable: false, truncateText: true, width: '20%', + render() { + return i18n.translate('xpack.securitySolution.trustedapps.card.operator.includes', { + defaultMessage: 'is', + }); + }, }, { field: 'value', diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/translations.ts b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/translations.ts index c6990159943e6..b442704169d06 100644 --- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/translations.ts +++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/translations.ts @@ -28,6 +28,17 @@ export const OS_TITLES: Readonly<{ [K in TrustedApp['os']]: string }> = { }), }; +export const CONDITION_FIELD_TITLE: { [K in MacosLinuxConditionEntry['field']]: string } = { + 'process.hash.*': i18n.translate( + 'xpack.securitySolution.trustedapps.logicalConditionBuilder.entry.field.hash', + { defaultMessage: 'Hash' } + ), + 'process.executable.caseless': i18n.translate( + 'xpack.securitySolution.trustedapps.logicalConditionBuilder.entry.field.path', + { defaultMessage: 'Path' } + ), +}; + export const PROPERTY_TITLES: Readonly< { [K in keyof Omit]: string } > = {