refactor: update job kind display logic in schedule page
CI / changes (push) Successful in 6s
CI / openapi (push) Has been skipped
CI / go (push) Has been skipped
CI / docker-web (deploy/docker/evobgp-web/Dockerfile, , evobgp-web) (push) Successful in 1m7s
CI / docker-web (deploy/docker/evobgp-web/Dockerfile, evobgp-all, evobgp-web-all) (push) Successful in 1m8s
CI / docker-bird (push) Has been skipped
CI / bird2 (push) Has been skipped
CI / docker-go-prime (push) Has been skipped
CI / docker-go (deploy/docker/evobgp-agent/Dockerfile, , evobgp-agent) (push) Has been skipped
CI / docker-go (evobgp-all, 1, deploy/docker/gobinary/Dockerfile, , evobgp-all) (push) Has been skipped
CI / docker-go (evobgp-api, 1, deploy/docker/gobinary/Dockerfile, , evobgp-api) (push) Has been skipped
CI / docker-go (evobgp-deploy, 0, deploy/docker/gobinary/Dockerfile, , evobgp-deploy) (push) Has been skipped
CI / docker-go (evobgp-ingest, 0, deploy/docker/gobinary/Dockerfile, , evobgp-ingest) (push) Has been skipped
CI / docker-go (evobgp-node, 0, deploy/docker/gobinary/Dockerfile, , evobgp-node) (push) Has been skipped
CI / docker-go (evobgp-render, 0, deploy/docker/gobinary/Dockerfile, , evobgp-render) (push) Has been skipped
CI / docker-go (evobgp-scheduler, 0, deploy/docker/gobinary/Dockerfile, , evobgp-scheduler) (push) Has been skipped

Replaced the job kind filter with a new function to improve the display of job kinds in the schedule page. Introduced a derived map for module names to enhance job information presentation. This change streamlines the rendering of job details, improving clarity and user experience.
This commit is contained in:
Denozordec
2026-04-08 15:59:17 +07:00
parent ae9fbe30b4
commit dc1f4a59b0
+4 -2
View File
@@ -16,7 +16,8 @@
import { toast } from 'svelte-sonner'; import { toast } from 'svelte-sonner';
import RefreshCw from '@lucide/svelte/icons/refresh-cw'; import RefreshCw from '@lucide/svelte/icons/refresh-cw';
import CalendarClock from '@lucide/svelte/icons/calendar-clock'; import CalendarClock from '@lucide/svelte/icons/calendar-clock';
import { jobKindFilterRu, jobStatusRu, moduleTypeRu } from '$lib/ui-labels.js'; import { jobStatusRu, moduleTypeRu } from '$lib/ui-labels.js';
import { jobKindTitle } from '$lib/operations/job-kind-label.js';
let modules = $state<ModuleRow[]>([]); let modules = $state<ModuleRow[]>([]);
let jobs = $state<JobRow[]>([]); let jobs = $state<JobRow[]>([]);
@@ -74,6 +75,7 @@
} }
const refreshJobs = $derived(jobs.filter((j) => j.kind === 'module_refresh')); const refreshJobs = $derived(jobs.filter((j) => j.kind === 'module_refresh'));
const moduleNameById = $derived(new Map(modules.map((m) => [m.id, m.name])));
const runningJobsCount = $derived(jobs.filter((j) => j.status === 'running' || j.status === 'queued').length); const runningJobsCount = $derived(jobs.filter((j) => j.status === 'running' || j.status === 'queued').length);
const failedJobsCount = $derived(jobs.filter((j) => j.status === 'failed').length); const failedJobsCount = $derived(jobs.filter((j) => j.status === 'failed').length);
</script> </script>
@@ -175,7 +177,7 @@
<TableBody> <TableBody>
{#each jobs as j (j.job_id)} {#each jobs as j (j.job_id)}
<TableRow> <TableRow>
<TableCell class="font-medium">{jobKindFilterRu(j.kind)}</TableCell> <TableCell class="font-medium">{jobKindTitle(j, moduleNameById)}</TableCell>
<TableCell><Badge variant={jobStatusVariant(j.status)}>{jobStatusRu(j.status)}</Badge></TableCell> <TableCell><Badge variant={jobStatusVariant(j.status)}>{jobStatusRu(j.status)}</Badge></TableCell>
<TableCell class="text-xs text-muted-foreground">{j.created_at ? new Date(j.created_at).toLocaleString('ru') : '—'}</TableCell> <TableCell class="text-xs text-muted-foreground">{j.created_at ? new Date(j.created_at).toLocaleString('ru') : '—'}</TableCell>
<TableCell class="text-xs text-destructive max-w-xs truncate">{j.error ?? ''}</TableCell> <TableCell class="text-xs text-destructive max-w-xs truncate">{j.error ?? ''}</TableCell>