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

[Discover][SavedSearch] Fix default rowsPerPage for Dashboard panels #189717

Merged
merged 4 commits into from
Aug 7, 2024

Conversation

jughosta
Copy link
Contributor

@jughosta jughosta commented Aug 1, 2024

Summary

This PR fixes an issue with rowsPerPage Advanced Setting: after the refactoring it was ignored.

To test:
Change rowsPerPage on Advanced Setting page, navigate to Dashboard and add a saved search panel. It should use the configured value by default. The default value can be overwritten by custom panel settings or saved search own settings.

Checklist

@jughosta jughosta added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. labels Aug 1, 2024
@jughosta jughosta self-assigned this Aug 1, 2024
@jughosta
Copy link
Contributor Author

jughosta commented Aug 1, 2024

/ci

Comment on lines 98 to 100
const rowsPerPage$ = new BehaviorSubject<number | undefined>(
initialState.rowsPerPage ?? defaultRowsPerPage
);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Heenawter Is it a right way of fixing or it should be changed somewhere else?

Copy link
Contributor

@Heenawter Heenawter Aug 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This definitely works!! Did a quick test and, because of how we are serializing this value, rowsPerPage will always be saved as part of the panel when it is overwritten by defaultRowsPerPage unless defaultRowsPerPage is equal to the value of the saved search rows per page. Is this desired? if not, I think you have two options:

  1. You leave this as-is and add a special case for rowPerPage in your serialize so that you only add it to the serialized panel if it's not equal to the saved search rowsPerPage or the default rows per page. (this feels like overkill to me personally)
  2. You overwrite in the component instead, so that this value never gets saved. (this seems cleanest?)

But again, if you're fine with the current behaviour, I personally don't see anything wrong with 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.

@Heenawter Thanks for the suggestions! I will look then into switching to (2).

@jughosta jughosta marked this pull request as ready for review August 1, 2024 14:04
@jughosta jughosta requested a review from a team as a code owner August 1, 2024 14:04
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@jughosta jughosta marked this pull request as draft August 1, 2024 14:09
@jughosta
Copy link
Contributor Author

jughosta commented Aug 1, 2024

/ci

@jughosta jughosta marked this pull request as ready for review August 1, 2024 16:32
@jughosta jughosta requested a review from Heenawter August 1, 2024 16:32
Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes look good and it works well, thanks for fixing it!

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
discover 976 977 +1

Async chunks

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

id before after diff
discover 835.5KB 835.6KB +197.0B

History

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

cc @jughosta

Copy link
Contributor

@Heenawter Heenawter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review only - implementation LGTM 👍

@jughosta jughosta merged commit a74e5a0 into elastic:main Aug 7, 2024
20 checks passed
@jughosta jughosta deleted the fix-rows-per-page-on-dashboard branch August 7, 2024 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants