Skip to content

[8.19] [ResponseOps][Alerts] Embeddable alerts table creation flow (#216076)#220796

Closed
kibanamachine wants to merge 2 commits intoelastic:8.19from
kibanamachine:backport/8.19/pr-216076
Closed

[8.19] [ResponseOps][Alerts] Embeddable alerts table creation flow (#216076)#220796
kibanamachine wants to merge 2 commits intoelastic:8.19from
kibanamachine:backport/8.19/pr-216076

Conversation

@kibanamachine
Copy link
Contributor

Backport

This will backport the following commits from main to 8.19:

Questions ?

Please refer to the Backport tool documentation

…216076)

## Summary

- Implements the embeddable alerts table creation flow, with solution
and filters.
- Enables the new table panel creation action.

<img width="1115" alt="image"
src="https://github.com/user-attachments/assets/d3158e55-3d09-4e52-b718-0ebe3e911e4c"
/>

<img width="1488" alt="image"
src="https://github.com/user-attachments/assets/c6e65f12-1347-4859-83f5-1de996d6ba86"
/>

<details>
<summary>

## Implementation details

</summary>

### Panel configuration state

As part of the panel's persisted configuration state, I opted to only
save the selected `solution` (`observability`, `security`, `stack`) and
not the resulting list of rule type ids. Re-calculating the rule type
ids based on the solution at render time ensures that users see the rule
types they have access to, and should avoid potential authentication
errors (both when editing the configuration and viewing the panel).

### Switching solution

<img width="881" alt="image"
src="https://github.com/user-attachments/assets/c4d0359f-dedb-4e74-a4c2-a49d81987fd5"
/>

When switching solution, the filters form must be reset since the rule
type ids it is based on change. This can be disruptive for the UX, so I
added a confirmation prompt in case the user already started to edit the
form and then tries to change solution.

### Missing authorization

<img width="1489" alt="image"
src="https://github.com/user-attachments/assets/866db208-495c-4eec-8ec8-9c2be2d00680"
/>

When a user doesn't have the necessary permissions for the rule types a
panel is based on, a missing authz prompt is shown.

</details>

## Verification steps

1. Create rules that fire alerts in multiple solutions (Security,
Observability and Stack)
2. Create a new dashboard or open an existing one, enter edit mode if
not active
3. Click `+ Add panel > Alerts`
4. Check that the solution selector options are coherent with the rule
types the user can access
5. Select a solution
6. Build filters expressions, checking that the rule tags and rule types
are coherent with the solution selection and the rules created
previously
7. Save the panel
8. Check that the created panel reflects the filtering options from the
creation flyout
9. Repeat steps 3-9 with different roles:
9.1. having access to rule types from just one solution (in this case
the solution selector shouldn't appear at all),
9.2. having access just to Observability and Stack but not Security (in
this case the solution selector shouldn't appear at all),
10. Repeat steps 3-8 in the three serverless project types:
    ```shell
    $ yarn es serverless —ssl --projectType <es|oblt|security>
    $ yarn serverless-<es|oblt|security> --ssl --run-examples
    ```
(If the authentication fails when switching between project types, use a
clean session)
10.1. Elasticsearch project types should have access only to Stack rules
(no selector)
10.2. Observability project types should have access only to
Observability and Stack rules (no selector)
10.3. Security project types should have access only to Security and
Stack rules (selector shows Stack instead of Observability)
11. In the previous cases, when the user doesn't have access to rule
types from the solution a certain panel is configured to show, check
that an authorization prompt is shown
12. Using a role without access to any rule type
12.1. Check that the `Alerts` panel type is not visible in the `Add
panel` flyout
12.2. Check that any pre-existing table panels show a missing authz
prompt

## Release Notes

Added an embeddable panel for Dashboards to display alerts.

## References

Closes elastic#203613
Closes elastic#203614
Closes elastic#203612

### Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [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
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 0a7874c)
@kibanamachine kibanamachine added the backport This PR is a backport of another PR label May 14, 2025
@kibanamachine kibanamachine enabled auto-merge (squash) May 14, 2025 15:53
@elasticmachine
Copy link
Contributor

elasticmachine commented May 25, 2025

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #2 / Embeddable Alerts Table Embeddable alerts panel "before all" hook for "should only show alerts from the observability area (o11y+stack) when selecting it"
  • [job] [logs] FTR Configs #2 / Embeddable Alerts Table Embeddable alerts panel "before all" hook for "should only show alerts from the observability area (o11y+stack) when selecting it"

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
embeddableAlertsTable 279 375 +96

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
cases 1.3MB 1.3MB +1.0KB
embeddableAlertsTable 798.3KB 854.1KB +55.8KB
ml 5.4MB 5.4MB +1.1KB
observability 1.3MB 1.3MB +1.1KB
securitySolution 9.2MB 9.2MB +1.0KB
triggersActionsUi 1.4MB 1.4MB +1.1KB
total +61.2KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
embeddableAlertsTable 4.7KB 5.7KB +1009.0B
Unknown metric groups

async chunk count

id before after diff
embeddableAlertsTable 3 7 +4

ESLint disabled in files

id before after diff
embeddableAlertsTable 0 2 +2

Total ESLint disabled count

id before after diff
embeddableAlertsTable 2 4 +2

History

cc @umbopepato

@umbopepato
Copy link
Member

umbopepato commented May 26, 2025

Checking flakyness in the functional test added by the original PR (flaky test runner ran successfully before merging)

@umbopepato
Copy link
Member

Closing in favor of manual backport PR #221629

@umbopepato umbopepato closed this May 27, 2025
auto-merge was automatically disabled May 27, 2025 14:49

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

3 participants