Add admin UI for ArtStation re-import
Expose import as a background admin job with status polling, dry-run and optional publish; share logic with the CLI via a service module.
This commit is contained in:
@@ -229,8 +229,43 @@ export const api = {
|
||||
}),
|
||||
reindex: () =>
|
||||
request<{ ok: boolean; indexed: number }>("/api/v1/admin/reindex", { method: "POST" }),
|
||||
|
||||
importArtStation: (body: {
|
||||
username?: string;
|
||||
dryRun?: boolean;
|
||||
publish?: boolean;
|
||||
url?: string;
|
||||
}) =>
|
||||
request<{
|
||||
ok: boolean;
|
||||
message: string;
|
||||
status: ArtStationImportStatus;
|
||||
}>("/api/v1/admin/import/artstation", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(body),
|
||||
}),
|
||||
|
||||
importArtStationStatus: () =>
|
||||
request<ArtStationImportStatus>("/api/v1/admin/import/artstation"),
|
||||
};
|
||||
|
||||
export interface ArtStationImportStatus {
|
||||
running: boolean;
|
||||
startedAt?: string;
|
||||
finishedAt?: string;
|
||||
error?: string;
|
||||
log: string[];
|
||||
result?: {
|
||||
username: string;
|
||||
dryRun: boolean;
|
||||
found: number;
|
||||
imported: number;
|
||||
skipped: number;
|
||||
errors: number;
|
||||
created: { title: string; slug: string }[];
|
||||
};
|
||||
}
|
||||
|
||||
export function mediaSrc(url?: string | null): string {
|
||||
if (!url) return "";
|
||||
if (url.startsWith("http") || url.startsWith("//")) return url;
|
||||
|
||||
Reference in New Issue
Block a user