feat(requests): show ingest progress while requests are in flight
After Lidarr accepts a request the local reconciler imports albums and
tracks as they arrive — but until the request hit 'completed' the
operator had no way to see "is anything happening?" The /requests and
/admin/requests rows now surface a live progress line whenever the
request's matched entity has children in our library.
Backend:
- New CountAlbumsByArtist + CountTracksByArtist sqlc queries.
- requestView gains imported_album_count and imported_track_count.
- New fillProgress helper computes them from the matched entity:
- kind=artist → counts albums + tracks under matched_artist_id
- kind=album → counts tracks under matched_album_id
- kind=track → 1 once matched_track_id is set
N+1 in the list endpoints; acceptable at admin scale.
- handleListRequests, handleGetRequest, and handleListAdminRequests
populate the new fields on every response.
Frontend:
- LidarrRequest TS type extended with the two counters.
- Both the operator's /requests page and the admin /admin/requests
page render an accent-colored line under the row meta when at
least one counter is non-zero, e.g.:
Artist: "5 albums · 47 tracks ingested"
Album: "12 tracks ingested"
Track: "Track ingested"
- Updated test fixtures to include the new required fields.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -90,3 +90,9 @@ WHERE t.artist_id = $1
|
||||
)
|
||||
ORDER BY albums.release_date NULLS LAST, albums.sort_title,
|
||||
t.disc_number NULLS FIRST, t.track_number NULLS FIRST, t.id;
|
||||
|
||||
-- name: CountTracksByArtist :one
|
||||
-- Used by request-progress reporting to count tracks ingested under a
|
||||
-- matched artist (sum across all the artist's albums) while a request
|
||||
-- is still in flight.
|
||||
SELECT COUNT(*) FROM tracks WHERE artist_id = $1;
|
||||
|
||||
Reference in New Issue
Block a user