Skip to content
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

Merged

Conversation

rbrtj
Copy link
Contributor

@rbrtj rbrtj commented Oct 1, 2024

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'.

  • For example, if there are 23 results, the available rows per page options will be: 5,10,20,50.
Screen.Recording.2024-10-01.at.11.05.48.mov

@rbrtj rbrtj added release_note:fix :ml Feature:Anomaly Detection ML anomaly detection v9.0.0 Team:ML Team label for ML (also use :ml) v8.16.0 backport:version Backport to applied version labels v8.15.3 labels Oct 1, 2024
@rbrtj rbrtj self-assigned this Oct 1, 2024
@rbrtj rbrtj requested a review from a team as a code owner October 1, 2024 09:11
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

Copy link
Contributor

@walterra walterra left a 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.

Comment on lines 55 to 62
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[]);
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

@peteharverson peteharverson left a 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.

@peteharverson peteharverson changed the title [ML] Anomaly detection: Fix disappearing rows per page button [ML] Anomaly swim lane: Fix disappearing rows per page button Oct 1, 2024
@rbrtj rbrtj requested a review from walterra October 2, 2024 08:16
Copy link
Contributor

@walterra walterra left a 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!

@rbrtj rbrtj enabled auto-merge (squash) October 2, 2024 09:18
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
ml 2040 2041 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
ml 4.6MB 4.6MB +85.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @rbrtj

@rbrtj rbrtj merged commit c84ee4c into elastic:main Oct 2, 2024
20 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.15, 8.x

https://github.com/elastic/kibana/actions/runs/11141623912

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 2, 2024
…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)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 2, 2024
…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)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.15
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Oct 2, 2024
…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]>
kibanamachine added a commit that referenced this pull request Oct 2, 2024
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels Feature:Anomaly Detection ML anomaly detection :ml release_note:fix Team:ML Team label for ML (also use :ml) v8.15.3 v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants