Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/components/detail-list/detail-list-label.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
const { children, href, class: className = '' }: Props = $props();
</script>

<dd class={twMerge('col-[1]', className)}>
<dd class={twMerge('col-[1] text-secondary', className)}>
{#if href}
<Link {href} newTab>{@render children()}</Link>
{:else}
Expand Down
17 changes: 14 additions & 3 deletions src/lib/components/detail-list/detail-list-text-value.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script lang="ts">
import type { ClassNameValue } from 'tailwind-merge';

import Badge, { type BadgeType } from '$lib/holocene/badge.svelte';
import type { IconName } from '$lib/holocene/icon';
import Icon from '$lib/holocene/icon/icon.svelte';
Expand All @@ -11,19 +13,25 @@
copyableText?: string;
text: string;
tooltipText?: string;
tooltipWidth?: number;
isBadge?: boolean;
badgeType?: BadgeType;
iconName?: IconName | undefined;
iconPosition?: 'leading' | 'trailing';
class?: ClassNameValue;
}

let {
copyable,
text,
copyableText = text,
tooltipText,
tooltipWidth = 256,
iconName,
iconPosition = 'leading',
isBadge = false,
badgeType = 'default',
class: className = '',
}: Props = $props();
</script>

Expand All @@ -34,17 +42,20 @@
</Badge>
{:else}
<div class="flex select-all items-center gap-1 truncate rounded-sm">
{#if iconName}
{#if iconName && iconPosition === 'leading'}
<Icon name={iconName} class="shrink-0" />
{/if}
<span class="truncate">{text}</span>
{#if iconName && iconPosition === 'trailing'}
<Icon name={iconName} class="shrink-0" />
{/if}
</div>
{/if}
{/snippet}

<DetailListValue {copyable} {copyableText}>
<DetailListValue class={className} {copyable} {copyableText}>
{#if tooltipText}
<Tooltip text={tooltipText} top class="min-w-0">
<Tooltip text={tooltipText} top width={tooltipWidth} class="min-w-0">
{@render content()}
</Tooltip>
{:else}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</div>
{/snippet}

<DetailListValue>
<DetailListValue class="font-mono">
<Tooltip
hide={!t}
text={$relativeTime ? formattedTimestamp : relativeTimestamp}
Expand Down
11 changes: 9 additions & 2 deletions src/lib/components/detail-list/detail-list-value.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import type { Snippet } from 'svelte';
import { type ClassNameValue, twMerge } from 'tailwind-merge';

import CopyButton from '$lib/holocene/copyable/button.svelte';
import { translate } from '$lib/i18n/translate';
Expand All @@ -9,17 +10,23 @@
copyable?: boolean;
copyableText?: string;
children: Snippet;
class?: ClassNameValue;
}

const { children, copyable, copyableText }: Props = $props();
const {
children,
copyable,
copyableText,
class: className = '',
}: Props = $props();
const { copy, copied } = copyToClipboard();

const handleCopy = (e: Event) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ Argument of type 'string | undefined' is not assignable to parameter of type 'string'.

copy(e, copyableText);
};
</script>

<dt class="col-[2] flex">
<dt class={twMerge('col-[2] flex', className)}>
{@render children()}
{#if copyable}
<!--
Expand Down
40 changes: 31 additions & 9 deletions src/lib/components/lines-and-dots/sdk-logo.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<script lang="ts">
import dotNet from '$lib/vendor/sdk-logos/dot-net-logo.png';
import go from '$lib/vendor/sdk-logos/go-logo.png';
import java from '$lib/vendor/sdk-logos/java-logo.png';
import php from '$lib/vendor/sdk-logos/php-logo.png';
import python from '$lib/vendor/sdk-logos/python-logo.png';
import ruby from '$lib/vendor/sdk-logos/ruby-logo.png';
import rust from '$lib/vendor/sdk-logos/rust-logo.png';
import typescript from '$lib/vendor/sdk-logos/ts-logo.png';
import Icon from '$lib/holocene/icon/icon.svelte';
import Link from '$lib/holocene/link.svelte';
import dotNet from '$lib/vendor/sdk-logos/dotnet-colorblock.svg';
import go from '$lib/vendor/sdk-logos/go-colorblock.svg';
import java from '$lib/vendor/sdk-logos/java-colorblock.svg';
import php from '$lib/vendor/sdk-logos/php-colorblock.svg';
import python from '$lib/vendor/sdk-logos/python-colorblock.svg';
import ruby from '$lib/vendor/sdk-logos/ruby-colorblock.svg';
import rust from '$lib/vendor/sdk-logos/rust-colorblock.svg';
import typescript from '$lib/vendor/sdk-logos/typescript-colorblock.svg';

const sdkLogos: Record<string, string> = {
go,
Expand All @@ -19,16 +21,32 @@
rust,
};

const sdkToDocsSlug: Record<string, string> = {
Rubg: 'ruby',
Comment thread
rossedfort marked this conversation as resolved.
Outdated
Go: 'go',
Java: 'java',
Python: 'python',
'.NET': 'dot-net',
PHP: 'php',
TypeScript: 'typescript',
Rust: 'rust',
};

interface Props {
sdk: string;
version: string;
}

let { sdk, version }: Props = $props();
const logo = $derived(sdkLogos[sdk.toLowerCase()]);
const href = $derived(
sdkToDocsSlug[sdk]
? `https://docs.temporal.io/develop/${sdkToDocsSlug[sdk]}`
: undefined,
);
</script>

<p class="flex w-full items-center gap-1">
<p class="flex w-full items-center gap-2">
{#if logo}
<span class="relative flex w-6 shrink-0 items-center" aria-hidden="true">
<img src={logo} alt="SDK Icon" class="absolute h-6 w-6" />
Expand All @@ -38,4 +56,8 @@
{sdk}
{version}
</span>
{#if href}
<Link {href} newTab>Docs</Link>
<Icon name="book" />
{/if}
</p>
66 changes: 35 additions & 31 deletions src/lib/components/lines-and-dots/workflow-details.svelte
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
<script lang="ts">
import { page } from '$app/state';

import { timestamp } from '$lib/components/timestamp.svelte';
import Tooltip from '$lib/holocene/tooltip.svelte';
import { translate } from '$lib/i18n/translate';
import { fetchWorkflow } from '$lib/services/workflow-service';
import { isCloud } from '$lib/stores/advanced-visibility';
import { fullEventHistory } from '$lib/stores/events';
import {
relativeTime,
timeFormat,
timestampFormat,
} from '$lib/stores/time-format';
import type { WorkflowExecution } from '$lib/types/workflows';
import { formatBytes } from '$lib/utilities/format-bytes';
import { formatDate } from '$lib/utilities/format-date';
import {
formatDistanceAbbreviated,
formatDuration,
Expand All @@ -38,6 +31,7 @@
DetailListTextValue,
DetailListValue,
} from '../detail-list';
import DetailListTimestampValue from '../detail-list/detail-list-timestamp-value.svelte';

import SdkLogo from './sdk-logo.svelte';

Expand Down Expand Up @@ -116,42 +110,25 @@

<DetailList aria-label="workflow details" rowCount={5}>
<DetailListLabel>{translate('common.start')}</DetailListLabel>
<DetailListTextValue
text={$timestamp(workflow?.startTime)}
tooltipText={formatDate(workflow?.startTime, $timeFormat, {
relative: !$relativeTime,
format: $timestampFormat,
})}
/>
<DetailListTimestampValue timestamp={workflow?.startTime} />
Comment thread
rossedfort marked this conversation as resolved.

{#if workflow?.startDelay}
<DetailListLabel>{translate('workflows.execution-start')}</DetailListLabel>
<DetailListTextValue
text={$timestamp(workflow?.executionTime)}
tooltipText={formatDate(workflow?.executionTime, $timeFormat, {
relative: !$relativeTime,
format: $timestampFormat,
})}
/>
<DetailListTimestampValue timestamp={workflow?.executionTime} />
{/if}

<DetailListLabel>{translate('common.end')}</DetailListLabel>
<DetailListTextValue
text={workflow?.endTime ? $timestamp(workflow?.endTime) : '-'}
tooltipText={formatDate(workflow?.endTime, $timeFormat, {
relative: !$relativeTime,
format: $timestampFormat,
})}
/>
<DetailListTimestampValue timestamp={workflow?.endTime} fallback="-" />

<DetailListLabel>
{translate('common.duration')}
</DetailListLabel>
<DetailListTextValue text={elapsedTime} />
<DetailListTextValue class="font-mono" text={elapsedTime} />

{#if workflow?.workflowExecutionTimeout && workflow?.workflowExecutionTimeout.toString() !== '0s'}
<DetailListLabel>{translate('workflows.workflow-timeout')}</DetailListLabel>
<DetailListTextValue
class="font-mono"
text={formatDuration(workflow.workflowExecutionTimeout)}
tooltipText={formatDuration(workflow.workflowExecutionTimeout)}
/>
Expand Down Expand Up @@ -288,13 +265,40 @@

<DetailListColumn>
<DetailListLabel>{translate('common.history-size')}</DetailListLabel>
<DetailListTextValue text={historySizeFormatted} />
<DetailListTextValue
class="font-mono"
tooltipText={workflow.externalPayloadCount
? translate('workflows.external-payload-tooltip')
: ''}
iconName={workflow.externalPayloadCount ? 'square-info' : undefined}
iconPosition="trailing"
text={historySizeFormatted}
/>
{#if workflow.externalPayloadCount}
<DetailListLabel
>{translate('workflows.external-payload-size')}</DetailListLabel
>
<DetailListTextValue
class="font-mono"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ Argument of type 'string | undefined' is not assignable to parameter of type 'string'.

text={formatBytes(parseInt(workflow.externalPayloadSizeBytes, 10))}
/>
<DetailListLabel
>{translate('workflows.external-payload-count')}</DetailListLabel
>
<DetailListTextValue
class="font-mono"
text={workflow.externalPayloadCount}
/>
{/if}

{#if !$isCloud}
<DetailListLabel
>{translate('workflows.state-transitions')}</DetailListLabel
>
<DetailListTextValue text={workflow?.stateTransitionCount} />
<DetailListTextValue
class="font-mono"
text={workflow?.stateTransitionCount}
/>
{:else}
<Tooltip
bottomLeft
Expand Down
2 changes: 2 additions & 0 deletions src/lib/holocene/icon/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ import signal from './svg/signal.svelte';
import slashForward from './svg/slash-forward.svelte';
import sliders from './svg/sliders.svelte';
import spinner from './svg/spinner.svelte';
import squareInfo from './svg/square-info.svelte';
import starEmpty from './svg/star-empty.svelte';
import starFilled from './svg/star-filled.svelte';
import summary from './svg/summary.svelte';
Expand Down Expand Up @@ -263,6 +264,7 @@ export const icons = {
'slash-forward': slashForward,
sliders,
spinner,
'square-info': squareInfo,
'star-empty': starEmpty,
'star-filled': starFilled,
success: checkmark,
Expand Down
11 changes: 11 additions & 0 deletions src/lib/holocene/icon/svg/square-info.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script lang="ts">
import Svg from '../svg.svelte';
let props = $props();
</script>

<Svg {...props}>
<path
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"
fill="currentcolor"
/>
</Svg>
4 changes: 4 additions & 0 deletions src/lib/i18n/locales/en/workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,4 +348,8 @@ export const Strings = {
'timeline-minimized':
'Timeline and Event History are collapsed to minimized height',
'timeline-expanded': 'Timeline and Event History are expanded to full height',
'external-payload-size': 'External Payloads Size',
'external-payload-count': 'External Payloads',
'external-payload-tooltip':
'History Size does not include externally stored payload size.',
} as const;
Loading
Loading