Skip to content

Commit f0bc668

Browse files
committed
[web-console] Make transaction progress jump when transaction ID changes
Display transaction ID Signed-off-by: Karakatiza666 <bulakh.96@gmail.com>
1 parent 8682f0a commit f0bc668

1 file changed

Lines changed: 26 additions & 4 deletions

File tree

js-packages/web-console/src/lib/components/pipelines/editor/performance/TransactionStatus.svelte

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
const global = $derived(metrics.current.global)
1111
const transactionStatus = $derived(global.transaction_status)
1212
const commitProgress = $derived(global.commit_progress)
13+
const transactionId = $derived(global.transaction_id)
1314
1415
const total = $derived(
1516
commitProgress
@@ -32,18 +33,35 @@
3233
? ((commitProgress.completed + commitProgress.in_progress * inProgressFraction) / total) * 100
3334
: null
3435
)
36+
37+
// Disable the smooth progress bar transition when the transaction changes so
38+
// the bar jumps immediately to the new value rather than animating.
39+
let disableTransition = $state(false)
40+
let prevTransactionId = transactionId
41+
42+
$effect(() => {
43+
const currentId = transactionId
44+
if (currentId !== prevTransactionId) {
45+
prevTransactionId = currentId
46+
disableTransition = true
47+
requestAnimationFrame(() => {
48+
disableTransition = false
49+
})
50+
}
51+
})
3552
</script>
3653

3754
{#if transactionStatus !== 'NoTransaction'}
38-
<div class="flex flex-wrap items-center gap-x-8 gap-y-2 {_class}" transition:slide>
55+
<div class="flex flex-wrap items-center gap-x-16 gap-y-2 {_class}" transition:slide>
3956
<div class="flex w-28 flex-col items-center">
4057
<div class="text-sm text-nowrap">Transaction status</div>
41-
<div class="pt-2">
58+
<div class="pt-2 flex flex-nowrap items-center gap-2">
4259
{#if transactionStatus === 'TransactionInProgress'}
4360
<div class="pointer-events-none chip bg-tertiary-50-950 uppercase">Started</div>
4461
{:else if transactionStatus === 'CommitInProgress'}
4562
<div class="pointer-events-none chip bg-warning-200-800 uppercase">Committing</div>
4663
{/if}
64+
<div class="font-dm-mono text-sm w-0">#{transactionId}</div>
4765
</div>
4866
</div>
4967

@@ -66,13 +84,17 @@
6684
<div class="relative">
6785
<Progress class="h-2" value={combinedPercent} max={100}>
6886
<Progress.Track class="bg-surface-600-400">
69-
<Progress.Range class="bg-yellow-500 duration-2000 ease-linear" />
87+
<Progress.Range
88+
class="bg-yellow-500 {disableTransition ? 'duration-0' : 'duration-2000 ease-linear'}"
89+
/>
7090
</Progress.Track>
7191
</Progress>
7292
<Progress class="absolute inset-x-0 bottom-0 h-2" value={completedPercent} max={100}>
7393
<Progress.Track class="opacity-0"></Progress.Track>
7494
<Progress.Range
75-
class="absolute inset-y-0 left-0 bg-success-500 duration-2000 ease-linear"
95+
class="absolute inset-y-0 left-0 bg-success-500 {disableTransition
96+
? 'duration-0'
97+
: 'duration-2000 ease-linear'}"
7698
/>
7799
</Progress>
78100
</div>

0 commit comments

Comments
 (0)