forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SecuritySolution] Fix building block alert highlighting (elastic#155497
) ## Summary As described in elastic#152318, we noticed that building block alerts were not highlighted anymore after the migration to the new alerts table. A preferred implementation of building block alert highlighting would follow the [`EUIDataGrid` approach of row highlighting](https://eui.elastic.co/#/tabular-content/data-grid-style-display#grid-row-classes). The `DataGrid` allows you to pass custom CSS class names for each row (`gridStyle.rowClasses`). That would allow us to highlight table rows with building block alerts. However, without access to the underlying data, we would not be able generate the correct `rowClasses` for rows with building block alerts. So simply passing `gridStyle.rowClasses` to the `AlertsStateTable` was not an option. Therefore in this PR we're introducing a new prop on the `AlertsTable`, the `highlightedRowMapper`. It's a callback function that receives the alert data and when it returns true, that row will be highlighted. This allows for highlighting of rows from the outside without exposing too many details about the underlying data structures. **Screenshot of the alerts table with a highlightedRowMapper that highlights building block alerts** <img width="1259" alt="Screenshot 2023-04-21 at 13 03 54" src="https://user-images.githubusercontent.com/68591/233620704-a56204c0-e285-4289-897a-58481f440446.png"> ### Additional notes - Since the alerts table has default grid styles, it allows to pass `gridStyle` and it computes its own `rowClasses` for "active row" highlighting, the logic for merging all those styles looks intimidating. I tried my best to comment that part of code to make it clear why the merges are necessary and how they work. - While working on the issue, I noticed that active rows are not highlighted anymore (related bug: elastic#155487). The changes in this PR fix that behaviour as well as you can see in the screenshot below: <img width="936" alt="Screenshot 2023-04-21 at 13 04 15" src="https://user-images.githubusercontent.com/68591/233620752-d752dada-9c97-4f00-933a-5425e19a5793.png"> ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Kibana Machine <[email protected]> (cherry picked from commit ce71264)
- Loading branch information
1 parent
e2ebd66
commit dfe6897
Showing
7 changed files
with
95 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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 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 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
4 changes: 4 additions & 0 deletions
4
...ck/plugins/triggers_actions_ui/public/application/sections/alerts_table/alerts_table.scss
This file contains 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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
.alertsTableHighlightedRow { | ||
background-color: $euiColorHighlight; | ||
} | ||
|
||
.alertsTableActiveRow { | ||
background-color: tintOrShade($euiColorLightShade, 50%, 0); | ||
} |
This file contains 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 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 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