feat: mcp and backfill fixes
This commit is contained in:
1 parent
c6984a7286
commit
17cd31c41e
20 files changed
+566
-37
No files matched your search
@@ -1,8 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { listJobs } from "$lib/api/endpoints";
|
||||
import { cancelJob, listJobs } from "$lib/api/endpoints";
|
||||
import type { JobStatus, JobView } from "$lib/api/types";
|
||||
import Spinner from "$lib/components/ui/Spinner.svelte";
|
||||
import { formatFull } from "$lib/format/datetime";
|
||||
import { toasts } from "$lib/stores/toasts.svelte";
|
||||
|
||||
interface Props {
|
||||
version?: number;
|
||||
@@ -33,12 +34,32 @@
|
||||
|
||||
let jobs = $state<JobView[]>([]);
|
||||
let loading = $state(true);
|
||||
let canceling = $state<number | null>(null);
|
||||
let timer: ReturnType<typeof setTimeout> | null = null;
|
||||
|
||||
function isActive(list: JobView[]): boolean {
|
||||
return list.some((j) => j.status === "pending" || j.status === "running");
|
||||
}
|
||||
|
||||
function canCancel(job: JobView): boolean {
|
||||
return job.status === "pending" || job.status === "running";
|
||||
}
|
||||
|
||||
async function cancel(job: JobView) {
|
||||
if (canceling !== null) {
|
||||
return;
|
||||
}
|
||||
canceling = job.id;
|
||||
try {
|
||||
await cancelJob(job.id);
|
||||
await load();
|
||||
} catch {
|
||||
toasts.error("Не удалось остановить задачу");
|
||||
} finally {
|
||||
canceling = null;
|
||||
}
|
||||
}
|
||||
|
||||
function schedule() {
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
@@ -96,6 +117,16 @@
|
||||
<div class="job">
|
||||
<div class="job-head">
|
||||
<span class="kind">{kindLabel(job.kind)}</span>
|
||||
{#if canCancel(job)}
|
||||
<button
|
||||
type="button"
|
||||
class="stop"
|
||||
onclick={() => cancel(job)}
|
||||
disabled={canceling === job.id}
|
||||
>
|
||||
Стоп
|
||||
</button>
|
||||
{/if}
|
||||
<span class="badge {job.status}">{STATUS_LABELS[job.status]}</span>
|
||||
</div>
|
||||
<div class="meta">
|
||||
@@ -178,6 +209,33 @@
|
||||
&.failed {
|
||||
background-color: var(--color-error);
|
||||
}
|
||||
|
||||
&.canceled {
|
||||
background-color: var(--color-text-secondary);
|
||||
}
|
||||
}
|
||||
|
||||
.stop {
|
||||
flex-shrink: 0;
|
||||
|
||||
padding: 0.0625rem 0.5rem;
|
||||
border: 1px solid var(--color-error);
|
||||
border-radius: 0.625rem;
|
||||
|
||||
font-size: 0.75rem;
|
||||
color: var(--color-error);
|
||||
cursor: pointer;
|
||||
background-color: transparent;
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
color: var(--color-white);
|
||||
background-color: var(--color-error);
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
|
||||
.meta {
|
||||
|
||||
Reference in new issue
Block a user