Workflow Artifact Info Hover (#37100)
Add expiry metadata to action artifacts in the run view and show it on hover. --------- Signed-off-by: Nicolas <bircni@icloud.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Claude (Opus 4.6) <noreply@anthropic.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -203,6 +203,17 @@ export function isVideoFile({name, type}: {name?: string, type?: string}): boole
|
||||
return Boolean(/\.(mpe?g|mp4|mkv|webm)$/i.test(name || '') || type?.startsWith('video/'));
|
||||
}
|
||||
|
||||
const byteUnits = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB'];
|
||||
|
||||
export function formatBytes(num: number, precision = 2): string {
|
||||
if (!Number.isFinite(num) || num < 0) return `0 ${byteUnits[0]}`;
|
||||
if (num < 1024) return `${num} ${byteUnits[0]}`;
|
||||
const exp = Math.min(Math.floor(Math.log2(num) / 10), byteUnits.length - 1);
|
||||
const value = num / (1024 ** exp);
|
||||
const digits = Math.max(0, precision - 1 - Math.floor(Math.log10(value)));
|
||||
return `${value.toFixed(digits)} ${byteUnits[exp]}`;
|
||||
}
|
||||
|
||||
export function toggleFullScreen(fullScreenEl: HTMLElement, isFullScreen: boolean, sourceParentSelector?: string): void {
|
||||
// hide other elements
|
||||
const headerEl = document.querySelector('#navbar')!;
|
||||
|
||||
Reference in New Issue
Block a user