-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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 swim lane: Fix disappearing rows per page button #194531
[ML] Anomaly swim lane: Fix disappearing rows per page button #194531
Conversation
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 and LGTM. Just added a comment about possibly adding some unit tests.
const items = rowOptions.reduce((acc, v) => { | ||
if (v <= cardinality) { | ||
acc.push(v); | ||
} else if (acc.length === 0 || acc[acc.length - 1] < cardinality) { | ||
acc.push(v); | ||
} | ||
return acc; | ||
}, [] as number[]); |
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: You could move this to a function and add some jest unit tests for it.
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.
Moved function to a single file & added unit tests in: #3035a1d
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 and LGTM.
Would be good to add the unit test as @walterra suggested.
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.
Latest changes including unit tests LGTM!
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
History
To update your PR or re-run it, just comment with: cc @rbrtj |
Starting backport for target branches: 8.15, 8.x |
…c#194531) ## Summary Fix for: [elastic#194027](elastic#194027). Fixed issue with disappearing `rows per page` button. Enhanced the logic to display only relevant pagination options, showing the first larger option, which works like 'show all'. * For example, if there are 23 results, the available `rows per page` options will be: `5,10,20,50`. https://github.com/user-attachments/assets/29c3f0db-84b8-4a0c-b4b5-a722cfc490c4 (cherry picked from commit c84ee4c)
…c#194531) ## Summary Fix for: [elastic#194027](elastic#194027). Fixed issue with disappearing `rows per page` button. Enhanced the logic to display only relevant pagination options, showing the first larger option, which works like 'show all'. * For example, if there are 23 results, the available `rows per page` options will be: `5,10,20,50`. https://github.com/user-attachments/assets/29c3f0db-84b8-4a0c-b4b5-a722cfc490c4 (cherry picked from commit c84ee4c)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…194531) (#194672) # Backport This will backport the following commits from `main` to `8.15`: - [[ML] Anomaly swim lane: Fix disappearing rows per page button (#194531)](#194531) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Robert Jaszczurek","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-02T09:50:04Z","message":"[ML] Anomaly swim lane: Fix disappearing rows per page button (#194531)\n\n## Summary\r\n\r\nFix for: [#194027](https://github.com/elastic/kibana/issues/194027).\r\nFixed issue with disappearing `rows per page` button.\r\nEnhanced the logic to display only relevant pagination options, showing\r\nthe first larger option, which works like 'show all'.\r\n* For example, if there are 23 results, the available `rows per page`\r\noptions will be: `5,10,20,50`.\r\n\r\n\r\nhttps://github.com/user-attachments/assets/29c3f0db-84b8-4a0c-b4b5-a722cfc490c4","sha":"c84ee4c5293718ce4b4f7c8b6e4f502449b5aa34","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix",":ml","Feature:Anomaly Detection","v9.0.0","Team:ML","v8.16.0","backport:version","v8.15.3"],"title":"[ML] Anomaly swim lane: Fix disappearing rows per page button","number":194531,"url":"https://github.com/elastic/kibana/pull/194531","mergeCommit":{"message":"[ML] Anomaly swim lane: Fix disappearing rows per page button (#194531)\n\n## Summary\r\n\r\nFix for: [#194027](https://github.com/elastic/kibana/issues/194027).\r\nFixed issue with disappearing `rows per page` button.\r\nEnhanced the logic to display only relevant pagination options, showing\r\nthe first larger option, which works like 'show all'.\r\n* For example, if there are 23 results, the available `rows per page`\r\noptions will be: `5,10,20,50`.\r\n\r\n\r\nhttps://github.com/user-attachments/assets/29c3f0db-84b8-4a0c-b4b5-a722cfc490c4","sha":"c84ee4c5293718ce4b4f7c8b6e4f502449b5aa34"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.15"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/194531","number":194531,"mergeCommit":{"message":"[ML] Anomaly swim lane: Fix disappearing rows per page button (#194531)\n\n## Summary\r\n\r\nFix for: [#194027](https://github.com/elastic/kibana/issues/194027).\r\nFixed issue with disappearing `rows per page` button.\r\nEnhanced the logic to display only relevant pagination options, showing\r\nthe first larger option, which works like 'show all'.\r\n* For example, if there are 23 results, the available `rows per page`\r\noptions will be: `5,10,20,50`.\r\n\r\n\r\nhttps://github.com/user-attachments/assets/29c3f0db-84b8-4a0c-b4b5-a722cfc490c4","sha":"c84ee4c5293718ce4b4f7c8b6e4f502449b5aa34"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","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: Robert Jaszczurek <[email protected]>
…194531) (#194674) # Backport This will backport the following commits from `main` to `8.x`: - [[ML] Anomaly swim lane: Fix disappearing rows per page button (#194531)](#194531) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Robert Jaszczurek","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-02T09:50:04Z","message":"[ML] Anomaly swim lane: Fix disappearing rows per page button (#194531)\n\n## Summary\r\n\r\nFix for: [#194027](https://github.com/elastic/kibana/issues/194027).\r\nFixed issue with disappearing `rows per page` button.\r\nEnhanced the logic to display only relevant pagination options, showing\r\nthe first larger option, which works like 'show all'.\r\n* For example, if there are 23 results, the available `rows per page`\r\noptions will be: `5,10,20,50`.\r\n\r\n\r\nhttps://github.com/user-attachments/assets/29c3f0db-84b8-4a0c-b4b5-a722cfc490c4","sha":"c84ee4c5293718ce4b4f7c8b6e4f502449b5aa34","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix",":ml","Feature:Anomaly Detection","v9.0.0","Team:ML","v8.16.0","backport:version","v8.15.3"],"title":"[ML] Anomaly swim lane: Fix disappearing rows per page button","number":194531,"url":"https://github.com/elastic/kibana/pull/194531","mergeCommit":{"message":"[ML] Anomaly swim lane: Fix disappearing rows per page button (#194531)\n\n## Summary\r\n\r\nFix for: [#194027](https://github.com/elastic/kibana/issues/194027).\r\nFixed issue with disappearing `rows per page` button.\r\nEnhanced the logic to display only relevant pagination options, showing\r\nthe first larger option, which works like 'show all'.\r\n* For example, if there are 23 results, the available `rows per page`\r\noptions will be: `5,10,20,50`.\r\n\r\n\r\nhttps://github.com/user-attachments/assets/29c3f0db-84b8-4a0c-b4b5-a722cfc490c4","sha":"c84ee4c5293718ce4b4f7c8b6e4f502449b5aa34"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.15"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/194531","number":194531,"mergeCommit":{"message":"[ML] Anomaly swim lane: Fix disappearing rows per page button (#194531)\n\n## Summary\r\n\r\nFix for: [#194027](https://github.com/elastic/kibana/issues/194027).\r\nFixed issue with disappearing `rows per page` button.\r\nEnhanced the logic to display only relevant pagination options, showing\r\nthe first larger option, which works like 'show all'.\r\n* For example, if there are 23 results, the available `rows per page`\r\noptions will be: `5,10,20,50`.\r\n\r\n\r\nhttps://github.com/user-attachments/assets/29c3f0db-84b8-4a0c-b4b5-a722cfc490c4","sha":"c84ee4c5293718ce4b4f7c8b6e4f502449b5aa34"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","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: Robert Jaszczurek <[email protected]>
Summary
Fix for: #194027.
Fixed issue with disappearing
rows per page
button.Enhanced the logic to display only relevant pagination options, showing the first larger option, which works like 'show all'.
rows per page
options will be:5,10,20,50
.Screen.Recording.2024-10-01.at.11.05.48.mov