feat(jellyseer): stat widgets + rich Requests tab (slice 3/3)
Frontend for Jellyseerr request stats, reusing the generic stat abstraction.
- api/jellyseerr.ts + hooks/useJellyseer.ts: fetchJellyseerrStats +
useJellyseerrStats (polls /api/jellyseerr/stats, no-retry; shares the backend
cache with the widgets).
- Two reusable widgets backed by the stat/stats_overview kinds:
- RequestStatWidget: a single selected stat (big value + label).
- RequestsOverviewWidget: a MetricCard grid of all stats + a recent-requests
list with status/media-status badges.
- registry.ts: Jellyfin gains `stat` (a dropdown over
total/pending/approved/declined/processing/available — the "extract one stat
into a widget" affordance, rendered as a Select via the existing enum UI) and
`stats_overview` widget kinds, wired to the new components.
- RequestsTab rewritten: live stats grid (6 counts) + recent-requests list +
a hint to pin individual stats via the Request stat widget. Reads
jellyseerr_url from config and the now-secret jellyseerr_api_key from
secrets_set.
Tests: RequestStatWidget + RequestsOverviewWidget rendering/error; RequestsTab
not-configured CTA, configured stats grid, and error states. 184/184 frontend
tests pass; tsc + ESLint clean.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { get } from "./shared";
|
||||
|
||||
export interface JellyseerStat {
|
||||
key: string;
|
||||
label: string;
|
||||
value: number;
|
||||
}
|
||||
|
||||
export interface JellyseerRecentRequest {
|
||||
id?: number | string;
|
||||
type?: number | string;
|
||||
name?: string;
|
||||
status?: string;
|
||||
media_status?: string;
|
||||
created_at?: number | string;
|
||||
}
|
||||
|
||||
export interface JellyseerrStatsResponse {
|
||||
stats: JellyseerStat[];
|
||||
recent: JellyseerRecentRequest[];
|
||||
detail?: string | null;
|
||||
}
|
||||
|
||||
/** Fetch Jellyseerr request stats for a Jellyfin service instance. */
|
||||
export async function fetchJellyseerrStats(
|
||||
jellyfinServiceId?: string,
|
||||
): Promise<JellyseerrStatsResponse> {
|
||||
return get<JellyseerrStatsResponse>(
|
||||
"/api/jellyseerr/stats",
|
||||
jellyfinServiceId ? { jellyfin_service_id: jellyfinServiceId } : undefined,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user