Skip to content
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

[ResponseOps][Rules][Alerts] Link stack rule details page refresh button to alerts table #195736

Merged

Conversation

umbopepato
Copy link
Member

@umbopepato umbopepato commented Oct 10, 2024

Summary

Forwards the reload request from the Stack Management rule detail page 🔄 Refresh button to the alerts table.

To verify

  1. Create a Stack rule that fires alerts
  2. Visit that rule's detail page
  3. Check that the 🔄 Refresh button correctly refreshes the alerts table (i.e. by changing the rule params and checking that the alerts update accordingly)

References

Fixes #188405, #183155

@umbopepato umbopepato added release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) backport:prev-major Backport to (8.x, 8.17, 8.16) the previous major branch and other branches in development labels Oct 10, 2024
@umbopepato umbopepato requested a review from a team as a code owner October 10, 2024 10:26
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@cnasikas cnasikas added v9.0.0 v8.16.0 v8.15.3 bug Fixes for quality problems that affect the customer experience labels Oct 10, 2024
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a unit test to test the new behavior?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in cae83a7

@@ -71,6 +71,9 @@ export function RuleComponent({
}: RuleComponentProps) {
const { ruleTypeRegistry, actionTypeRegistry, alertsTableConfigurationRegistry } =
useKibana().services;
// The lastReloadRequestTime should be updated when the refreshToken changes
// eslint-disable-next-line react-hooks/exhaustive-deps
const lastReloadRequestTime = useMemo(() => +new Date(), [refreshToken]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: For readability maybe we can do new Date().getTime(). +new Date() is a bit difficult to understand what it does.

Copy link
Contributor

@jcger jcger Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't exactly what memo is meant to be used for. Is this a hack or is there an underlaying issue? Shouldn't this be done with an effect?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to getTime() in cae83a7

@jcger it's a temporary solution based on the two tools we already have at our disposal (refreshToken for the rule page and lastReloadRequestTime for the alerts table). In alerts-table-refactor I introduced an imperative handle to forward a couple of APIs such as the original refresh function, which we could use as a more definitive and cleaner solution 🙂

@jcger
Copy link
Contributor

jcger commented Oct 15, 2024

what do you think about restarting the updatedAt label too?
Screenshot
that by the way is not aligned :drama:

Copy link
Contributor

@adcoelho adcoelho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works 🙌

@umbopepato
Copy link
Member Author

what do you think about restarting the updatedAt label too? Screenshot that by the way is not aligned :drama:

The idea was to use a new new useCombinedQueries react query utility I introduced in the alerts table refactor to get the last dataUpdatedAt among all the queries and use that as a good indicator of when the data was actually last refreshed 🙂

@umbopepato umbopepato enabled auto-merge (squash) October 17, 2024 07:37
@umbopepato umbopepato merged commit 6a0ad10 into elastic:main Oct 17, 2024
45 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.15, 8.16, 8.x

https://github.com/elastic/kibana/actions/runs/11382486175

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
triggersActionsUi 1.7MB 1.7MB +78.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
triggersActionsUi 130 131 +1

Total ESLint disabled count

id before after diff
triggersActionsUi 136 137 +1

History

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 17, 2024
…ton to alerts table (elastic#195736)

## Summary

Forwards the reload request from the Stack Management rule detail page
`🔄 Refresh` button to the alerts table.

## To verify

1. Create a Stack rule that fires alerts
2. Visit that rule's detail page
3. Check that the `🔄 Refresh` button correctly refreshes the alerts
table (i.e. by changing the rule params and checking that the alerts
update accordingly)

## References

Fixes elastic#188405, elastic#183155

(cherry picked from commit 6a0ad10)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 17, 2024
…ton to alerts table (elastic#195736)

## Summary

Forwards the reload request from the Stack Management rule detail page
`🔄 Refresh` button to the alerts table.

## To verify

1. Create a Stack rule that fires alerts
2. Visit that rule's detail page
3. Check that the `🔄 Refresh` button correctly refreshes the alerts
table (i.e. by changing the rule params and checking that the alerts
update accordingly)

## References

Fixes elastic#188405, elastic#183155

(cherry picked from commit 6a0ad10)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 17, 2024
…ton to alerts table (elastic#195736)

## Summary

Forwards the reload request from the Stack Management rule detail page
`🔄 Refresh` button to the alerts table.

## To verify

1. Create a Stack rule that fires alerts
2. Visit that rule's detail page
3. Check that the `🔄 Refresh` button correctly refreshes the alerts
table (i.e. by changing the rule params and checking that the alerts
update accordingly)

## References

Fixes elastic#188405, elastic#183155

(cherry picked from commit 6a0ad10)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.15
8.16
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Oct 17, 2024
…esh button to alerts table (#195736) (#196652)

# Backport

This will backport the following commits from `main` to `8.15`:
- [[ResponseOps][Rules][Alerts] Link stack rule details page refresh
button to alerts table
(#195736)](#195736)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Umberto
Pepato","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-17T09:46:29Z","message":"[ResponseOps][Rules][Alerts]
Link stack rule details page refresh button to alerts table
(#195736)\n\n## Summary\r\n\r\nForwards the reload request from the
Stack Management rule detail page\r\n`🔄 Refresh` button to the alerts
table.\r\n\r\n## To verify\r\n\r\n1. Create a Stack rule that fires
alerts\r\n2. Visit that rule's detail page\r\n3. Check that the `🔄
Refresh` button correctly refreshes the alerts\r\ntable (i.e. by
changing the rule params and checking that the alerts\r\nupdate
accordingly)\r\n\r\n## References\r\n\r\nFixes #188405,
#183155","sha":"6a0ad109087fd8b9efe9198a6df23f4658929c05","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:ResponseOps","v9.0.0","backport:prev-major","v8.16.0","v8.15.3"],"title":"[ResponseOps][Rules][Alerts]
Link stack rule details page refresh button to alerts
table","number":195736,"url":"https://github.com/elastic/kibana/pull/195736","mergeCommit":{"message":"[ResponseOps][Rules][Alerts]
Link stack rule details page refresh button to alerts table
(#195736)\n\n## Summary\r\n\r\nForwards the reload request from the
Stack Management rule detail page\r\n`🔄 Refresh` button to the alerts
table.\r\n\r\n## To verify\r\n\r\n1. Create a Stack rule that fires
alerts\r\n2. Visit that rule's detail page\r\n3. Check that the `🔄
Refresh` button correctly refreshes the alerts\r\ntable (i.e. by
changing the rule params and checking that the alerts\r\nupdate
accordingly)\r\n\r\n## References\r\n\r\nFixes #188405,
#183155","sha":"6a0ad109087fd8b9efe9198a6df23f4658929c05"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.15"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/195736","number":195736,"mergeCommit":{"message":"[ResponseOps][Rules][Alerts]
Link stack rule details page refresh button to alerts table
(#195736)\n\n## Summary\r\n\r\nForwards the reload request from the
Stack Management rule detail page\r\n`🔄 Refresh` button to the alerts
table.\r\n\r\n## To verify\r\n\r\n1. Create a Stack rule that fires
alerts\r\n2. Visit that rule's detail page\r\n3. Check that the `🔄
Refresh` button correctly refreshes the alerts\r\ntable (i.e. by
changing the rule params and checking that the alerts\r\nupdate
accordingly)\r\n\r\n## References\r\n\r\nFixes #188405,
#183155","sha":"6a0ad109087fd8b9efe9198a6df23f4658929c05"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.15","label":"v8.15.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Umberto Pepato <[email protected]>
kibanamachine added a commit that referenced this pull request Oct 17, 2024
…sh button to alerts table (#195736) (#196654)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ResponseOps][Rules][Alerts] Link stack rule details page refresh
button to alerts table
(#195736)](#195736)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Umberto
Pepato","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-17T09:46:29Z","message":"[ResponseOps][Rules][Alerts]
Link stack rule details page refresh button to alerts table
(#195736)\n\n## Summary\r\n\r\nForwards the reload request from the
Stack Management rule detail page\r\n`🔄 Refresh` button to the alerts
table.\r\n\r\n## To verify\r\n\r\n1. Create a Stack rule that fires
alerts\r\n2. Visit that rule's detail page\r\n3. Check that the `🔄
Refresh` button correctly refreshes the alerts\r\ntable (i.e. by
changing the rule params and checking that the alerts\r\nupdate
accordingly)\r\n\r\n## References\r\n\r\nFixes #188405,
#183155","sha":"6a0ad109087fd8b9efe9198a6df23f4658929c05","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:ResponseOps","v9.0.0","backport:prev-major","v8.16.0","v8.15.3"],"title":"[ResponseOps][Rules][Alerts]
Link stack rule details page refresh button to alerts
table","number":195736,"url":"https://github.com/elastic/kibana/pull/195736","mergeCommit":{"message":"[ResponseOps][Rules][Alerts]
Link stack rule details page refresh button to alerts table
(#195736)\n\n## Summary\r\n\r\nForwards the reload request from the
Stack Management rule detail page\r\n`🔄 Refresh` button to the alerts
table.\r\n\r\n## To verify\r\n\r\n1. Create a Stack rule that fires
alerts\r\n2. Visit that rule's detail page\r\n3. Check that the `🔄
Refresh` button correctly refreshes the alerts\r\ntable (i.e. by
changing the rule params and checking that the alerts\r\nupdate
accordingly)\r\n\r\n## References\r\n\r\nFixes #188405,
#183155","sha":"6a0ad109087fd8b9efe9198a6df23f4658929c05"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.15"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/195736","number":195736,"mergeCommit":{"message":"[ResponseOps][Rules][Alerts]
Link stack rule details page refresh button to alerts table
(#195736)\n\n## Summary\r\n\r\nForwards the reload request from the
Stack Management rule detail page\r\n`🔄 Refresh` button to the alerts
table.\r\n\r\n## To verify\r\n\r\n1. Create a Stack rule that fires
alerts\r\n2. Visit that rule's detail page\r\n3. Check that the `🔄
Refresh` button correctly refreshes the alerts\r\ntable (i.e. by
changing the rule params and checking that the alerts\r\nupdate
accordingly)\r\n\r\n## References\r\n\r\nFixes #188405,
#183155","sha":"6a0ad109087fd8b9efe9198a6df23f4658929c05"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.15","label":"v8.15.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Umberto Pepato <[email protected]>
@mistic
Copy link
Member

mistic commented Oct 17, 2024

This PR didn't make it into the latest BC of v8.15.3. Updating the labels.

@mistic mistic added v8.15.4 and removed v8.15.3 labels Oct 17, 2024
@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Oct 18, 2024
kibanamachine added a commit that referenced this pull request Oct 21, 2024
…esh button to alerts table (#195736) (#196653)

# Backport

This will backport the following commits from `main` to `8.16`:
- [[ResponseOps][Rules][Alerts] Link stack rule details page refresh
button to alerts table
(#195736)](#195736)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Umberto
Pepato","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-17T09:46:29Z","message":"[ResponseOps][Rules][Alerts]
Link stack rule details page refresh button to alerts table
(#195736)\n\n## Summary\r\n\r\nForwards the reload request from the
Stack Management rule detail page\r\n`🔄 Refresh` button to the alerts
table.\r\n\r\n## To verify\r\n\r\n1. Create a Stack rule that fires
alerts\r\n2. Visit that rule's detail page\r\n3. Check that the `🔄
Refresh` button correctly refreshes the alerts\r\ntable (i.e. by
changing the rule params and checking that the alerts\r\nupdate
accordingly)\r\n\r\n## References\r\n\r\nFixes #188405,
#183155","sha":"6a0ad109087fd8b9efe9198a6df23f4658929c05","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:ResponseOps","v9.0.0","backport:prev-major","v8.16.0","v8.15.3"],"title":"[ResponseOps][Rules][Alerts]
Link stack rule details page refresh button to alerts
table","number":195736,"url":"https://github.com/elastic/kibana/pull/195736","mergeCommit":{"message":"[ResponseOps][Rules][Alerts]
Link stack rule details page refresh button to alerts table
(#195736)\n\n## Summary\r\n\r\nForwards the reload request from the
Stack Management rule detail page\r\n`🔄 Refresh` button to the alerts
table.\r\n\r\n## To verify\r\n\r\n1. Create a Stack rule that fires
alerts\r\n2. Visit that rule's detail page\r\n3. Check that the `🔄
Refresh` button correctly refreshes the alerts\r\ntable (i.e. by
changing the rule params and checking that the alerts\r\nupdate
accordingly)\r\n\r\n## References\r\n\r\nFixes #188405,
#183155","sha":"6a0ad109087fd8b9efe9198a6df23f4658929c05"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.15"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/195736","number":195736,"mergeCommit":{"message":"[ResponseOps][Rules][Alerts]
Link stack rule details page refresh button to alerts table
(#195736)\n\n## Summary\r\n\r\nForwards the reload request from the
Stack Management rule detail page\r\n`🔄 Refresh` button to the alerts
table.\r\n\r\n## To verify\r\n\r\n1. Create a Stack rule that fires
alerts\r\n2. Visit that rule's detail page\r\n3. Check that the `🔄
Refresh` button correctly refreshes the alerts\r\ntable (i.e. by
changing the rule params and checking that the alerts\r\nupdate
accordingly)\r\n\r\n## References\r\n\r\nFixes #188405,
#183155","sha":"6a0ad109087fd8b9efe9198a6df23f4658929c05"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.15","label":"v8.15.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Umberto Pepato <[email protected]>
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-major Backport to (8.x, 8.17, 8.16) the previous major branch and other branches in development bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.15.4 v8.16.0 v8.17.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ResponseOps][Rules][Alerts] Connect the rule details page refresh button to the alerts table
7 participants