diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-02-19 18:36:01 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-02-19 18:36:01 +0100 |
| commit | 768688e34073e7430d92293fb0a995c7dc24cdf5 (patch) | |
| tree | 76b954bb765f5723b0fb909dad8a584b5b5ce64f /ui/client-scripts/src/import_live.ts | |
| parent | 3a81f654a9f49649fb6755b6e35649f0102a9572 (diff) | |
| download | jellything-768688e34073e7430d92293fb0a995c7dc24cdf5.tar jellything-768688e34073e7430d92293fb0a995c7dc24cdf5.tar.bz2 jellything-768688e34073e7430d92293fb0a995c7dc24cdf5.tar.zst | |
display import stages in admin ui
Diffstat (limited to 'ui/client-scripts/src/import_live.ts')
| -rw-r--r-- | ui/client-scripts/src/import_live.ts | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/ui/client-scripts/src/import_live.ts b/ui/client-scripts/src/import_live.ts index 7e5209c..54966eb 100644 --- a/ui/client-scripts/src/import_live.ts +++ b/ui/client-scripts/src/import_live.ts @@ -9,6 +9,7 @@ import { OVar } from "./jshelper/mod.ts"; import { e } from "./jshelper/src/element.ts"; interface ImportProgress { + stage: string total_items: number finished_items: number tasks: string[] @@ -50,15 +51,22 @@ globalThis.addEventListener("DOMContentLoaded", () => { const progress = new OVar(0) - const text = new OVar("") - const pre = e("pre") - el.append(progress_bar(progress, text), pre) + const progress_text = new OVar("") + const pre = new OVar("") + const stage = new OVar("") + + el.append( + e("h2", stage), + progress_bar(progress, progress_text), + e("pre", pre) + ) ws.onmessage = msg => { if (msg.data == "done") return location.reload() const p: ImportProgress = JSON.parse(msg.data) - text.value = `${p.finished_items} / ${p.total_items}` + stage.value = p.stage + progress_text.value = `${p.finished_items} / ${p.total_items}` progress.value = p.finished_items / p.total_items - pre.textContent = p.tasks.map((e, i) => `thread ${("#" + i).padStart(3)}: ${e}`).join("\n") + pre.value = p.tasks.map((e, i) => `thread ${("#" + i).padStart(3)}: ${e}`).join("\n") } }) |