web/ProcessingQueueItem: display all steps in progress bar

This commit is contained in:
wukko 2025-01-31 21:59:00 +06:00
parent cdfb6e0fd9
commit 398c5402d2
No known key found for this signature in database
GPG Key ID: 3E30B3F26C7B4AA2
3 changed files with 68 additions and 34 deletions

View File

@ -76,6 +76,9 @@
runningWorker={ runningWorker={
item.state === "running" ? $currentTasks[item.runningWorker] : undefined item.state === "running" ? $currentTasks[item.runningWorker] : undefined
} }
runningWorkerId={
item.state === "running" ? item.runningWorker : undefined
}
/> />
{/each} {/each}
{#if queue.length === 0} {#if queue.length === 0}

View File

@ -7,7 +7,7 @@
import type { CobaltQueueItem } from "$lib/types/queue"; import type { CobaltQueueItem } from "$lib/types/queue";
import type { CobaltCurrentTaskItem } from "$lib/types/queen-bee"; import type { CobaltCurrentTaskItem } from "$lib/types/queen-bee";
import Skeleton from "$components/misc/Skeleton.svelte"; import ProgressBar from "$components/queue/ProgressBar.svelte";
import IconX from "@tabler/icons-svelte/IconX.svelte"; import IconX from "@tabler/icons-svelte/IconX.svelte";
import IconCheck from "@tabler/icons-svelte/IconCheck.svelte"; import IconCheck from "@tabler/icons-svelte/IconCheck.svelte";
@ -27,6 +27,7 @@
export let id: string; export let id: string;
export let info: CobaltQueueItem; export let info: CobaltQueueItem;
export let runningWorker: CobaltCurrentTaskItem | undefined; export let runningWorker: CobaltCurrentTaskItem | undefined;
export let runningWorkerId: string | undefined;
$: progress = runningWorker?.progress; $: progress = runningWorker?.progress;
$: size = formatFileSize(runningWorker?.progress?.size); $: size = formatFileSize(runningWorker?.progress?.size);
@ -50,22 +51,15 @@
</div> </div>
{#if info.state === "running"} {#if info.state === "running"}
<div class="file-progress"> <div class="progress-holder">
{#if progress?.percentage} {#each info.pipeline as pipeline}
<div <ProgressBar
class="progress" percentage={progress?.percentage}
style="width: {Math.min( workerId={pipeline.workerId}
100, runningWorkerId={runningWorkerId}
progress?.percentage || 0 completedWorkers={info.completedWorkers}
)}%"
></div>
{:else}
<Skeleton
height="6px"
width="100%"
class="elevated indeterminate-progress"
/> />
{/if} {/each}
</div> </div>
{/if} {/if}
@ -75,6 +69,7 @@
{/if} {/if}
{#if info.state === "running"} {#if info.state === "running"}
{(info.completedWorkers?.length || 0) + 1}/{info.pipeline.length}
{#if runningWorker && progress && progress.percentage} {#if runningWorker && progress && progress.percentage}
{$t(`queue.state.running.${runningWorker.type}`)}: {Math.ceil( {$t(`queue.state.running.${runningWorker.type}`)}: {Math.ceil(
progress.percentage progress.percentage
@ -147,24 +142,10 @@
font-weight: 500; font-weight: 500;
} }
.file-progress { .progress-holder {
width: 100%; display: flex;
background-color: var(--button-elevated); flex-direction: row;
} gap: 2px;
.file-progress,
.file-progress .progress {
height: 6px;
border-radius: 10px;
transition: width 0.1s;
}
.file-progress :global(.indeterminate-progress) {
display: block;
}
.file-progress .progress {
background-color: var(--blue);
} }
.file-title { .file-title {

View File

@ -0,0 +1,50 @@
<script lang="ts">
import Skeleton from "$components/misc/Skeleton.svelte";
export let percentage: number = 0;
export let workerId: string;
export let runningWorkerId: string | undefined;
export let completedWorkers: string[] = [];
</script>
<div class="file-progress">
{#if percentage && workerId === runningWorkerId}
<div
class="progress"
style="width: {Math.min(100, percentage || 0)}%"
></div>
{:else if completedWorkers.includes(workerId)}
<div
class="progress"
style="width: 100%"
></div>
{:else if workerId === runningWorkerId}
<Skeleton
height="6px"
width="100%"
class="elevated indeterminate-progress"
/>
{/if}
</div>
<style>
.file-progress {
width: 100%;
background-color: var(--button-elevated);
}
.file-progress,
.file-progress .progress {
height: 6px;
border-radius: 10px;
transition: width 0.1s;
}
.file-progress :global(.indeterminate-progress) {
display: block;
}
.file-progress .progress {
background-color: var(--blue);
}
</style>