[ML] Anomaly Detection: adds ability to delete forecasts from job#194896
[ML] Anomaly Detection: adds ability to delete forecasts from job#194896peteharverson merged 13 commits intoelastic:mainfrom
Conversation
|
cc @joana-cps - wanted to get your opinion on the color to highlight the selected row in the modal. |
|
Pinging @elastic/ml-ui (:ml) |
| latestRecordTimestamp={selectedJob.data_counts.latest_record_timestamp} | ||
| setForecastId={this.setForecastId} | ||
| className="forecast-controls" | ||
| selectedForecastId={this.props.selectedForecastId} |
There was a problem hiding this comment.
The selected id passed into the modal is only used in row props to highlight the selected forecast 🤔
Not sure what's going on here but I wasn't able to reproduce anything like that. Would you be up for sharing steps?
There was a problem hiding this comment.
I can no longer reproduce this!
There was a problem hiding this comment.
Not quite the same, but possibly related, on returning to a job that was previously displaying a forecast, the forecast modal is incorrectly implying that the previous forecast is being viewed:
Screen.Recording.2024-10-07.at.10.04.26.mov
There was a problem hiding this comment.
I was able to reproduce that. Looks like the forecastId sent as a prop to child components was not getting reset when job selection changed. This has been fixed in c16e025
I gave it an extra test after and it looks like no other behavior is affected by that fix but would appreciate a second test. 🙏
There was a problem hiding this comment.
Behavior when switching jobs / forecasts all looks good to me.
|
@elasticmachine merge upstream |
💔 Build FailedFailed CI StepsHistory
To update your PR or re-run it, just comment with: |
| }, | ||
|
|
||
| deleteForecast({ jobId, forecastId }: { jobId: string; forecastId: string }) { | ||
| return httpService.http<any>({ |
There was a problem hiding this comment.
It would be good to add the correct return type here
|
|
||
| componentDidMount() { | ||
| this.loadForecasts(); | ||
| this.canDeleteJobForecast = checkPermission('canForecastJob'); |
There was a problem hiding this comment.
we should add a new canDeleteForecast capability
| <p> | ||
| <FormattedMessage | ||
| id="xpack.ml.jobsList.jobDetails.forecastsTable.deleteForecastConfirm.text" | ||
| defaultMessage="This will delete the forecast from the job permanently." |
There was a problem hiding this comment.
Nit.
| defaultMessage="This will delete the forecast from the job permanently." | |
| defaultMessage="This will permanently delete the forecast from the job." |
| errorMessage: i18n.translate( | ||
| 'xpack.ml.jobsList.jobDetails.forecastsTable.deleteForecastErrorMessage', | ||
| { | ||
| defaultMessage: 'An error occurred deleting the forecast.', |
There was a problem hiding this comment.
Nit.
| defaultMessage: 'An error occurred deleting the forecast.', | |
| defaultMessage: 'An error occurred when deleting the forecast.', |
For consistency's sake, we should use the same blue we use in selected rows in other tables. |
|
@elasticmachine merge upstream |
peteharverson
left a comment
There was a problem hiding this comment.
Tested latest changes and LGTM
| defaultMessage: 'View', | ||
| }), | ||
| type: 'icon', | ||
| icon: 'singleMetricViewer', |
There was a problem hiding this comment.
As discussed on slack, can we change this one to the EUI:eye?
There was a problem hiding this comment.
| icon: 'singleMetricViewer', | |
| icon: 'eye', |
| this.state = { | ||
| isLoading: props.job.data_counts.processed_record_count !== 0, | ||
| forecasts: [], | ||
| isConfirmModalVisible: false, |
There was a problem hiding this comment.
| isConfirmModalVisible: false, | |
| isDeleteForecastConfirmModalVisible: false, |
|
|
||
| this.setState({ | ||
| isLoading: true, | ||
| isConfirmModalVisible: false, |
There was a problem hiding this comment.
forecastIdToDelete needs to be cleared here too and in the catch below.
Seeing as isConfirmModalVisible and forecastIdToDelete are always set together, I don't think we need both of them.
Whether or not the modal is shown could be based solely on whether forecastIdToDelete is defined.
There was a problem hiding this comment.
Updated to use the forecastIdToDelete for modal visibility check and to clear in 0d7a3ab
| } | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, [selectedForecastId]); | ||
| }, [selectedForecastId, selectedForecastId]); |
There was a problem hiding this comment.
selectedForecastId is repeated here. it didn't flag up because we're suppressing the exhaustive-deps error :(
💔 Build Failed
Failed CI StepsTest Failures
Metrics [docs]Async chunks
Public APIs missing exports
Page load bundle
History
|
|
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/11251354860 |
…astic#194896) ## Summary Related issues: - elastic#18511 - elastic#192301 In this PR, in Job management > expanded row > Forecasts tab - a delete action has been added to each row in the forecasts table. A confirmation modal allows the user to confirm the delete action. In the SMV view, the forecast being currently viewed is now highlighted in the Forecast modal to make it easier to identify.  <img width="881" alt="image" src="https://github.com/user-attachments/assets/accbd7d9-1bae-4f1f-af8f-8bd36eae0572"> <img width="1099" alt="image" src="https://github.com/user-attachments/assets/6011936d-3773-41ce-bbce-3ca4c0154cab"> Dark mode: <img width="882" alt="image" src="https://github.com/user-attachments/assets/cbec6fc8-0c62-4e34-9546-0124ae80a568"> ### Checklist Delete any items that are not applicable to this PR. - [ ] 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/packages/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 - [ ] [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 - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit f4a4a68)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…ob (#194896) (#195547) # Backport This will backport the following commits from `main` to `8.x`: - [[ML] Anomaly Detection: adds ability to delete forecasts from job (#194896)](#194896) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Melissa Alvarez","email":"melissa.alvarez@elastic.co"},"sourceCommit":{"committedDate":"2024-10-09T08:40:45Z","message":"[ML] Anomaly Detection: adds ability to delete forecasts from job (#194896)\n\n## Summary\r\n\r\nRelated issues:\r\n- https://github.com/elastic/kibana/issues/18511\r\n- https://github.com/elastic/kibana/issues/192301\r\n\r\nIn this PR, in Job management > expanded row > Forecasts tab - a delete\r\naction has been added to each row in the forecasts table. A confirmation\r\nmodal allows the user to confirm the delete action.\r\n\r\nIn the SMV view, the forecast being currently viewed is now highlighted\r\nin the Forecast modal to make it easier to identify.\r\n\r\n\r\n\r\n\r\n<img width=\"881\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/accbd7d9-1bae-4f1f-af8f-8bd36eae0572\">\r\n\r\n<img width=\"1099\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/6011936d-3773-41ce-bbce-3ca4c0154cab\">\r\n\r\nDark mode:\r\n\r\n<img width=\"882\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/cbec6fc8-0c62-4e34-9546-0124ae80a568\">\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [ ] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [ ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n- [ ] Any UI touched in this PR is usable by keyboard only (learn more\r\nabout [keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n- [ ] Any UI touched in this PR does not create any new axe failures\r\n(run axe in browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n- [ ] This renders correctly on smaller devices using a responsive\r\nlayout. (You can test this [in your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n- [ ] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"f4a4a681f58c1c64eb8a05070b44f0605c625458","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement",":ml","Feature:Anomaly Detection","v9.0.0","v8.16.0","backport:version"],"title":"[ML] Anomaly Detection: adds ability to delete forecasts from job","number":194896,"url":"https://github.com/elastic/kibana/pull/194896","mergeCommit":{"message":"[ML] Anomaly Detection: adds ability to delete forecasts from job (#194896)\n\n## Summary\r\n\r\nRelated issues:\r\n- https://github.com/elastic/kibana/issues/18511\r\n- https://github.com/elastic/kibana/issues/192301\r\n\r\nIn this PR, in Job management > expanded row > Forecasts tab - a delete\r\naction has been added to each row in the forecasts table. A confirmation\r\nmodal allows the user to confirm the delete action.\r\n\r\nIn the SMV view, the forecast being currently viewed is now highlighted\r\nin the Forecast modal to make it easier to identify.\r\n\r\n\r\n\r\n\r\n<img width=\"881\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/accbd7d9-1bae-4f1f-af8f-8bd36eae0572\">\r\n\r\n<img width=\"1099\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/6011936d-3773-41ce-bbce-3ca4c0154cab\">\r\n\r\nDark mode:\r\n\r\n<img width=\"882\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/cbec6fc8-0c62-4e34-9546-0124ae80a568\">\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [ ] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [ ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n- [ ] Any UI touched in this PR is usable by keyboard only (learn more\r\nabout [keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n- [ ] Any UI touched in this PR does not create any new axe failures\r\n(run axe in browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n- [ ] This renders correctly on smaller devices using a responsive\r\nlayout. (You can test this [in your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n- [ ] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"f4a4a681f58c1c64eb8a05070b44f0605c625458"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/194896","number":194896,"mergeCommit":{"message":"[ML] Anomaly Detection: adds ability to delete forecasts from job (#194896)\n\n## Summary\r\n\r\nRelated issues:\r\n- https://github.com/elastic/kibana/issues/18511\r\n- https://github.com/elastic/kibana/issues/192301\r\n\r\nIn this PR, in Job management > expanded row > Forecasts tab - a delete\r\naction has been added to each row in the forecasts table. A confirmation\r\nmodal allows the user to confirm the delete action.\r\n\r\nIn the SMV view, the forecast being currently viewed is now highlighted\r\nin the Forecast modal to make it easier to identify.\r\n\r\n\r\n\r\n\r\n<img width=\"881\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/accbd7d9-1bae-4f1f-af8f-8bd36eae0572\">\r\n\r\n<img width=\"1099\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/6011936d-3773-41ce-bbce-3ca4c0154cab\">\r\n\r\nDark mode:\r\n\r\n<img width=\"882\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/cbec6fc8-0c62-4e34-9546-0124ae80a568\">\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not applicable to this PR.\r\n\r\n- [ ] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [ ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n- [ ] Any UI touched in this PR is usable by keyboard only (learn more\r\nabout [keyboard accessibility](https://webaim.org/techniques/keyboard/))\r\n- [ ] Any UI touched in this PR does not create any new axe failures\r\n(run axe in browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n- [ ] This renders correctly on smaller devices using a responsive\r\nlayout. (You can test this [in your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n- [ ] This was checked for [cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"f4a4a681f58c1c64eb8a05070b44f0605c625458"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Melissa Alvarez <melissa.alvarez@elastic.co>


Summary
Related issues:
In this PR, in Job management > expanded row > Forecasts tab - a delete action has been added to each row in the forecasts table. A confirmation modal allows the user to confirm the delete action.
In the SMV view, the forecast being currently viewed is now highlighted in the Forecast modal to make it easier to identify.
Dark mode:
Checklist
Delete any items that are not applicable to this PR.