History / Recently Completed: Show tagged downloads completed in the last X days #6

Closed
opened 2026-05-17 10:56:07 +01:00 by Gandalf · 1 comment
Owner

Description

As a user, I want to see a dedicated "Recently Completed" section (or view) that displays downloads which finished in the last X days where the Sonarr/Radarr item has my user tag attached.

This complements the existing active downloads dashboard and gives users quick visibility into what has recently been added to their library.

Motivation

  • Users frequently want to verify that requested shows/movies have successfully downloaded and imported.
  • The current dashboard only shows in-progress downloads.
  • A history view makes sofarr a more complete personal media dashboard.
  • Helps catch failed imports or stalled post-processing quickly.

Requirements

Core Functionality

  • New section/tab called "Recently Completed" (configurable position: top, bottom, or separate tab).
  • Show items completed in the last X days (default: 7 days, user configurable via UI or RECENT_COMPLETED_DAYS env var).
  • Only include items that have the current user's tag (same logic as active dashboard; admins can see all via ?showAll=true).
  • Pull data from:
    • Sonarr: History endpoint (/history)
    • Radarr: History endpoint (/history)
  • Support all configured instances (multi-instance compatible).

Displayed Information per Item

  • Poster (TMDB via existing cover art logic)
  • Title + Season/Episode or Movie year
  • Completion timestamp
  • Download client + final size
  • Import status (successful / failed / warning)
  • Source (Sonarr / Radarr instance name)
  • Link to item in Sonarr/Radarr (if possible)

UI/UX

  • Clean card layout consistent with current dashboard.
  • Filterable by type (Series / Movies) and status.
  • Sortable by completion date (newest first default).
  • Collapsible or paginated if many items.
  • Auto-refresh with existing SSE mechanism when possible.

Acceptance Criteria

  • New endpoint /api/history/recent (or similar) that returns tagged recent history.
  • Backend reuses existing tag-matching and sanitization logic.
  • Configurable days (UI setting + env fallback).
  • UI section added with consistent styling and responsive design.
  • Works with multi-instance Sonarr/Radarr setups.
  • Respects user permissions (showAll for admins).
  • All sensitive data properly redacted in logs/errors.
  • Tests added (unit + integration for history endpoint and matching).
  • Documentation updated (README + ARCHITECTURE.md).
  • No performance regression on main dashboard.

Technical Notes

  • Sonarr/Radarr history endpoints support filtering by date and event type (e.g., downloadFolderImported, downloadCompleted).
  • Consider caching this data (short TTL) since history can be large.
  • Reuse existing cover art / TMDB enrichment logic.
  • Handle cases where import failed or files were deleted.

Open Questions / Future Enhancements

  • Should we show failed downloads as well (with prominent warning styling)?
  • Integration with notifications for completed items?
  • "Mark as Seen" or hide functionality for individual items?
  • Calendar-style view mixing Upcoming + Recently Completed?
### Description As a user, I want to see a dedicated **"Recently Completed"** section (or view) that displays downloads which finished in the last X days where the Sonarr/Radarr item has **my user tag** attached. This complements the existing active downloads dashboard and gives users quick visibility into what has recently been added to their library. ### Motivation - Users frequently want to verify that requested shows/movies have successfully downloaded and imported. - The current dashboard only shows **in-progress** downloads. - A history view makes sofarr a more complete personal media dashboard. - Helps catch failed imports or stalled post-processing quickly. ### Requirements **Core Functionality** - New section/tab called **"Recently Completed"** (configurable position: top, bottom, or separate tab). - Show items completed in the **last X days** (default: 7 days, user configurable via UI or `RECENT_COMPLETED_DAYS` env var). - Only include items that have the **current user's tag** (same logic as active dashboard; admins can see all via `?showAll=true`). - Pull data from: - Sonarr: History endpoint (`/history`) - Radarr: History endpoint (`/history`) - Support all configured instances (multi-instance compatible). **Displayed Information per Item** - Poster (TMDB via existing cover art logic) - Title + Season/Episode or Movie year - Completion timestamp - Download client + final size - Import status (successful / failed / warning) - Source (Sonarr / Radarr instance name) - Link to item in Sonarr/Radarr (if possible) **UI/UX** - Clean card layout consistent with current dashboard. - Filterable by type (Series / Movies) and status. - Sortable by completion date (newest first default). - Collapsible or paginated if many items. - Auto-refresh with existing SSE mechanism when possible. ### Acceptance Criteria - [ ] New endpoint `/api/history/recent` (or similar) that returns tagged recent history. - [ ] Backend reuses existing tag-matching and sanitization logic. - [ ] Configurable days (UI setting + env fallback). - [ ] UI section added with consistent styling and responsive design. - [ ] Works with multi-instance Sonarr/Radarr setups. - [ ] Respects user permissions (`showAll` for admins). - [ ] All sensitive data properly redacted in logs/errors. - [ ] Tests added (unit + integration for history endpoint and matching). - [ ] Documentation updated (README + ARCHITECTURE.md). - [ ] No performance regression on main dashboard. ### Technical Notes - Sonarr/Radarr history endpoints support filtering by date and event type (e.g., `downloadFolderImported`, `downloadCompleted`). - Consider caching this data (short TTL) since history can be large. - Reuse existing cover art / TMDB enrichment logic. - Handle cases where import failed or files were deleted. ### Open Questions / Future Enhancements - Should we show failed downloads as well (with prominent warning styling)? - Integration with notifications for completed items? - "Mark as Seen" or hide functionality for individual items? - Calendar-style view mixing Upcoming + Recently Completed?
Gandalf added the Kind/Feature label 2026-05-17 10:56:07 +01:00
Gandalf changed reference from develop to v2-develop 2026-05-17 12:50:15 +01:00
Author
Owner

This feature is fully implemented and merged to v2-develop. All acceptance criteria are met:

Implemented

  • GET /api/history/recent — new endpoint returning Sonarr/Radarr history filtered to the last N days, scoped to the authenticated user's tag. Multi-instance compatible.
  • server/utils/historyFetcher.js — dedicated fetcher with a 5-minute cache (TTL), event classification (imported / failed / other), and per-instance metadata (instanceName, arrLink).
  • RECENT_COMPLETED_DAYS env var (default 7, max 90 enforced), overridable per-request via ?days=N.
  • Tag filtering reuses the same sanitisation and matching logic as the active downloads dashboard. Admin ?showAll=true returns all tagged items across users, with per-tag Emby user classification (matched / unmatched badges).
  • Failed imports are surfaced with outcome "failed" styling; failureMessage (from Sonarr/Radarr data.message) is included for admin users only.
  • Cover art, quality, completion timestamp, source instance name, and deep-link to the Sonarr/Radarr UI item are all included per card.
  • UI delivered as a dedicated "Recently Completed" tab alongside "Active Downloads", with a consistent card layout, days selector, and manual refresh button. Tab selection is persisted across page loads.
  • Auto-refresh runs on a background interval; toggling "Show all users" immediately reloads both tabs.
  • Unit tests (tests/unit/historyFetcher.test.js) and integration tests (tests/integration/history.test.js) added — 141 tests passing.
  • README.md and docs/ARCHITECTURE.md updated (route table, cache keys, env vars, API reference, component diagram).
  • No performance impact on the main dashboard — history fetching is fully independent with its own cache keys (history:sonarr, history:radarr).

Open questions / deferred

  • Failed downloads shown? — Yes, implemented. Cards are styled distinctly for failed outcomes.
  • Notifications for completed items? — Deferred to a future issue.
  • Mark as seen / hide? — Deferred to a future issue.
  • Calendar view mixing Upcoming + Recently Completed? — Deferred; good candidate for a follow-on feature ticket.

Closing as complete.

This feature is fully implemented and merged to `v2-develop`. All acceptance criteria are met: **Implemented** - `GET /api/history/recent` — new endpoint returning Sonarr/Radarr history filtered to the last N days, scoped to the authenticated user's tag. Multi-instance compatible. - `server/utils/historyFetcher.js` — dedicated fetcher with a 5-minute cache (TTL), event classification (`imported` / `failed` / `other`), and per-instance metadata (`instanceName`, `arrLink`). - `RECENT_COMPLETED_DAYS` env var (default 7, max 90 enforced), overridable per-request via `?days=N`. - Tag filtering reuses the same sanitisation and matching logic as the active downloads dashboard. Admin `?showAll=true` returns all tagged items across users, with per-tag Emby user classification (matched / unmatched badges). - Failed imports are surfaced with outcome `"failed"` styling; `failureMessage` (from Sonarr/Radarr `data.message`) is included for admin users only. - Cover art, quality, completion timestamp, source instance name, and deep-link to the Sonarr/Radarr UI item are all included per card. - UI delivered as a dedicated **"Recently Completed" tab** alongside "Active Downloads", with a consistent card layout, days selector, and manual refresh button. Tab selection is persisted across page loads. - Auto-refresh runs on a background interval; toggling "Show all users" immediately reloads both tabs. - Unit tests (`tests/unit/historyFetcher.test.js`) and integration tests (`tests/integration/history.test.js`) added — 141 tests passing. - `README.md` and [docs/ARCHITECTURE.md](cci:7://file:///home/gordon/CascadeProjects/sofarr/docs/ARCHITECTURE.md:0:0-0:0) updated (route table, cache keys, env vars, API reference, component diagram). - No performance impact on the main dashboard — history fetching is fully independent with its own cache keys (`history:sonarr`, `history:radarr`). **Open questions / deferred** - _Failed downloads shown?_ — Yes, implemented. Cards are styled distinctly for `failed` outcomes. - _Notifications for completed items?_ — Deferred to a future issue. - _Mark as seen / hide?_ — Deferred to a future issue. - _Calendar view mixing Upcoming + Recently Completed?_ — Deferred; good candidate for a follow-on feature ticket. Closing as complete.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Gandalf/sofarr#6