[8.6] [Synthetics] Update status count viz on monitor upsert (#145898) (#145920)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[Synthetics] Update status count viz on monitor upsert
(#145898)](https://github.com/elastic/kibana/pull/145898)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT [{"author":{"name":"Justin
Kambic","email":"jk@elastic.co"},"sourceCommit":{"committedDate":"2022-11-21T19:24:31Z","message":"[Synthetics]
Update status count viz on monitor upsert (#145898)\n\n##
Summary\r\n\r\nResolves #145845.\r\n\r\nThis resolves the issue of count
not updating when a monitor is\r\nenabled/disabled by listening for the
`success` version of the saved\r\nobject upsert action. This way, any
time the frontend verifies that a\r\nmonitor has had its state changed,
we'll update the status count as a\r\nsecondary effect.\r\n\r\nThis
could introduce some risk if we start using that action in some\r\nsort
of batched way in the future, but at present it seems to only
be\r\ndriven by direct 1:1 user input to the Actions Popover component
that\r\nwe've reused in the detail flyout and on the overview
cards.\r\n\r\n## Testing this PR\r\n\r\nYou can simply create some
managed monitors and change their state from\r\nthe Overview
page.\r\n\r\n\r\n![20221121122624](https://user-images.githubusercontent.com/18429259/203121081-2c1232b7-8f62-4d93-bec8-4f98e4bc7433.gif)","sha":"bf7c3bc502b4fce11db2df90f1ed58a2c65ee5a1","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","Team:uptime","release_note:skip","ci:cloud-deploy","v8.6.0","v8.7.0"],"number":145898,"url":"https://github.com/elastic/kibana/pull/145898","mergeCommit":{"message":"[Synthetics]
Update status count viz on monitor upsert (#145898)\n\n##
Summary\r\n\r\nResolves #145845.\r\n\r\nThis resolves the issue of count
not updating when a monitor is\r\nenabled/disabled by listening for the
`success` version of the saved\r\nobject upsert action. This way, any
time the frontend verifies that a\r\nmonitor has had its state changed,
we'll update the status count as a\r\nsecondary effect.\r\n\r\nThis
could introduce some risk if we start using that action in some\r\nsort
of batched way in the future, but at present it seems to only
be\r\ndriven by direct 1:1 user input to the Actions Popover component
that\r\nwe've reused in the detail flyout and on the overview
cards.\r\n\r\n## Testing this PR\r\n\r\nYou can simply create some
managed monitors and change their state from\r\nthe Overview
page.\r\n\r\n\r\n![20221121122624](https://user-images.githubusercontent.com/18429259/203121081-2c1232b7-8f62-4d93-bec8-4f98e4bc7433.gif)","sha":"bf7c3bc502b4fce11db2df90f1ed58a2c65ee5a1"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/145898","number":145898,"mergeCommit":{"message":"[Synthetics]
Update status count viz on monitor upsert (#145898)\n\n##
Summary\r\n\r\nResolves #145845.\r\n\r\nThis resolves the issue of count
not updating when a monitor is\r\nenabled/disabled by listening for the
`success` version of the saved\r\nobject upsert action. This way, any
time the frontend verifies that a\r\nmonitor has had its state changed,
we'll update the status count as a\r\nsecondary effect.\r\n\r\nThis
could introduce some risk if we start using that action in some\r\nsort
of batched way in the future, but at present it seems to only
be\r\ndriven by direct 1:1 user input to the Actions Popover component
that\r\nwe've reused in the detail flyout and on the overview
cards.\r\n\r\n## Testing this PR\r\n\r\nYou can simply create some
managed monitors and change their state from\r\nthe Overview
page.\r\n\r\n\r\n![20221121122624](https://user-images.githubusercontent.com/18429259/203121081-2c1232b7-8f62-4d93-bec8-4f98e4bc7433.gif)","sha":"bf7c3bc502b4fce11db2df90f1ed58a2c65ee5a1"}}]}]
BACKPORT-->

Co-authored-by: Justin Kambic <jk@elastic.co>
This commit is contained in:
Kibana Machine 2022-11-21 15:37:55 -05:00 committed by GitHub
parent 210cde75fe
commit c0391abcdd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,7 @@
*/
import { takeLatest, takeLeading } from 'redux-saga/effects';
import { fetchUpsertSuccessAction } from '../monitor_list';
import { fetchEffectFactory } from '../utils/fetch_effect';
import {
fetchMonitorOverviewAction,
@ -28,7 +29,7 @@ export function* fetchMonitorOverviewEffect() {
export function* fetchOverviewStatusEffect() {
yield takeLatest(
[fetchOverviewStatusAction.get, quietFetchOverviewStatusAction.get],
[fetchOverviewStatusAction.get, quietFetchOverviewStatusAction.get, fetchUpsertSuccessAction],
fetchEffectFactory(
fetchOverviewStatus,
fetchOverviewStatusAction.success,