- Repository list with state badges, stats, and action buttons - Add repository modal for GitHub URLs and local paths - Live indexing progress bar polling every 2s - Confirm dialog for destructive actions - Repository detail page with versions and recent jobs - Settings page placeholder Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
27 lines
662 B
TypeScript
27 lines
662 B
TypeScript
import type { PageServerLoad } from './$types';
|
|
import { error } from '@sveltejs/kit';
|
|
|
|
export const load: PageServerLoad = async ({ fetch, params }) => {
|
|
const id = params.id;
|
|
const res = await fetch(`/api/v1/libs/${encodeURIComponent(id)}`);
|
|
|
|
if (res.status === 404) {
|
|
error(404, 'Repository not found');
|
|
}
|
|
|
|
if (!res.ok) {
|
|
error(res.status, 'Failed to load repository');
|
|
}
|
|
|
|
const repo = await res.json();
|
|
|
|
// Fetch recent jobs
|
|
const jobsRes = await fetch(`/api/v1/jobs?repositoryId=${encodeURIComponent(id)}&limit=5`);
|
|
const jobsData = jobsRes.ok ? await jobsRes.json() : { jobs: [] };
|
|
|
|
return {
|
|
repo,
|
|
recentJobs: jobsData.jobs ?? []
|
|
};
|
|
};
|