-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ML] Anomaly Detection: adds ability to delete forecasts from job #194896
[ML] Anomaly Detection: adds ability to delete forecasts from job #194896
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) |
.../public/application/jobs/jobs_list/components/job_details/forecasts_table/forecasts_table.js
Outdated
Show resolved
Hide resolved
...gins/ml/public/application/timeseriesexplorer/components/forecasting_modal/forecasts_list.js
Outdated
Show resolved
Hide resolved
@@ -1081,6 +1081,7 @@ export class TimeSeriesExplorer extends React.Component { | |||
latestRecordTimestamp={selectedJob.data_counts.latest_record_timestamp} | |||
setForecastId={this.setForecastId} | |||
className="forecast-controls" | |||
selectedForecastId={this.props.selectedForecastId} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can no longer reproduce this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Behavior when switching jobs / forecasts all looks good to me.
.../public/application/jobs/jobs_list/components/job_details/forecasts_table/forecasts_table.js
Outdated
Show resolved
Hide resolved
@elasticmachine merge upstream |
💔 Build FailedFailed CI StepsHistory
To update your PR or re-run it, just comment with: |
@@ -368,6 +368,14 @@ export function mlApiProvider(httpService: HttpService) { | |||
}); | |||
}, | |||
|
|||
deleteForecast({ jobId, forecastId }: { jobId: string; forecastId: string }) { | |||
return httpService.http<any>({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to add the correct return type here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in d29de18
@@ -54,6 +89,11 @@ export class ForecastsTable extends Component { | |||
static contextType = context; | |||
|
|||
componentDidMount() { | |||
this.loadForecasts(); | |||
this.canDeleteJobForecast = checkPermission('canForecastJob'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should add a new canDeleteForecast
capability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in d29de18
<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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit.
defaultMessage="This will delete the forecast from the job permanently." | |
defaultMessage="This will permanently delete the forecast from the job." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in d29de18
errorMessage: i18n.translate( | ||
'xpack.ml.jobsList.jobDetails.forecastsTable.deleteForecastErrorMessage', | ||
{ | ||
defaultMessage: 'An error occurred deleting the forecast.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit.
defaultMessage: 'An error occurred deleting the forecast.', | |
defaultMessage: 'An error occurred when deleting the forecast.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in d29de18
For consistency's sake, we should use the same blue we use in selected rows in other tables. |
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested latest changes and LGTM
defaultMessage: 'View', | ||
}), | ||
type: 'icon', | ||
icon: 'singleMetricViewer', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed on slack, can we change this one to the EUI:eye?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
icon: 'singleMetricViewer', | |
icon: 'eye', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about that - updated in 79038f0
@@ -44,6 +78,7 @@ export class ForecastsTable extends Component { | |||
this.state = { | |||
isLoading: props.job.data_counts.processed_record_count !== 0, | |||
forecasts: [], | |||
isConfirmModalVisible: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isConfirmModalVisible: false, | |
isDeleteForecastConfirmModalVisible: false, |
|
||
this.setState({ | ||
isLoading: true, | ||
isConfirmModalVisible: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to use the forecastIdToDelete for modal visibility check and to clear in 0d7a3ab
@@ -257,7 +258,7 @@ export const TimeSeriesExplorerUrlStateManager: FC<TimeSeriesExplorerUrlStateMan | |||
}); | |||
} | |||
// eslint-disable-next-line react-hooks/exhaustive-deps | |||
}, [selectedForecastId]); | |||
}, [selectedForecastId, selectedForecastId]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
selectedForecastId
is repeated here. it didn't flag up because we're suppressing the exhaustive-deps
error :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in 0d7a3ab
💔 Build Failed
Failed CI StepsTest Failures
Metrics [docs]Async chunks
Public APIs missing exports
Page load bundle
History
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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 <[email protected]> Co-authored-by: kibanamachine <[email protected]> (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":"[email protected]"},"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 <[email protected]>\r\nCo-authored-by: kibanamachine <[email protected]>","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 <[email protected]>\r\nCo-authored-by: kibanamachine <[email protected]>","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 <[email protected]>\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"f4a4a681f58c1c64eb8a05070b44f0605c625458"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Melissa Alvarez <[email protected]>
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.