Some checks failed
Deploy / Deploy Production (push) Has been skipped
Deploy / Cleanup Preview (push) Has been skipped
Deploy / Deploy Preview (push) Failing after 0s
CI / Scraper / Test (pull_request) Failing after 6s
CI / UI / Build (pull_request) Failing after 6s
CI / Scraper / Lint (pull_request) Failing after 11s
CI / Scraper / Build (pull_request) Has been skipped
iOS CI / Build (pull_request) Failing after 2s
iOS CI / Test (pull_request) Has been skipped
New page mirrors the scrape tasks pattern: loads audio_jobs from PocketBase via a new listAudioJobs() helper, shows a filterable table (slug, chapter, voice, status, started, duration, error), and live-polls every 3s while any job is pending or generating. Also fixes the /admin/audio nav active-state check (was startsWith, now exact match) to prevent it from matching /admin/audio-jobs.
18 lines
485 B
TypeScript
18 lines
485 B
TypeScript
import { redirect } from '@sveltejs/kit';
|
|
import type { PageServerLoad } from './$types';
|
|
import { listAudioJobs } from '$lib/server/pocketbase';
|
|
import { log } from '$lib/server/logger';
|
|
|
|
export const load: PageServerLoad = async ({ locals }) => {
|
|
if (locals.user?.role !== 'admin') {
|
|
redirect(302, '/');
|
|
}
|
|
|
|
const jobs = await listAudioJobs().catch((e) => {
|
|
log.warn('admin/audio-jobs', 'failed to load audio jobs', { err: String(e) });
|
|
return [];
|
|
});
|
|
|
|
return { jobs };
|
|
};
|