Skip to content

Commit 2ff83e7

Browse files
authored
fix(tooltip): truncate sha256 digests to 7 chars (#253)
1 parent 3f2f21a commit 2ff83e7

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

packages/app/src/components/inference/utils/tooltipUtils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,11 @@ const runLinkHTML = (runUrl?: string) =>
8888
const tooltipLine = (label: string, value: string | number) =>
8989
`<div style="color: var(--muted-foreground); font-size: 11px; margin-bottom: 4px;"><strong>${label}:</strong> ${value}</div>`;
9090

91+
const shortenSha = (image: string) => image.replaceAll(/(sha256:[a-f0-9]{7})[a-f0-9]+/gi, '$1…');
92+
9193
const imageTooltipLine = (image: string) =>
9294
`<div style="color: var(--muted-foreground); font-size: 11px; margin-bottom: 4px;">
93-
<strong>Image:</strong> <span style="display: inline-block; vertical-align: top; overflow-wrap: anywhere;">${image.trim().replace(/\s+/, '<br />')}</span>
95+
<strong>Image:</strong> <span style="display: inline-block; vertical-align: top; overflow-wrap: anywhere;">${shortenSha(image.trim()).replace(/\s+/, '<br />')}</span>
9496
</div>`;
9597

9698
/**

0 commit comments

Comments
 (0)