Skip to content

Commit

Permalink
Address code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaindik committed Dec 13, 2024
1 parent 5722202 commit 354775d
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ import type {
} from '@kbn/securitysolution-io-ts-alerting-types';
import { ALERT_RISK_SCORE } from '@kbn/rule-data-utils';
import { requiredOptional } from '@kbn/zod-helpers';
import type { RuleResponse } from '../../../../../common/api/detection_engine/model/rule_schema';
import type {
BuildingBlockType,
RuleResponse,
} from '../../../../../common/api/detection_engine/model/rule_schema';
import { SeverityBadge } from '../../../../common/components/severity_badge';
import { defaultToEmptyTag } from '../../../../common/components/empty_value';
import { filterEmptyThreats } from '../../../rule_creation_ui/pages/rule_creation/helpers';
Expand Down Expand Up @@ -77,12 +80,12 @@ export const Author = ({ author }: AuthorProps) => (
);

interface BuildingBlockProps {
isBuildingBlockEnabled: boolean;
type: BuildingBlockType | undefined;
}

export const BuildingBlock = ({ isBuildingBlockEnabled }: BuildingBlockProps) => (
export const BuildingBlock = ({ type }: BuildingBlockProps) => (
<EuiText size="s" data-test-subj="buildingBlockPropertyValue">
{isBuildingBlockEnabled
{type
? i18n.BUILDING_BLOCK_ENABLED_FIELD_DESCRIPTION
: i18n.BUILDING_BLOCK_DISABLED_FIELD_DESCRIPTION}
</EuiText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as i18n from './translations';
export function EmptyFieldValuePlaceholder() {
return (
<EuiText size="s" color="subdued">
{`<${i18n.EMPTY_FIELD_VALUE_PLACEHOLDER}>`}
{i18n.EMPTY_FIELD_VALUE_PLACEHOLDER}
</EuiText>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import { i18n } from '@kbn/i18n';
export const EMPTY_FIELD_VALUE_PLACEHOLDER = i18n.translate(
'xpack.securitySolution.detectionEngine.rules.upgradeRules.emptyFieldValuePlaceholder',
{
defaultMessage: 'Field value is empty',
defaultMessage: '<Field value is empty>',
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function BuildingBlockReadOnly({ buildingBlock }: BuildingBlockReadOnlyPr
listItems={[
{
title: ruleDetailsI18n.BUILDING_BLOCK_FIELD_LABEL,
description: <BuildingBlock isBuildingBlockEnabled={Boolean(buildingBlock?.type)} />,
description: <BuildingBlock type={buildingBlock?.type} />,
},
]}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function NoteReadOnly({ note }: NoteReadOnlyProps) {
listItems={[
{
title: i18n.NOTE_LABEL,
description: note ? <Note note={note} /> : <EmptyFieldValuePlaceholder />,
description: note.trim() ? <Note note={note} /> : <EmptyFieldValuePlaceholder />,
},
]}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ export function RuleNameOverrideReadOnly({ ruleNameOverride }: RuleNameOverrideR
listItems={[
{
title: ruleDetailsI18n.RULE_NAME_OVERRIDE_FIELD_LABEL,
description:
ruleNameOverride && ruleNameOverride.field_name ? (
<RuleNameOverride ruleNameOverride={ruleNameOverride.field_name} />
) : (
<EmptyFieldValuePlaceholder />
),
description: ruleNameOverride?.field_name ? (
<RuleNameOverride ruleNameOverride={ruleNameOverride.field_name} />
) : (
<EmptyFieldValuePlaceholder />
),
},
]}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function SetupReadOnly({ setup }: SetupReadOnlyProps) {
listItems={[
{
title: ruleDetailsI18n.SETUP_GUIDE_SECTION_LABEL,
description: setup ? <Setup setup={setup} /> : <EmptyFieldValuePlaceholder />,
description: setup.trim() ? <Setup setup={setup} /> : <EmptyFieldValuePlaceholder />,
},
]}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ export function TimestampOverrideReadOnly({ timestampOverride }: TimestampOverri
listItems={[
{
title: ruleDetailsI18n.TIMESTAMP_OVERRIDE_FIELD_LABEL,
description:
timestampOverride && timestampOverride.field_name ? (
<TimestampOverride timestampOverride={timestampOverride.field_name} />
) : (
<EmptyFieldValuePlaceholder />
),
description: timestampOverride?.field_name ? (
<TimestampOverride timestampOverride={timestampOverride.field_name} />
) : (
<EmptyFieldValuePlaceholder />
),
},
]}
/>
Expand Down

0 comments on commit 354775d

Please sign in to comment.