From 74b5a90b5d8a7674894f8533368d281f62e57011 Mon Sep 17 00:00:00 2001 From: Savas Vedova Date: Mon, 11 Mar 2024 16:35:20 -0700 Subject: [PATCH] fix: displaying duration --- .../[deployment-id]/Deployment.tsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/pages/apps/[id]/environments/[env-id]/deployments/[deployment-id]/Deployment.tsx b/src/pages/apps/[id]/environments/[env-id]/deployments/[deployment-id]/Deployment.tsx index 6764cc97..61e0c3b2 100644 --- a/src/pages/apps/[id]/environments/[env-id]/deployments/[deployment-id]/Deployment.tsx +++ b/src/pages/apps/[id]/environments/[env-id]/deployments/[deployment-id]/Deployment.tsx @@ -24,6 +24,22 @@ const splitLines = (message: string): string[] => { return lines; }; +const shouldShowDuration = ( + hasDurationSupport: boolean | undefined, + d: DeploymentV2, + i: number +): boolean => { + if (!hasDurationSupport) { + return false; + } + + if (d.status === "running") { + return (d.logs?.length || 1) - 1 !== i; + } + + return true; +}; + const iconProps = { fontSize: 12, }; @@ -139,8 +155,7 @@ export default function Deployment() { > {title} - {hasDurationSupport && - !(isRunning && deployment.logs!.length - 1 !== i) ? ( + {shouldShowDuration(hasDurationSupport, deployment, i) ? (