Skip to content

Commit c92899e

Browse files
authored
[Rules migration] Allow partial RuleResponse object to be passed to RuleOverviewTab (elastic#204318)
## Summary These changes allow `Partial<RuleResponse>` to be used as a parameter for `RuleOverviewTab` component. We re-use this component for "SIEM Migrations" feature to display translated state of the rule which has just a few fields that represent the `RuleResponse` object. The set of fields used in `RuleMigration` object is a minimum set of fields enough for the rule creation. Right now, `RuleOverviewTab` component requires the complete `RuleResponse` object to be passed even though internally each section (`RuleAboutSection`, `RuleDefinitionSection`, `RuleScheduleSection` and `RuleSetupGuideSection`) of the rule's overview expects `Partial<RuleResponse>`. To be able to use this component we force type casting at the moment and would like to get rid of it. @elastic/security-detection-rule-management do you have objects regarding this change in `RuleOverviewTab` intefrace? ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - Rule management cypress tests ([100 ESS & 100 Serverless](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7601))
1 parent 73066e8 commit c92899e

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

  • x-pack/plugins/security_solution/public

x-pack/plugins/security_solution/public/detection_engine/rule_management/components/rule_details/rule_overview_tab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const ExpandableSection = ({ title, isOpen, toggle, children }: ExpandableSectio
8888
};
8989

9090
interface RuleOverviewTabProps {
91-
rule: RuleResponse;
91+
rule: Partial<RuleResponse>;
9292
columnWidths?: EuiDescriptionListProps['columnWidths'];
9393
expandedOverviewSections: Record<keyof typeof defaultOverviewOpenSections, boolean>;
9494
toggleOverviewSection: Record<keyof typeof defaultOverviewOpenSections, () => void>;

x-pack/plugins/security_solution/public/siem_migrations/rules/components/rule_details_flyout/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export const MigrationRuleDetailsFlyout: React.FC<MigrationRuleDetailsFlyoutProp
126126
const ruleDetailsToOverview = useMemo(() => {
127127
const elasticRule = ruleMigration?.elastic_rule;
128128
if (isMigrationCustomRule(elasticRule)) {
129-
return convertMigrationCustomRuleToSecurityRulePayload(elasticRule, false) as RuleResponse; // TODO: we need to adjust RuleOverviewTab to allow partial RuleResponse as a parameter;
129+
return convertMigrationCustomRuleToSecurityRulePayload(elasticRule, false);
130130
}
131131
return matchedPrebuiltRule;
132132
}, [ruleMigration, matchedPrebuiltRule]);

0 commit comments

Comments
 (0)