Skip to content

Commit cbaf754

Browse files
authored
DT-3655 - add external payload count and size to workflow details (#3276)
* add external payload count and size to workflow details * update snaps * fix strict * update other snaps * add text-secondary to detail list label * update detail list components to support new styles for workflow details header - add class prop to DetailListTextValue and DetailListValue to pass through font-mono - make DetailListLabel text-secondary - add link to SDK developer guides next to SDK logo - replace SDK logos with our own colorblock versions * fix tooltip font * fix typo and remove rust link, there is no developer guide in docs for rust
1 parent a0d20fc commit cbaf754

29 files changed

Lines changed: 225 additions & 47 deletions

src/lib/components/detail-list/detail-list-label.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
const { children, href, class: className = '' }: Props = $props();
1414
</script>
1515

16-
<dd class={twMerge('col-[1]', className)}>
16+
<dd class={twMerge('col-[1] text-secondary', className)}>
1717
{#if href}
1818
<Link {href} newTab>{@render children()}</Link>
1919
{:else}

src/lib/components/detail-list/detail-list-text-value.svelte

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<script lang="ts">
2+
import type { ClassNameValue } from 'tailwind-merge';
3+
24
import Badge, { type BadgeType } from '$lib/holocene/badge.svelte';
35
import type { IconName } from '$lib/holocene/icon';
46
import Icon from '$lib/holocene/icon/icon.svelte';
@@ -11,19 +13,25 @@
1113
copyableText?: string;
1214
text: string;
1315
tooltipText?: string;
16+
tooltipWidth?: number;
1417
isBadge?: boolean;
1518
badgeType?: BadgeType;
1619
iconName?: IconName | undefined;
20+
iconPosition?: 'leading' | 'trailing';
21+
class?: ClassNameValue;
1722
}
1823
1924
let {
2025
copyable,
2126
text,
2227
copyableText = text,
2328
tooltipText,
29+
tooltipWidth = 256,
2430
iconName,
31+
iconPosition = 'leading',
2532
isBadge = false,
2633
badgeType = 'default',
34+
class: className = '',
2735
}: Props = $props();
2836
</script>
2937

@@ -34,17 +42,25 @@
3442
</Badge>
3543
{:else}
3644
<div class="flex select-all items-center gap-1 truncate rounded-sm">
37-
{#if iconName}
45+
{#if iconName && iconPosition === 'leading'}
3846
<Icon name={iconName} class="shrink-0" />
3947
{/if}
4048
<span class="truncate">{text}</span>
49+
{#if iconName && iconPosition === 'trailing'}
50+
<Icon name={iconName} class="shrink-0" />
51+
{/if}
4152
</div>
4253
{/if}
4354
{/snippet}
4455

45-
<DetailListValue {copyable} {copyableText}>
56+
<DetailListValue class={className} {copyable} {copyableText}>
4657
{#if tooltipText}
47-
<Tooltip text={tooltipText} top class="min-w-0">
58+
<Tooltip
59+
text={tooltipText}
60+
top
61+
width={tooltipWidth}
62+
class="min-w-0 font-sans"
63+
>
4864
{@render content()}
4965
</Tooltip>
5066
{:else}

src/lib/components/detail-list/detail-list-timestamp-value.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</div>
3232
{/snippet}
3333

34-
<DetailListValue>
34+
<DetailListValue class="font-mono">
3535
<Tooltip
3636
hide={!t}
3737
text={$relativeTime ? formattedTimestamp : relativeTimestamp}

src/lib/components/detail-list/detail-list-value.svelte

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script lang="ts">
22
import type { Snippet } from 'svelte';
3+
import { type ClassNameValue, twMerge } from 'tailwind-merge';
34
45
import CopyButton from '$lib/holocene/copyable/button.svelte';
56
import { translate } from '$lib/i18n/translate';
@@ -9,17 +10,23 @@
910
copyable?: boolean;
1011
copyableText?: string;
1112
children: Snippet;
13+
class?: ClassNameValue;
1214
}
1315
14-
const { children, copyable, copyableText }: Props = $props();
16+
const {
17+
children,
18+
copyable,
19+
copyableText,
20+
class: className = '',
21+
}: Props = $props();
1522
const { copy, copied } = copyToClipboard();
1623
1724
const handleCopy = (e: Event) => {
1825
copy(e, copyableText);
1926
};
2027
</script>
2128

22-
<dt class="col-[2] flex">
29+
<dt class={twMerge('col-[2] flex', className)}>
2330
{@render children()}
2431
{#if copyable}
2532
<!--
Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<script lang="ts">
2-
import dotNet from '$lib/vendor/sdk-logos/dot-net-logo.png';
3-
import go from '$lib/vendor/sdk-logos/go-logo.png';
4-
import java from '$lib/vendor/sdk-logos/java-logo.png';
5-
import php from '$lib/vendor/sdk-logos/php-logo.png';
6-
import python from '$lib/vendor/sdk-logos/python-logo.png';
7-
import ruby from '$lib/vendor/sdk-logos/ruby-logo.png';
8-
import rust from '$lib/vendor/sdk-logos/rust-logo.png';
9-
import typescript from '$lib/vendor/sdk-logos/ts-logo.png';
2+
import Icon from '$lib/holocene/icon/icon.svelte';
3+
import Link from '$lib/holocene/link.svelte';
4+
import dotNet from '$lib/vendor/sdk-logos/dotnet-colorblock.svg';
5+
import go from '$lib/vendor/sdk-logos/go-colorblock.svg';
6+
import java from '$lib/vendor/sdk-logos/java-colorblock.svg';
7+
import php from '$lib/vendor/sdk-logos/php-colorblock.svg';
8+
import python from '$lib/vendor/sdk-logos/python-colorblock.svg';
9+
import ruby from '$lib/vendor/sdk-logos/ruby-colorblock.svg';
10+
import rust from '$lib/vendor/sdk-logos/rust-colorblock.svg';
11+
import typescript from '$lib/vendor/sdk-logos/typescript-colorblock.svg';
1012
1113
const sdkLogos: Record<string, string> = {
1214
go,
@@ -19,16 +21,31 @@
1921
rust,
2022
};
2123
24+
const sdkToDocsSlug: Record<string, string> = {
25+
Ruby: 'ruby',
26+
Go: 'go',
27+
Java: 'java',
28+
Python: 'python',
29+
'.NET': 'dotnet',
30+
PHP: 'php',
31+
Typescript: 'typescript',
32+
};
33+
2234
interface Props {
2335
sdk: string;
2436
version: string;
2537
}
2638
2739
let { sdk, version }: Props = $props();
2840
const logo = $derived(sdkLogos[sdk.toLowerCase()]);
41+
const href = $derived(
42+
sdkToDocsSlug[sdk]
43+
? `https://docs.temporal.io/develop/${sdkToDocsSlug[sdk]}`
44+
: undefined,
45+
);
2946
</script>
3047

31-
<p class="flex w-full items-center gap-1">
48+
<p class="flex w-full items-center gap-2">
3249
{#if logo}
3350
<span class="relative flex w-6 shrink-0 items-center" aria-hidden="true">
3451
<img src={logo} alt="SDK Icon" class="absolute h-6 w-6" />
@@ -38,4 +55,8 @@
3855
{sdk}
3956
{version}
4057
</span>
58+
{#if href}
59+
<Link {href} newTab>Docs</Link>
60+
<Icon name="book" />
61+
{/if}
4162
</p>

src/lib/components/lines-and-dots/workflow-details.svelte

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
<script lang="ts">
22
import { page } from '$app/state';
33
4-
import { timestamp } from '$lib/components/timestamp.svelte';
54
import Tooltip from '$lib/holocene/tooltip.svelte';
65
import { translate } from '$lib/i18n/translate';
76
import { fetchWorkflow } from '$lib/services/workflow-service';
87
import { isCloud } from '$lib/stores/advanced-visibility';
98
import { fullEventHistory, sdkInfo } from '$lib/stores/events';
10-
import {
11-
relativeTime,
12-
timeFormat,
13-
timestampFormat,
14-
} from '$lib/stores/time-format';
159
import type { WorkflowExecution } from '$lib/types/workflows';
1610
import { formatBytes } from '$lib/utilities/format-bytes';
17-
import { formatDate } from '$lib/utilities/format-date';
1811
import {
1912
formatDistanceAbbreviated,
2013
formatDuration,
@@ -36,6 +29,7 @@
3629
DetailListTextValue,
3730
DetailListValue,
3831
} from '../detail-list';
32+
import DetailListTimestampValue from '../detail-list/detail-list-timestamp-value.svelte';
3933
4034
import SdkLogo from './sdk-logo.svelte';
4135
@@ -110,42 +104,25 @@
110104

111105
<DetailList aria-label="workflow details" rowCount={5}>
112106
<DetailListLabel>{translate('common.start')}</DetailListLabel>
113-
<DetailListTextValue
114-
text={$timestamp(workflow?.startTime)}
115-
tooltipText={formatDate(workflow?.startTime, $timeFormat, {
116-
relative: !$relativeTime,
117-
format: $timestampFormat,
118-
})}
119-
/>
107+
<DetailListTimestampValue timestamp={workflow?.startTime} />
120108

121109
{#if workflow?.startDelay}
122110
<DetailListLabel>{translate('workflows.execution-start')}</DetailListLabel>
123-
<DetailListTextValue
124-
text={$timestamp(workflow?.executionTime)}
125-
tooltipText={formatDate(workflow?.executionTime, $timeFormat, {
126-
relative: !$relativeTime,
127-
format: $timestampFormat,
128-
})}
129-
/>
111+
<DetailListTimestampValue timestamp={workflow?.executionTime} />
130112
{/if}
131113

132114
<DetailListLabel>{translate('common.end')}</DetailListLabel>
133-
<DetailListTextValue
134-
text={workflow?.endTime ? $timestamp(workflow?.endTime) : '-'}
135-
tooltipText={formatDate(workflow?.endTime, $timeFormat, {
136-
relative: !$relativeTime,
137-
format: $timestampFormat,
138-
})}
139-
/>
115+
<DetailListTimestampValue timestamp={workflow?.endTime} fallback="-" />
140116

141117
<DetailListLabel>
142118
{translate('common.duration')}
143119
</DetailListLabel>
144-
<DetailListTextValue text={elapsedTime} />
120+
<DetailListTextValue class="font-mono" text={elapsedTime} />
145121

146122
{#if workflow?.workflowExecutionTimeout && workflow?.workflowExecutionTimeout.toString() !== '0s'}
147123
<DetailListLabel>{translate('workflows.workflow-timeout')}</DetailListLabel>
148124
<DetailListTextValue
125+
class="font-mono"
149126
text={formatDuration(workflow.workflowExecutionTimeout)}
150127
tooltipText={formatDuration(workflow.workflowExecutionTimeout)}
151128
/>
@@ -284,13 +261,40 @@
284261

285262
<DetailListColumn>
286263
<DetailListLabel>{translate('common.history-size')}</DetailListLabel>
287-
<DetailListTextValue text={historySizeFormatted} />
264+
<DetailListTextValue
265+
class="font-mono"
266+
tooltipText={workflow.externalPayloadCount
267+
? translate('workflows.external-payload-tooltip')
268+
: ''}
269+
iconName={workflow.externalPayloadCount ? 'square-info' : undefined}
270+
iconPosition="trailing"
271+
text={historySizeFormatted}
272+
/>
273+
{#if workflow.externalPayloadCount}
274+
<DetailListLabel
275+
>{translate('workflows.external-payload-size')}</DetailListLabel
276+
>
277+
<DetailListTextValue
278+
class="font-mono"
279+
text={formatBytes(parseInt(workflow.externalPayloadSizeBytes, 10))}
280+
/>
281+
<DetailListLabel
282+
>{translate('workflows.external-payload-count')}</DetailListLabel
283+
>
284+
<DetailListTextValue
285+
class="font-mono"
286+
text={workflow.externalPayloadCount}
287+
/>
288+
{/if}
288289

289290
{#if !$isCloud}
290291
<DetailListLabel
291292
>{translate('workflows.state-transitions')}</DetailListLabel
292293
>
293-
<DetailListTextValue text={workflow?.stateTransitionCount} />
294+
<DetailListTextValue
295+
class="font-mono"
296+
text={workflow?.stateTransitionCount}
297+
/>
294298
{:else}
295299
<Tooltip
296300
bottomLeft

src/lib/holocene/icon/paths.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ import signal from './svg/signal.svelte';
115115
import slashForward from './svg/slash-forward.svelte';
116116
import sliders from './svg/sliders.svelte';
117117
import spinner from './svg/spinner.svelte';
118+
import squareInfo from './svg/square-info.svelte';
118119
import starEmpty from './svg/star-empty.svelte';
119120
import starFilled from './svg/star-filled.svelte';
120121
import summary from './svg/summary.svelte';
@@ -266,6 +267,7 @@ export const icons = {
266267
'slash-forward': slashForward,
267268
sliders,
268269
spinner,
270+
'square-info': squareInfo,
269271
'star-empty': starEmpty,
270272
'star-filled': starFilled,
271273
success: checkmark,
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<script lang="ts">
2+
import Svg from '../svg.svelte';
3+
let props = $props();
4+
</script>
5+
6+
<Svg {...props}>
7+
<path
8+
d="M 2.5714286,2.5714286 V 21.428571 H 21.428571 V 2.5714286 Z M 0,0 H 2.5714286 21.428571 24 V 2.5714286 21.428571 24 H 21.428571 2.5714286 0 V 21.428571 2.5714286 Z M 9.8571428,16.285714 H 11.142857 V 12.857143 H 9.8571428 8.5714285 v -2.571429 h 1.2857143 2.5714282 1.285715 v 1.285714 4.714286 h 0.428571 1.285714 v 2.571429 H 14.142857 9.8571428 8.5714285 V 16.285714 Z M 13.714286,5.1428571 V 8.5714285 H 10.285714 V 5.1428571 Z"
9+
fill="currentcolor"
10+
/>
11+
</Svg>

src/lib/i18n/locales/en/workflows.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,5 +349,9 @@ export const Strings = {
349349
'timeline-minimized':
350350
'Timeline and Event History are collapsed to minimized height',
351351
'timeline-expanded': 'Timeline and Event History are expanded to full height',
352+
'external-payload-size': 'External Payloads Size',
353+
'external-payload-count': 'External Payloads',
354+
'external-payload-tooltip':
355+
'History Size does not include externally stored payload size.',
352356
sdk: 'Workflow SDK',
353357
} as const;

0 commit comments

Comments
 (0)