-
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
[Logs UI] Add pagination to the log stream shared component #81193
[Logs UI] Add pagination to the log stream shared component #81193
Conversation
Extend the API response with `hasMoreBefore` and `hasMoreAfter` attributes. The value is a three-state boolean, where `undefined` means "we don't know if there are more pages". The API calls go in one direction, either before a `cursor`, or after it. To check if there are entries in the opposite direction we would need to do an extra API call. Instead of doing that for every request, we delegate the responsibility of doing the extra API call to the clients.
Pinging @elastic/logs-metrics-ui (Team:logs-metrics-ui) |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
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.
@weltenwort it's probably unrelated. I will take a look tomorrow morning though just to be sure and open a ticket 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.
Thanks for providing such a clear progression of the implementation. This made it easier to read. 👍 It seemed work in general, but the "view-in-context" modal still behaves weird for me in Chromium (as mentioned in a previous comment).
Aside from a few style and edge-case nits I noticed that too many queries might be fired when scrolling towards an edge. I commented on that below.
x-pack/plugins/infra/public/containers/logs/log_stream/index.ts
Outdated
Show resolved
Hide resolved
The |
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 "fetch storm" on scroll is gone, feels pretty solid - nice job 👏
The ACs mention documentation. Is there anything to be done here?
const prevStartTimestamp = usePrevious(startTimestamp); | ||
const prevEndTimestamp = usePrevious(endTimestamp); |
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, I love the expressiveness of usePrevious
!
I don't think so. Initially I thought it would be interesting to disable the pagination with a prop, but I cannot think of a use case for it. Since the consumers cannot control how it works there's nothing to add to the docs. |
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
* master: [Advanced Settings] Introducing telemetry (elastic#82860) [alerts] add executionStatus to event log doc for action execute (elastic#82401) Add additional sources routes (elastic#83227) [ML] Persisted URL state for the "Anomaly detection jobs" page (elastic#83149) [Logs UI] Add pagination to the log stream shared component (elastic#81193) [Index Management] Add an index template link to data stream details (elastic#82592) Add maps_oss folder to code_owners (elastic#83204) fix truncation issue (elastic#83000) [Ingest Manger] Move asset getters out of registry (elastic#83214)
… alerts/action-groups-as-conditions * origin/alerts/stack-alerts-public: (91 commits) removed import from plugin code as it causes FTR to fail [Advanced Settings] Introducing telemetry (elastic#82860) [alerts] add executionStatus to event log doc for action execute (elastic#82401) Add additional sources routes (elastic#83227) [ML] Persisted URL state for the "Anomaly detection jobs" page (elastic#83149) [Logs UI] Add pagination to the log stream shared component (elastic#81193) [Index Management] Add an index template link to data stream details (elastic#82592) Add maps_oss folder to code_owners (elastic#83204) fix truncation issue (elastic#83000) [Ingest Manger] Move asset getters out of registry (elastic#83214) make defaulted field non maybe Remove unused asciidoc file (elastic#83228) [Lens] Remove background from lens embeddable (elastic#83061) [Discover] Unskip flaky tests based on discover fixture index pattern (elastic#82991) Removing unnecessary trailing slash in CODEOWNERS Trying to fix CODEOWNERS again, where was a non-existent team prior (elastic#83236) Trying to fix CODEOWERS, missing a starting slash (elastic#83233) skip flaky suite (elastic#83231) Add enzyme rerender test helper (elastic#83208) Move Elasticsearch type definitions out of APM (elastic#83081) ...
…1193) (#83283) Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
Summary
Closes #77033
Closes #61848
This PR implements infinite scroll (AKA pagination) in the log stream shared component.
The first two commits change the existing
/log_entries/entries
API to return thehasMoreBefore
andhasMoreAfter
flags. The UI will use this information to decide if it should try to query the API to fetch more pages when the user scrolls.The third commit uses this new flags in the existing log stream page.
The rest of the commits implement the pagination for the shared log stream component.