From 94e7d20792aeb309fb80ba220e808b99aa3167d8 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Mon, 1 Jun 2026 10:04:22 -0400 Subject: [PATCH] feat(downloads): Logs button on failing-sources rollup rows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Operator-asked 2026-06-01: each row in the "X sources are failing" rollup needs a button to surface the last run's stdout/stderr/error without leaving the Downloads tab to find the matching event row. Wired: - `downloadsStore.loadLastForSource(sourceId)` two-steps via `GET /api/downloads?source_id=N&limit=1` (most recent event) then the existing `loadOne(id)` for the full detail payload. Returns null if no events exist (toast warns). - `FailingSourcesCard` row: new text button `Logs` with `mdi-text-box-search-outline`, per-row spinner via `logLoadingIds`, emits `view-logs` with the source record. - `DownloadsTab.onViewFailingLogs` is the handler — same `DownloadDetailModal` instance the event-row clicks use. --- .../components/subscriptions/DownloadsTab.vue | 18 ++++++++++++++ .../subscriptions/FailingSourcesCard.vue | 24 ++++++++++++++++++- frontend/src/stores/downloads.js | 18 +++++++++++++- 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/subscriptions/DownloadsTab.vue b/frontend/src/components/subscriptions/DownloadsTab.vue index 9a48144..5c26b07 100644 --- a/frontend/src/components/subscriptions/DownloadsTab.vue +++ b/frontend/src/components/subscriptions/DownloadsTab.vue @@ -58,6 +58,7 @@ :retrying-all="retryingAll" @retry="onRetrySource" @retry-all="onRetryAll" + @view-logs="onViewFailingLogs" />
@@ -364,6 +365,23 @@ watch(filterModel, async (m) => { async function openDetail(id) { await store.loadOne(id) } + +async function onViewFailingLogs(source) { + // Find and open the most recent DownloadEvent for this source. + // Reuses the existing DownloadDetailModal — same stdout/stderr/error + // surface the row-click in the events feed shows. + try { + const ev = await store.loadLastForSource(source.id) + if (!ev) { + toast({ + text: `No download events recorded for ${source.artist_name || source.platform} yet.`, + type: 'warning', + }) + } + } catch (e) { + toast({ text: `Failed to load logs: ${e.message}`, type: 'error' }) + } +}