From a38093a55ef6fdb91b0f09c5f9ff1bdc9cfa7b5c Mon Sep 17 00:00:00 2001 From: Bohdan Tsymbala Date: Tue, 6 Oct 2020 19:15:01 +0200 Subject: [PATCH 1/4] Reused the naming scheme for field column in conditions table. --- .../logical_condition/components/condition_entry.tsx | 11 +++-------- .../view/components/trusted_app_card/index.tsx | 4 ++++ .../pages/trusted_apps/view/translations.ts | 11 +++++++++++ 3 files changed, 18 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/index.tsx b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/trusted_app_card/index.tsx index 438331b706cc3..30fe5f1468504 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 @@ -27,6 +27,7 @@ import { PROPERTY_TITLES, ENTRY_PROPERTY_TITLES, CARD_DELETE_BUTTON_LABEL, + CONDITION_FIELD_TITLE, } from '../../translations'; type Entry = MacosLinuxConditionEntry | WindowsConditionEntry; @@ -47,6 +48,9 @@ const getEntriesColumnDefinitions = (): Array truncateText: true, textOnly: true, width: '30%', + render(field: MacosLinuxConditionEntry['field'], entry: Entry) { + return CONDITION_FIELD_TITLE[field]; + }, }, { field: 'operator', 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 } > = { From c28c3f3c8d3d9f8ab58d49fbfbf7b2aa1fe0ae14 Mon Sep 17 00:00:00 2001 From: Bohdan Tsymbala Date: Tue, 6 Oct 2020 19:19:51 +0200 Subject: [PATCH 2/4] Updated snapshot. --- .../trusted_app_card/__snapshots__/index.test.tsx.snap | 2 ++ 1 file changed, 2 insertions(+) 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..903c25cdd0476 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, @@ -107,6 +108,7 @@ exports[`trusted_app_card TrustedAppCard should trim long descriptions 1`] = ` Object { "field": "field", "name": "Field", + "render": [Function], "sortable": false, "textOnly": true, "truncateText": true, From 652c40f6b84d88767262229f6c60372c4f752ca9 Mon Sep 17 00:00:00 2001 From: Paul Tavares Date: Tue, 6 Oct 2020 14:41:05 -0400 Subject: [PATCH 3/4] update Operator value to show as `is` --- .../trusted_apps/view/components/trusted_app_card/index.tsx | 6 ++++++ 1 file changed, 6 insertions(+) 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 30fe5f1468504..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, @@ -58,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', From 4b5e99c43bcd3955299b043912a27d3ec7b937df Mon Sep 17 00:00:00 2001 From: Paul Tavares Date: Tue, 6 Oct 2020 15:10:21 -0400 Subject: [PATCH 4/4] Update Jest snapshot --- .../trusted_app_card/__snapshots__/index.test.tsx.snap | 2 ++ 1 file changed, 2 insertions(+) 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 903c25cdd0476..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 @@ -45,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%", @@ -117,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%",