Skip to content

Commit

Permalink
[SECURITY_SOLUTION] Reused the naming scheme for field column in cond…
Browse files Browse the repository at this point in the history
…itions table. (elastic#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 <[email protected]>
Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
3 people authored and kevinlog committed Oct 6, 2020
1 parent deb61f6 commit 324deab
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -72,17 +73,11 @@ export const ConditionEntry = memo<ConditionEntryProps>(
const fieldOptions = useMemo<Array<EuiSuperSelectOption<string>>>(() => {
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',
},
];
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import React, { memo, useCallback, useMemo } from 'react';
import { EuiTableFieldDataColumnType } from '@elastic/eui';

import { i18n } from '@kbn/i18n';
import {
Immutable,
TrustedApp,
Expand All @@ -27,6 +28,7 @@ import {
PROPERTY_TITLES,
ENTRY_PROPERTY_TITLES,
CARD_DELETE_BUTTON_LABEL,
CONDITION_FIELD_TITLE,
} from '../../translations';

type Entry = MacosLinuxConditionEntry | WindowsConditionEntry;
Expand All @@ -47,13 +49,21 @@ const getEntriesColumnDefinitions = (): Array<EuiTableFieldDataColumnType<Entry>
truncateText: true,
textOnly: true,
width: '30%',
render(field: MacosLinuxConditionEntry['field'], entry: Entry) {
return CONDITION_FIELD_TITLE[field];
},
},
{
field: 'operator',
name: ENTRY_PROPERTY_TITLES.operator,
sortable: false,
truncateText: true,
width: '20%',
render() {
return i18n.translate('xpack.securitySolution.trustedapps.card.operator.includes', {
defaultMessage: 'is',
});
},
},
{
field: 'value',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<TrustedApp, 'id' | 'entries'>]: string }
> = {
Expand Down

0 comments on commit 324deab

Please sign in to comment.