feat(web): remove scan-schedule admin UI (scheduler retired)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-06 21:52:20 -04:00
parent e994aae613
commit 7426f6c718
5 changed files with 2 additions and 278 deletions
@@ -1,58 +0,0 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { getScanSchedule, updateScanSchedule, type ScanSchedule } from './admin';
vi.mock('./client', () => ({
api: { get: vi.fn(), post: vi.fn(), patch: vi.fn() }
}));
import { api } from './client';
describe('admin scan-schedule API', () => {
beforeEach(() => vi.clearAllMocks());
it('getScanSchedule GETs the correct path', async () => {
const sample: ScanSchedule = {
mode: 'daily',
interval_hours: null,
time_of_day: '03:00',
weekly_day: null,
next_scheduled_at: '2026-05-07T03:00:00Z'
};
(api.get as unknown as ReturnType<typeof vi.fn>).mockResolvedValueOnce(sample);
const got = await getScanSchedule();
expect(api.get).toHaveBeenCalledWith('/api/admin/scan/schedule');
expect(got).toEqual(sample);
});
it('updateScanSchedule PATCHes with the right body', async () => {
const sample: ScanSchedule = {
mode: 'interval',
interval_hours: 6,
time_of_day: null,
weekly_day: null,
next_scheduled_at: '2026-05-06T20:00:00Z'
};
(api.patch as unknown as ReturnType<typeof vi.fn>).mockResolvedValueOnce(sample);
const got = await updateScanSchedule({ mode: 'interval', interval_hours: 6 });
expect(api.patch).toHaveBeenCalledWith('/api/admin/scan/schedule', {
mode: 'interval',
interval_hours: 6
});
expect(got.mode).toBe('interval');
expect(got.interval_hours).toBe(6);
});
it('updateScanSchedule with mode=off sends just mode', async () => {
const sample: ScanSchedule = {
mode: 'off',
interval_hours: null,
time_of_day: null,
weekly_day: null,
next_scheduled_at: null
};
(api.patch as unknown as ReturnType<typeof vi.fn>).mockResolvedValueOnce(sample);
const got = await updateScanSchedule({ mode: 'off' });
expect(api.patch).toHaveBeenCalledWith('/api/admin/scan/schedule', { mode: 'off' });
expect(got.next_scheduled_at).toBe(null);
});
});
-37
View File
@@ -383,43 +383,6 @@ export function createCoverProvidersQuery() {
});
}
// Scan schedule -----------------------------------------------------------
export type ScanScheduleMode = 'off' | 'interval' | 'daily' | 'weekly';
export type ScanSchedule = {
mode: ScanScheduleMode;
interval_hours: number | null;
time_of_day: string | null; // 'HH:MM'
weekly_day: number | null; // 1..7 (Mon..Sun, ISO 8601)
next_scheduled_at: string | null; // RFC3339 ISO timestamp; null when mode='off'
};
export type ScanScheduleUpdate = {
mode: ScanScheduleMode;
interval_hours?: number | null;
time_of_day?: string | null;
weekly_day?: number | null;
};
export async function getScanSchedule(): Promise<ScanSchedule> {
return api.get<ScanSchedule>('/api/admin/scan/schedule');
}
export async function updateScanSchedule(patch: ScanScheduleUpdate): Promise<ScanSchedule> {
return api.patch<ScanSchedule>('/api/admin/scan/schedule', patch);
}
// Settings rarely change in operator time. 60s staleTime; refetches
// on window focus + after any PATCH invalidation — no polling.
export function createScanScheduleQuery() {
return createQuery({
queryKey: qk.scanSchedule(),
queryFn: getScanSchedule,
staleTime: 60_000
});
}
// Admin user-management ------------------------------------------------------
export type AdminUser = {
-1
View File
@@ -46,7 +46,6 @@ export const qk = {
adminPlaybackErrors: (resolved?: boolean) =>
['adminPlaybackErrors', { resolved: resolved ?? false }] as const,
scanStatus: () => ['scanStatus'] as const,
scanSchedule: () => ['scanSchedule'] as const,
coverage: () => ['coverage'] as const,
coverProviders: () => ['coverProviders'] as const,
adminUsers: () => ['adminUsers'] as const,