Skip to content

Commit

Permalink
addresses comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dplumlee committed Feb 12, 2024
1 parent 4f7171e commit 94b4cd8
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 69 deletions.
10 changes: 10 additions & 0 deletions x-pack/plugins/security_solution/common/experimental_features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ export const allowedExperimentalValues = Object.freeze({
* Enables experimental "Updates" tab in the prebuilt rule upgrade flyout.
* This tab shows the JSON diff between the installed prebuilt rule
* version and the latest available version.
*
* Ticket: https://github.com/elastic/kibana/issues/169160
* Owners: https://github.com/orgs/elastic/teams/security-detection-rule-management
* Added: on Dec 06, 2023 in https://github.com/elastic/kibana/pull/172535
* Turned: on Dec 20, 2023 in https://github.com/elastic/kibana/pull/173368
* Expires: on Feb 20, 2024
*/
jsonPrebuiltRulesDiffingEnabled: true,
/*
Expand All @@ -188,6 +194,10 @@ export const allowedExperimentalValues = Object.freeze({

/**
* Enables per-field rule diffs tab in the prebuilt rule upgrade flyout
*
* Ticket: https://github.com/elastic/kibana/issues/166489
* Owners: https://github.com/orgs/elastic/teams/security-detection-rule-management
* Added: on Feb 12, 2023 in https://github.com/elastic/kibana/pull/174564
*/
perFieldPrebuiltRulesDiffingEnabled: false,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ import type { DiffableAllFields } from '../../../../../common/api/detection_engi
export const DEFAULT_DESCRIPTION_LIST_COLUMN_WIDTHS: [string, string] = ['50%', '50%'];
export const LARGE_DESCRIPTION_LIST_COLUMN_WIDTHS: [string, string] = ['30%', '70%'];

/**
* This order is derived from a combination of the Rule Details Flyout display order
* and the `DiffableRule` type that is returned from the rule diff API endpoint
*/
export const UPGRADE_FIELD_ORDER: Array<keyof DiffableAllFields> = [
// Rule About fields
export const ABOUT_UPGRADE_FIELD_ORDER: Array<keyof DiffableAllFields> = [
'version',
'name',
'description',
Expand All @@ -33,59 +28,9 @@ export const UPGRADE_FIELD_ORDER: Array<keyof DiffableAllFields> = [
'threat_indicator_path',
'timestamp_override',
'tags',
// Rule Definition fields
'data_source',
'type',
'kql_query',
'eql_query',
'event_category_override',
'timestamp_field',
'tiebreaker_field',
'esql_query',
'anomaly_threshold',
'machine_learning_job_id',
'related_integrations',
'required_fields',
'timeline_template',
'threshold',
'threat_index',
'threat_mapping',
'threat_query',
'threat_indicator_path',
'concurrent_searches',
'items_per_search',
'alert_suppression',
'new_terms_fields',
'history_window_start',
'max_signals',
// Rule Schedule fields
'rule_schedule',
// Rule Setup fields
'setup',
'note',
];

export const ABOUT_UPGRADE_FIELD_ORDER = [
'version',
'name',
'description',
'author',
'building_block',
'severity',
'severity_mapping',
'risk_score',
'risk_score_mapping',
'references',
'false_positives',
'license',
'rule_name_override',
'threat',
'threat_indicator_path',
'timestamp_override',
'tags',
];

export const DEFINITION_UPGRADE_FIELD_ORDER = [
export const DEFINITION_UPGRADE_FIELD_ORDER: Array<keyof DiffableAllFields> = [
'data_source',
'type',
'kql_query',
Expand All @@ -102,7 +47,6 @@ export const DEFINITION_UPGRADE_FIELD_ORDER = [
'threshold',
'threat_index',
'threat_mapping',
'threat_filters',
'threat_query',
'threat_indicator_path',
'concurrent_searches',
Expand All @@ -113,6 +57,21 @@ export const DEFINITION_UPGRADE_FIELD_ORDER = [
'max_signals',
];

export const SCHEDULE_UPGRADE_FIELD_ORDER = ['rule_schedule'];
export const SCHEDULE_UPGRADE_FIELD_ORDER: Array<keyof DiffableAllFields> = ['rule_schedule'];

export const SETUP_UPGRADE_FIELD_ORDER = ['setup', 'note'];
export const SETUP_UPGRADE_FIELD_ORDER: Array<keyof DiffableAllFields> = ['setup', 'note'];

/**
* This order is derived from a combination of the Rule Details Flyout display order
* and the `DiffableRule` type that is returned from the rule diff API endpoint
*/
export const UPGRADE_FIELD_ORDER: Array<keyof DiffableAllFields> = [
// Rule About fields
...ABOUT_UPGRADE_FIELD_ORDER,
// Rule Definition fields
...DEFINITION_UPGRADE_FIELD_ORDER,
// Rule Schedule fields
...SCHEDULE_UPGRADE_FIELD_ORDER,
// Rule Setup fields
...SETUP_UPGRADE_FIELD_ORDER,
];
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,19 @@ export const UpgradePrebuiltRulesTableContextProvider = ({
},
]
: []),
{
id: 'jsonViewUpdates',
name: ruleDetailsI18n.JSON_VIEW_UPDATES_TAB_LABEL,
content: (
<TabContentPadding>
<RuleDiffTab oldRule={activeRule.current_rule} newRule={activeRule.target_rule} />
</TabContentPadding>
),
},
...(isJsonPrebuiltRulesDiffingEnabled
? [
{
id: 'jsonViewUpdates',
name: ruleDetailsI18n.JSON_VIEW_UPDATES_TAB_LABEL,
content: (
<TabContentPadding>
<RuleDiffTab oldRule={activeRule.current_rule} newRule={activeRule.target_rule} />
</TabContentPadding>
),
},
]
: []),
];
}, [
previewedRule,
Expand Down

0 comments on commit 94b4cd8

Please sign in to comment.