SABnzbd/NZBGet: show recent history inline on the downloads page - #100
Open
ndandan wants to merge 3 commits into
Open
SABnzbd/NZBGet: show recent history inline on the downloads page#100ndandan wants to merge 3 commits into
ndandan wants to merge 3 commits into
Conversation
History entries knew *what* finished but never *when*. Add a nullable `completedAt` unix epoch to UsenetDownload and map it in both clients: SABnzbd's history slot `completed`, NZBGet's history entry `HistoryTime` (the epoch the job landed in history). Absent or 0 stays null so the UI never renders a 1970 date. Queue slots leave it null — only history carries a finish time. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ream Shoshuo#47 The downloads page showed the live queue only: once a job finished it vanished, and answering "did that grab actually land?" meant a trip to the dedicated history page. Add a "Recent history" section under the queue — the last 15 entries, server-rendered at page load (no poller: history doesn't move on its own), each row showing its finish age, plus a "View all (N)" link into the paginated page. The row loop moves verbatim from history.html.twig into a shared _history_rows.html.twig partial, which also carries the .uh-* CSS so both pages get it from the single include instead of duplicating the block. Both pages gain the relative-age line from the new completedAt field. index() skips the fetch when the render-time probe already failed (the page shows its unreachable banner) and swallows any client error into an empty list, so a broken downloader never takes the page with it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…heet blocks Two review follow-ups on the Shoshuo#47 preview. 1. NZBGet's history RPC has no upstream paging — getHistoryPage() pulls the whole retained history (Parameters, ScriptStatuses, per-server ServerStats and all) and slices locally, so the new per-render fetch was an unbounded transfer on that client. Wrap it in a short per-client cache (usenet.recent_history.<client>, 45s — MediaLibraryCache's window), so repeat renders inside the window cost nothing upstream. No invalidation needed: history only grows when a job finishes. An empty result expires immediately and a throwing fetch caches nothing, so neither a fresh install nor a transient failure is pinned for the window. The paginated history page is untouched — it stays live and user-driven. 2. The .uh-* rules move out of the body-level <style> in the rows partial into _history_styles.html.twig, included from the {% block stylesheets %} of both usenet pages — the repo's own dashboard/_plex_styles.html.twig idiom, and conforming HTML. The rows partial is markup only now. Tests pin the fetch window (with(0, 15)), the cache short-circuit (two renders, one client call — which also proves the UsenetDownload DTOs survive the pool round-trip) and the retry-after-failure behaviour. The class clears both clients' cache keys in setUp() so the filesystem pool can't leak state between tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #47.
Adds a server-rendered Recent history section (latest 15, compact one-line rows: name + category/status/size pills + a new age pill) below the queue on the downloads page, with a "View all" link to the full paginated history page. Works for both SABnzbd and NZBGet.
Implementation notes:
UsenetDownloadgains a nullablecompletedAtepoch, mapped from SABnzbd'scompletedand NZBGet'sHistoryTime; the age pill renders via the existingrelative_datefilter and falls back to an em dash when unknown. (This also adds the age line to the history page itself.)_history_rows.html.twigpartial; the.uh-*CSS moves to_history_styles.html.twig, included from both pages'stylesheetsblock.getHistoryPage()is a full-history RPC transfer sliced locally — without the cache every downloads-page render would re-transfer the entire retained history. The paginated history page stays uncached/live.Tests: completedAt mapping units for both clients; render, arg-pinning (
->with(0, 15)), cache short-circuit (two renders → one client call), and error-path functional tests. 48 tests / 132 assertions green,lint:twig+lint:yamlclean, EN+FR keys included.🤖 Generated with Claude Code