feat: the Wanted view lists artists A–Z with their albums inside, each album's tracks a click away (M502 #5572)
release / govulncheck (push) Successful in 21s
release / web (push) Successful in 1m20s
release / go (push) Successful in 1m38s
release / integration (push) Successful in 5m35s
release / android (push) Successful in 5m59s
release / Build signed APK (releases and dev) (push) Successful in 6m10s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 26s
release / Verify release artifacts (tag releases only) (push) Skipped
release / govulncheck (push) Successful in 21s
release / web (push) Successful in 1m20s
release / go (push) Successful in 1m38s
release / integration (push) Successful in 5m35s
release / android (push) Successful in 5m59s
release / Build signed APK (releases and dev) (push) Successful in 6m10s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 26s
release / Verify release artifacts (tag releases only) (push) Skipped
The list runs like the library: artists by the library's sort name, each artist's albums oldest first, grouped under the artist (linked into the library when it holds them). A filter narrows it to an artist or album by name, on the server, so it finds what has not been scrolled to. Tracks opens an album's track list: the library's own for an album it holds, a lost file marked, otherwise MusicBrainz's standard edition, named. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -41,7 +41,8 @@ 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) => ['adminWants', { state }] as const,
|
||||
adminWants: (state: string, q: string = '') => ['adminWants', { state, q }] as const,
|
||||
wantTracks: (id: string) => ['wantTracks', id] as const,
|
||||
adminFollows: () => ['adminFollows'] as const,
|
||||
adminFollow: (artistMbid: string) => ['adminFollow', artistMbid] as const,
|
||||
releaseProfiles: () => ['releaseProfiles'] as const,
|
||||
|
||||
@@ -821,6 +821,13 @@ export type LibraryListing = { listed_at: string | null; unlisted: number; unmat
|
||||
|
||||
export type WantsPage = Page<Want> & { 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
|
||||
// edition, named by edition; none when MusicBrainz lists no edition.
|
||||
export type WantTrack = { disc: number; number: number; title: string; length_ms: number; missing: boolean };
|
||||
|
||||
export type WantTracks = { source: 'library' | 'musicbrainz' | 'none'; edition?: string; tracks: WantTrack[] };
|
||||
|
||||
export type Follow = {
|
||||
artist_mbid: string;
|
||||
artist_name: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createInfiniteQuery, createQuery } from '@tanstack/svelte-query';
|
||||
import { createInfiniteQuery, createQuery, keepPreviousData } from '@tanstack/svelte-query';
|
||||
import { api } from './client';
|
||||
import { qk } from './queries';
|
||||
import type {
|
||||
@@ -14,6 +14,7 @@ import type {
|
||||
SearchResult,
|
||||
SearchSettings,
|
||||
WantState,
|
||||
WantTracks,
|
||||
WantsPage
|
||||
} from './types';
|
||||
|
||||
@@ -21,8 +22,11 @@ import type {
|
||||
// artists it follows for new releases, and the release-type profiles that
|
||||
// say which kinds of release a follow wants.
|
||||
|
||||
export async function listWants(state: WantState, offset: number = 0): Promise<WantsPage> {
|
||||
return api.get<WantsPage>(`/api/admin/wanted?state=${state}&offset=${offset}`);
|
||||
// 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> {
|
||||
const params = new URLSearchParams({ state, offset: String(offset) });
|
||||
if (q) params.set('q', q);
|
||||
return api.get<WantsPage>(`/api/admin/wanted?${params}`);
|
||||
}
|
||||
|
||||
export function wantsNextOffset(last: WantsPage): number | undefined {
|
||||
@@ -31,16 +35,32 @@ export function wantsNextOffset(last: WantsPage): number | undefined {
|
||||
}
|
||||
|
||||
// Loads as the page scrolls (rule 172), one tab at a time.
|
||||
export function createWantsQuery(state: WantState) {
|
||||
export function createWantsQuery(state: WantState, q: string = '') {
|
||||
return createInfiniteQuery({
|
||||
queryKey: qk.adminWants(state),
|
||||
queryFn: ({ pageParam }) => listWants(state, pageParam as number),
|
||||
queryKey: qk.adminWants(state, q),
|
||||
queryFn: ({ pageParam }) => listWants(state, pageParam as number, q),
|
||||
initialPageParam: 0,
|
||||
getNextPageParam: wantsNextOffset,
|
||||
// A new filter keeps the list it narrows on screen until its answer comes.
|
||||
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> {
|
||||
return api.get<WantTracks>(`/api/admin/wanted/${id}/tracks`);
|
||||
}
|
||||
|
||||
export function createWantTracksQuery(id: string) {
|
||||
return createQuery({
|
||||
queryKey: qk.wantTracks(id),
|
||||
queryFn: () => getWantTracks(id),
|
||||
staleTime: 5 * 60_000
|
||||
});
|
||||
}
|
||||
|
||||
export async function removeWant(id: string): Promise<void> {
|
||||
await api.del(`/api/admin/wanted/${id}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user