- Nouveau domaine `system` avec `logsStore` (Pinia) filtré sur status=failed&type=scraping_job, tri, pagination et suppression - Composant `LogItem` : affiche titre manga, chapitre, date, durée, domaine source (lien vers page d'édition), badge type scraping, slug utilisé, message d'erreur expandable - Page `LogsPage` : toolbar avec badge total, dropdown tri, rafraîchir, tout supprimer ; charge les ContentSources pour enrichir l'affichage - Route /system/logs branchée sur LogsPage - ApiJobRepository : ajout du paramètre `type` dans getJobs - Job entity : ajout des champs startedAt et completedAt
62 lines
1.5 KiB
JavaScript
62 lines
1.5 KiB
JavaScript
export class Job {
|
|
constructor({
|
|
id,
|
|
type,
|
|
status,
|
|
progress = 0,
|
|
payload = {},
|
|
result = null,
|
|
error = null,
|
|
failureReason = null,
|
|
createdAt = new Date().toISOString(),
|
|
updatedAt = new Date().toISOString(),
|
|
startedAt = null,
|
|
completedAt = null,
|
|
attempts = 0,
|
|
maxAttempts = 1,
|
|
context = {}
|
|
}) {
|
|
this.id = id;
|
|
this.type = type;
|
|
this.status = status;
|
|
this.progress = progress;
|
|
this.payload = payload;
|
|
this.result = result;
|
|
this.error = failureReason ?? error;
|
|
this.createdAt = createdAt;
|
|
this.updatedAt = updatedAt;
|
|
this.startedAt = startedAt;
|
|
this.completedAt = completedAt;
|
|
this.attempts = attempts;
|
|
this.maxAttempts = maxAttempts;
|
|
this.context = context;
|
|
}
|
|
|
|
static create(data) {
|
|
return new Job(data);
|
|
}
|
|
|
|
isActive() {
|
|
return ['pending', 'in_progress'].includes(this.status);
|
|
}
|
|
|
|
hasError() {
|
|
return this.status === 'failed';
|
|
}
|
|
|
|
isCompleted() {
|
|
return this.status === 'completed';
|
|
}
|
|
}
|
|
|
|
export class JobCollection {
|
|
constructor(items, total, page, limit, hasNextPage, hasPreviousPage) {
|
|
this.items = items.map(item => Job.create(item));
|
|
this.total = total;
|
|
this.page = page;
|
|
this.limit = limit;
|
|
this.hasNextPage = hasNextPage;
|
|
this.hasPreviousPage = hasPreviousPage;
|
|
}
|
|
}
|