-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Single list of rule types in observability without grouping #166772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
maryam-saeidi
merged 11 commits into
elastic:main
from
maryam-saeidi:166136-rule-type-list
Oct 2, 2023
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d57bc12
Add hideGrouping prop to the rule_form to use it in observability
maryam-saeidi 5fa38a3
Merge branch 'main' into 166136-rule-type-list
maryam-saeidi 0940575
Extract RuleTypeGroup type
maryam-saeidi 2d360df
Merge branch 'main' into 166136-rule-type-list
maryam-saeidi 1db57ae
Merge branch 'main' into 166136-rule-type-list
maryam-saeidi e074a75
Merge branch 'main' into 166136-rule-type-list
maryam-saeidi 9b66126
Merge branch 'main' into 166136-rule-type-list
maryam-saeidi e0dd008
Merge branch 'main' into 166136-rule-type-list
maryam-saeidi d87614f
Merge branch 'main' into 166136-rule-type-list
maryam-saeidi 803611f
Merge branch 'main' into 166136-rule-type-list
maryam-saeidi 639f683
Merge branch 'main' into 166136-rule-type-list
maryam-saeidi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,25 +8,19 @@ | |
| import { RuleTypeModel } from '../../types'; | ||
| import { IsEnabledResult, IsDisabledResult } from './check_rule_type_enabled'; | ||
|
|
||
| export type RuleTypeGroup = [ | ||
| string, | ||
| Array<{ | ||
| id: string; | ||
| name: string; | ||
| checkEnabledResult: IsEnabledResult | IsDisabledResult; | ||
| ruleTypeItem: RuleTypeModel; | ||
| }> | ||
| ]; | ||
|
|
||
| export function ruleTypeGroupCompare( | ||
| left: [ | ||
| string, | ||
| Array<{ | ||
| id: string; | ||
| name: string; | ||
| checkEnabledResult: IsEnabledResult | IsDisabledResult; | ||
| ruleTypeItem: RuleTypeModel; | ||
| }> | ||
| ], | ||
| right: [ | ||
| string, | ||
| Array<{ | ||
| id: string; | ||
| name: string; | ||
| checkEnabledResult: IsEnabledResult | IsDisabledResult; | ||
| ruleTypeItem: RuleTypeModel; | ||
| }> | ||
| ], | ||
| left: RuleTypeGroup, | ||
| right: RuleTypeGroup, | ||
| groupNames: Map<string, string> | undefined | ||
| ) { | ||
| const groupNameA = left[0]; | ||
|
|
@@ -54,6 +48,35 @@ export function ruleTypeGroupCompare( | |
| : groupNameA.localeCompare(groupNameB); | ||
| } | ||
|
|
||
| export function ruleTypeUngroupedCompare( | ||
| left: RuleTypeGroup, | ||
| right: RuleTypeGroup, | ||
| ruleTypes?: string[] | ||
| ) { | ||
| const leftRuleTypesList = left[1]; | ||
| const rightRuleTypesList = right[1]; | ||
|
|
||
| const hasEnabledRuleTypeInListLeft = | ||
| leftRuleTypesList.find((ruleTypeItem) => ruleTypeItem.checkEnabledResult.isEnabled) !== | ||
| undefined; | ||
|
|
||
| const hasEnabledRuleTypeInListRight = | ||
| rightRuleTypesList.find((ruleTypeItem) => ruleTypeItem.checkEnabledResult.isEnabled) !== | ||
| undefined; | ||
|
|
||
| if (hasEnabledRuleTypeInListLeft && !hasEnabledRuleTypeInListRight) { | ||
| return -1; | ||
| } | ||
| if (!hasEnabledRuleTypeInListLeft && hasEnabledRuleTypeInListRight) { | ||
| return 1; | ||
| } | ||
|
|
||
| return ruleTypes | ||
| ? ruleTypes.findIndex((frtA) => leftRuleTypesList.some((aRuleType) => aRuleType.id === frtA)) - | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Credit goes to @XavierM |
||
| ruleTypes.findIndex((frtB) => rightRuleTypesList.some((bRuleType) => bRuleType.id === frtB)) | ||
| : 0; | ||
| } | ||
|
|
||
| export function ruleTypeCompare( | ||
| a: { | ||
| id: string; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This priority will be used to order the rule type list in observability. You can check the priorities assigned to each rule in the issue.