-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Alerting: Paginate result previews #65257
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
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
konrad147
left a comment
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.
Nice! one nit
| // sometimes we receive results where every value is just "null" when noData occurs | ||
| const emptyResults = isEmptySeries(series); | ||
| const isTimeSeriesResults = !emptyResults && isTimeSeriesFrames(series); | ||
| const resultPages = chunk(series, PAGE_SIZE); |
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.
You can try to use usePagination hook (from (public/app/features/alerting/unified/hooks/usePagination.ts) to remove some of the pagination handling code.
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 thought that for this particular case it would be more simple and clear to use chunk from lodash (we only go forward and backward, we don't go directly to the page)
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.
Hmm, but you had to implement pagination logic once again (pageStart, pageEnd, clamp, chunk)
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.
Yea I think we can re-use that one, I forgot we had that :D It doesn't seem to expose the start and end of the current page but that's easy to add to the hook 👍
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 exposes numberOfPages which should be enough :)
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.
ahh ok! nice!
Co-authored-by: konrad147 <[email protected]>
|
Updated PR with the following changes: Using Made the following changes to the
|
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: konrad147 <[email protected]> Co-authored-by: Sonia Aguilar <[email protected]> (cherry picked from commit 409bd33)
Co-authored-by: konrad147 <[email protected]> Co-authored-by: Sonia Aguilar <[email protected]>
What is this feature?
Adds a pagination to the bottom of expression results when previewing alerts from a data query with more than 20 series (multi-dimensional alert rule).
Why do we need this feature?
Large query results could crash the browser (10k+)
Which issue(s) does this PR fix?:
Fixes #64830
Special notes for your reviewer:
Please check that: