Skip to content

Commit c1cc0a1

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 c1cc0a1

1 file changed

Lines changed: 27 additions & 4 deletions

File tree

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

Lines changed: 27 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,36 @@
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'}
3855
<div class="flex flex-wrap items-center gap-x-8 gap-y-2 {_class}" transition:slide>
39-
<div class="flex w-28 flex-col items-center">
56+
<div class="flex w-28 flex-col items-center mr-14">
4057
<div class="text-sm text-nowrap">Transaction status</div>
41-
<div class="pt-2">
58+
<div class="pt-2 flex flex-nowrap justify-center items-center gap-2">
59+
<div></div>
4260
{#if transactionStatus === 'TransactionInProgress'}
4361
<div class="pointer-events-none chip bg-tertiary-50-950 uppercase">Started</div>
4462
{:else if transactionStatus === 'CommitInProgress'}
4563
<div class="pointer-events-none chip bg-warning-200-800 uppercase">Committing</div>
4664
{/if}
65+
<div class="font-dm-mono text-sm w-0 text-nowrap"><span class="select-none">ID:</span>{transactionId}</div>
4766
</div>
4867
</div>
4968

@@ -66,13 +85,17 @@
6685
<div class="relative">
6786
<Progress class="h-2" value={combinedPercent} max={100}>
6887
<Progress.Track class="bg-surface-600-400">
69-
<Progress.Range class="bg-yellow-500 duration-2000 ease-linear" />
88+
<Progress.Range
89+
class="bg-yellow-500 {disableTransition ? 'duration-0' : 'duration-2000 ease-linear'}"
90+
/>
7091
</Progress.Track>
7192
</Progress>
7293
<Progress class="absolute inset-x-0 bottom-0 h-2" value={completedPercent} max={100}>
7394
<Progress.Track class="opacity-0"></Progress.Track>
7495
<Progress.Range
75-
class="absolute inset-y-0 left-0 bg-success-500 duration-2000 ease-linear"
96+
class="absolute inset-y-0 left-0 bg-success-500 {disableTransition
97+
? 'duration-0'
98+
: 'duration-2000 ease-linear'}"
7699
/>
77100
</Progress>
78101
</div>

0 commit comments

Comments
 (0)