feat: the Wanted view becomes Collection, shaped like Lidarr: an artist catalogue first, the state sections down a left rail (M502 #5577)
release / govulncheck (push) Successful in 21s
release / web (push) Successful in 1m39s
release / go (push) Successful in 1m54s
release / integration (push) Successful in 5m33s
release / android (push) Successful in 5m40s
release / Build signed APK (releases and dev) (push) Successful in 5m56s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 25s
release / Verify release artifacts (tag releases only) (push) Skipped

The section opens on a catalogue of every artist on the list, A–Z with a
letter rail, each card showing how many of their albums are held. An artist
opens on their page: every album of theirs, held or not, with its status,
search, releases and tracks. Wanted, Missing files, Activity, Following and
Blocked sit down a left rail as the sections that show state; Held is gone,
the catalogue shows it. The section moves from /wanted to /collection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-10 21:14:33 -04:00
co-authored by Claude Opus 5.5
parent a4fbe44bd5
commit 358849de77
34 changed files with 994 additions and 356 deletions
+3 -1
View File
@@ -41,7 +41,9 @@ export const qk = {
['adminRequests', { status: status ?? 'all' }] as const,
// Wanted list (M502 #5520). Wants sit under ['adminWants'] so one prefix
// invalidation refreshes every tab and its counts.
adminWants: (state: string, q: string = '') => ['adminWants', { state, q }] as const,
adminWants: (state: string, q: string = '', artist: string = '') =>
['adminWants', { state, q, artist }] as const,
wantArtists: (q: string = '') => ['adminWants', 'artists', { q }] as const,
wantTracks: (id: string) => ['wantTracks', id] as const,
adminFollows: () => ['adminFollows'] as const,
adminFollow: (artistMbid: string) => ['adminFollow', artistMbid] as const,
+24 -2
View File
@@ -571,7 +571,8 @@ export type ResolvedDuplicatesResponse = {
// library: in the library when the list began (#5567).
export type WantReason = 'request' | 'follow' | 'missing' | 'library';
export type WantState = 'wanted' | 'missing' | 'held';
// all: one artist's page, every album of theirs on the list (#5572).
export type WantState = 'wanted' | 'missing' | 'held' | 'all';
// One release group on the wanted list. held_at is set once the library
// holds it; artist_id and album_id link into the library when it has them.
@@ -722,6 +723,8 @@ export type SearchSettings = {
};
export type WantCounts = {
// Artists in the Collection's catalogue (#5572).
artists: number;
wanted: number;
missing: number;
held: number;
@@ -819,7 +822,26 @@ export type UnmatchedAlbum = { album_id: string; title: string; artist: string;
export type LibraryListing = { listed_at: string | null; unlisted: number; unmatched: UnmatchedAlbum[] };
export type WantsPage = Page<Want> & { counts: WantCounts; library: LibraryListing };
// artist heads the list when it is narrowed to one artist's page.
export type WantsPage = Page<Want> & { counts: WantCounts; library: LibraryListing; artist?: WantArtist };
// One artist in the Collection's catalogue (#5572), like Lidarr's artist
// index: how many of their albums on the list are held, of how many.
export type WantArtist = {
artist_mbid: string;
artist_name: string;
sort_name: string;
artist_id?: string;
image_url: string;
albums: number;
held: number;
wanted: number;
missing: number;
downloading: number;
following: boolean;
};
export type WantArtistsPage = Page<WantArtist> & { counts: WantCounts; library: LibraryListing };
// An album's tracks in the Wanted view (#5572): the library's own for an
// album it holds (a lost file marked missing), else MusicBrainz's standard
+36 -5
View File
@@ -13,6 +13,7 @@ import type {
GrabResult,
SearchResult,
SearchSettings,
WantArtistsPage,
WantState,
WantTracks,
WantsPage
@@ -22,10 +23,17 @@ import type {
// artists it follows for new releases, and the release-type profiles that
// say which kinds of release a follow wants.
// q narrows the list to an artist or album whose name holds it (#5572).
export async function listWants(state: WantState, offset: number = 0, q: string = ''): Promise<WantsPage> {
// q narrows the list to an artist or album whose name holds it; artist to
// one artist's page, which the response then heads (#5572).
export async function listWants(
state: WantState,
offset: number = 0,
q: string = '',
artist: string = ''
): Promise<WantsPage> {
const params = new URLSearchParams({ state, offset: String(offset) });
if (q) params.set('q', q);
if (artist) params.set('artist', artist);
return api.get<WantsPage>(`/api/admin/wanted?${params}`);
}
@@ -35,10 +43,10 @@ export function wantsNextOffset(last: WantsPage): number | undefined {
}
// Loads as the page scrolls (rule 172), one tab at a time.
export function createWantsQuery(state: WantState, q: string = '') {
export function createWantsQuery(state: WantState, q: string = '', artist: string = '') {
return createInfiniteQuery({
queryKey: qk.adminWants(state, q),
queryFn: ({ pageParam }) => listWants(state, pageParam as number, q),
queryKey: qk.adminWants(state, q, artist),
queryFn: ({ pageParam }) => listWants(state, pageParam as number, q, artist),
initialPageParam: 0,
getNextPageParam: wantsNextOffset,
// A new filter keeps the list it narrows on screen until its answer comes.
@@ -47,6 +55,29 @@ export function createWantsQuery(state: WantState, q: string = '') {
});
}
// The Collection's catalogue (#5572): every artist on the list, A–Z, with
// how many of their albums are held. Its first page carries every section's
// count.
export async function listWantArtists(offset: number = 0, q: string = ''): Promise<WantArtistsPage> {
const params = new URLSearchParams({ offset: String(offset) });
if (q) params.set('q', q);
return api.get<WantArtistsPage>(`/api/admin/wanted/artists?${params}`);
}
export function createWantArtistsQuery(q: string = '') {
return createInfiniteQuery({
queryKey: qk.wantArtists(q),
queryFn: ({ pageParam }) => listWantArtists(pageParam as number, q),
initialPageParam: 0,
getNextPageParam: (last: WantArtistsPage) => {
const loaded = last.offset + last.items.length;
return last.items.length === 0 || loaded >= last.total ? undefined : loaded;
},
placeholderData: keepPreviousData,
staleTime: 30_000
});
}
// An album's tracks (#5572): the library's own for an album it holds,
// otherwise MusicBrainz's standard edition.
export async function getWantTracks(id: string): Promise<WantTracks> {