Skip to content

Commit

Permalink
Fix retry attempt text when textAnchor is end (#2381)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurakwhit authored Oct 11, 2024
1 parent 605e906 commit 570ca0f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/lib/components/lines-and-dots/svg/text.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
name={icon}
x={x - offset}
y={y - 8}
class={dark ? 'text-black' : 'text-white'}
class={dark ? 'text-black' : !backdrop ? 'text-primary' : 'text-white'}
/>
{/if}
<text
Expand All @@ -75,7 +75,7 @@
name={icon}
x={x - offset}
y={y - 8}
class={dark ? 'text-black' : 'text-white'}
class={dark ? 'text-black' : !backdrop ? 'text-primary' : 'text-white'}
/>
{/if}

Expand Down
23 changes: 18 additions & 5 deletions src/lib/components/lines-and-dots/svg/timeline-graph-row.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import {
CategoryIcon,
textBackdropOffset,
textBackdropOffsetWithIcon,
TimelineConfig,
timelineTextPosition,
Expand All @@ -30,11 +31,13 @@
const { height, gutter, radius } = TimelineConfig;
let textWidth = 0;
let retryAttemptTextWidth = 0;
$: timelineWidth = canvasWidth - 2 * gutter;
$: active = !activeGroups.length || activeGroups.includes(group.id);
$: ({ pendingActivity } = group);
$: hasPendingActivity = isPendingActivity(pendingActivity);
$: showRetryAttempts =
isPendingActivity(pendingActivity) && pendingActivity.attempt > 1;
const getDistancePointsAndPositions = (
endTime: string | Date,
Expand Down Expand Up @@ -117,7 +120,14 @@
{/if}
{#if showText}
<Text
point={textPosition}
point={[
showRetryAttempts && textAnchor === 'end'
? textPosition[0] -
retryAttemptTextWidth -
textBackdropOffsetWithIcon
: textPosition[0],
textPosition[1],
]}
{textAnchor}
{backdrop}
backdropHeight={radius * 2}
Expand All @@ -127,10 +137,12 @@
{group?.displayName}
</Text>
{/if}
{#if hasPendingActivity && pendingActivity.attempt > 1}
{#if showRetryAttempts}
<Text
point={[
textPosition[0] + textWidth + textBackdropOffsetWithIcon,
textAnchor === 'end'
? textPosition[0] - retryAttemptTextWidth - textBackdropOffset
: textPosition[0] + textWidth + textBackdropOffsetWithIcon,
textPosition[1],
]}
textAnchor="start"
Expand All @@ -140,7 +152,8 @@
icon="retry"
status="retry"
noOffset
dark
dark={backdrop}
bind:textWidth={retryAttemptTextWidth}
>
{translate('workflows.retry')}
{pendingActivity.attempt} / {pendingActivity.maximumAttempts || ''}
Expand Down

0 comments on commit 570ca0f

Please sign in to comment.