-
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 Explorer: Fix Anomalies Table pagination #214714
Conversation
…rvice && fix table pagination
Pinging @elastic/ml-ui (:ml) |
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 in the Anomaly Explorer and SMV and LGTM
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.
Great job on the fix, and many thanks for going the extra mile in refactoring it to TypeScript! I’ve left some comments—feel free to reach out if you need any help.
...platform/plugins/shared/ml/public/application/components/anomalies_table/anomalies_table.tsx
Show resolved
Hide resolved
...platform/plugins/shared/ml/public/application/components/anomalies_table/anomalies_table.tsx
Outdated
Show resolved
Hide resolved
...platform/plugins/shared/ml/public/application/components/anomalies_table/anomalies_table.tsx
Outdated
Show resolved
Hide resolved
// eslint-disable-next-line no-console | ||
console.log('Error fetching category definition for row item.', 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.
I know you just refactored it to typescript, but I wonder if we should surface this error to the user 🤔
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.
Yeah, we definitely shouldn't expose the error to the user, removed in 726fe10
Should we add some kind of error toast? Wdyt @darnautov?
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.
Replacing the console.log
with an error toast if there's an error fetching the category definition sounds a good idea.
x-pack/platform/plugins/shared/ml/public/application/explorer/anomaly_table_state_service.ts
Outdated
Show resolved
Hide resolved
x-pack/platform/plugins/shared/ml/public/application/explorer/anomaly_table_state_service.ts
Outdated
Show resolved
Hide resolved
tableDataLoading: false, | ||
})), | ||
catchError((error) => { | ||
return of({ tableData: null, tableDataLoading: 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.
Is it ok to silently fail 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.
I believe there was no error handling previously, so I just reused the old code. However, it would be nice to handle errors here - maybe we should add some toast messages? wdyt?
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 reckon it’d be better to show an error message instead of the table in this case, especially since we want to implement the anomalies table as an embeddable. @peteharverson WDYT?
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.
Yes can we show a callout rather than the table, similar to what we do (I think) with the anomaly charts and swim lane?
x-pack/platform/plugins/shared/ml/public/application/explorer/anomaly_table_state_service.ts
Outdated
Show resolved
Hide resolved
x-pack/platform/plugins/shared/ml/public/application/explorer/anomaly_table_state_service.ts
Outdated
Show resolved
Hide resolved
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 fix and TS refactoring LGTM, great work on this! And good to see an enhancement with reduced API calls.
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Public APIs missing exports
History
cc @rbrtj |
Starting backport for target branches: 8.16, 8.17, 8.18, 8.x |
Includes a fix for elastic#213424 and a follow up to elastic#203224 (comment) * Rewrites anomalies_table in typescript * Decouples anomalies table state into an individual service * Fixes an issue where anomalies table pagination wouldn't reset to 0 after changing significant properties of the view, causing the table data to refetch (cherry picked from commit ab78050)
Includes a fix for elastic#213424 and a follow up to elastic#203224 (comment) * Rewrites anomalies_table in typescript * Decouples anomalies table state into an individual service * Fixes an issue where anomalies table pagination wouldn't reset to 0 after changing significant properties of the view, causing the table data to refetch (cherry picked from commit ab78050)
💔 Some backports could not be created
Note: Successful backport PRs will be merged automatically after passing CI. Manual backportTo create the backport manually run:
Questions ?Please refer to the Backport tool documentation |
Includes a fix for elastic#213424 and a follow up to elastic#203224 (comment) * Rewrites anomalies_table in typescript * Decouples anomalies table state into an individual service * Fixes an issue where anomalies table pagination wouldn't reset to 0 after changing significant properties of the view, causing the table data to refetch
#215669) # Backport This will backport the following commits from `main` to `8.18`: - [[ML] Anomaly Explorer: Fix Anomalies Table pagination (#214714)](#214714) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Robert Jaszczurek","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-03-24T11:39:23Z","message":"[ML] Anomaly Explorer: Fix Anomalies Table pagination (#214714)\n\nIncludes a fix for #213424 and a\nfollow up to\nhttps://github.com//pull/203224#discussion_r1875926261\n\n* Rewrites anomalies_table in typescript\n* Decouples anomalies table state into an individual service\n* Fixes an issue where anomalies table pagination wouldn't reset to 0\nafter changing significant properties of the view, causing the table\ndata to refetch","sha":"ab780500f67b3b9f1f93ad53bfa79dcd2113f112","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix",":ml","Team:ML","backport:prev-major","backport:version","v9.1.0"],"title":"[ML] Anomaly Explorer: Fix Anomalies Table pagination","number":214714,"url":"https://github.com/elastic/kibana/pull/214714","mergeCommit":{"message":"[ML] Anomaly Explorer: Fix Anomalies Table pagination (#214714)\n\nIncludes a fix for #213424 and a\nfollow up to\nhttps://github.com//pull/203224#discussion_r1875926261\n\n* Rewrites anomalies_table in typescript\n* Decouples anomalies table state into an individual service\n* Fixes an issue where anomalies table pagination wouldn't reset to 0\nafter changing significant properties of the view, causing the table\ndata to refetch","sha":"ab780500f67b3b9f1f93ad53bfa79dcd2113f112"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/214714","number":214714,"mergeCommit":{"message":"[ML] Anomaly Explorer: Fix Anomalies Table pagination (#214714)\n\nIncludes a fix for #213424 and a\nfollow up to\nhttps://github.com//pull/203224#discussion_r1875926261\n\n* Rewrites anomalies_table in typescript\n* Decouples anomalies table state into an individual service\n* Fixes an issue where anomalies table pagination wouldn't reset to 0\nafter changing significant properties of the view, causing the table\ndata to refetch","sha":"ab780500f67b3b9f1f93ad53bfa79dcd2113f112"}}]}] BACKPORT--> Co-authored-by: Robert Jaszczurek <[email protected]>
…#215670) # Backport This will backport the following commits from `main` to `8.x`: - [[ML] Anomaly Explorer: Fix Anomalies Table pagination (#214714)](#214714) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Robert Jaszczurek","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-03-24T11:39:23Z","message":"[ML] Anomaly Explorer: Fix Anomalies Table pagination (#214714)\n\nIncludes a fix for #213424 and a\nfollow up to\nhttps://github.com//pull/203224#discussion_r1875926261\n\n* Rewrites anomalies_table in typescript\n* Decouples anomalies table state into an individual service\n* Fixes an issue where anomalies table pagination wouldn't reset to 0\nafter changing significant properties of the view, causing the table\ndata to refetch","sha":"ab780500f67b3b9f1f93ad53bfa79dcd2113f112","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix",":ml","Team:ML","backport:prev-major","backport:version","v9.1.0"],"title":"[ML] Anomaly Explorer: Fix Anomalies Table pagination","number":214714,"url":"https://github.com/elastic/kibana/pull/214714","mergeCommit":{"message":"[ML] Anomaly Explorer: Fix Anomalies Table pagination (#214714)\n\nIncludes a fix for #213424 and a\nfollow up to\nhttps://github.com//pull/203224#discussion_r1875926261\n\n* Rewrites anomalies_table in typescript\n* Decouples anomalies table state into an individual service\n* Fixes an issue where anomalies table pagination wouldn't reset to 0\nafter changing significant properties of the view, causing the table\ndata to refetch","sha":"ab780500f67b3b9f1f93ad53bfa79dcd2113f112"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/214714","number":214714,"mergeCommit":{"message":"[ML] Anomaly Explorer: Fix Anomalies Table pagination (#214714)\n\nIncludes a fix for #213424 and a\nfollow up to\nhttps://github.com//pull/203224#discussion_r1875926261\n\n* Rewrites anomalies_table in typescript\n* Decouples anomalies table state into an individual service\n* Fixes an issue where anomalies table pagination wouldn't reset to 0\nafter changing significant properties of the view, causing the table\ndata to refetch","sha":"ab780500f67b3b9f1f93ad53bfa79dcd2113f112"}}]}] BACKPORT--> Co-authored-by: Robert Jaszczurek <[email protected]>
Includes a fix for elastic#213424 and a follow up to elastic#203224 (comment) * Rewrites anomalies_table in typescript * Decouples anomalies table state into an individual service * Fixes an issue where anomalies table pagination wouldn't reset to 0 after changing significant properties of the view, causing the table data to refetch
Includes a fix for #213424 and a follow up to #203224 (comment)