diff --git a/packages/frontend/src/components/projects/create/DeployStep.tsx b/packages/frontend/src/components/projects/create/DeployStep.tsx index 4c674df8..4ee5e5c2 100644 --- a/packages/frontend/src/components/projects/create/DeployStep.tsx +++ b/packages/frontend/src/components/projects/create/DeployStep.tsx @@ -21,12 +21,7 @@ interface DeployStepsProps { processTime?: string; } -const DeployStep = ({ - step, - status, - title, - startTime, -}: DeployStepsProps) => { +const DeployStep = ({ step, status, title, startTime }: DeployStepsProps) => { return (
)} {status === DeployStatus.COMPLETE && ( diff --git a/packages/frontend/src/components/projects/project/deployments/DeploymentDetailsCard.tsx b/packages/frontend/src/components/projects/project/deployments/DeploymentDetailsCard.tsx index cac7e6d1..5dbabfee 100644 --- a/packages/frontend/src/components/projects/project/deployments/DeploymentDetailsCard.tsx +++ b/packages/frontend/src/components/projects/project/deployments/DeploymentDetailsCard.tsx @@ -93,12 +93,20 @@ const DeploymentDetailsCard = ({ }; const fetchDeploymentLogs = async () => { - let url = `${deployment.deployer.deployerApiUrl}/log/${deployment.applicationDeploymentRequestId}`; - const res = await fetch(url, { cache: 'no-store' }); - handleOpenDialog(); - if (res.ok) { - const logs = await res.text(); - setDeploymentLogs(logs); + const statusUrl = `${deployment.deployer.deployerApiUrl}/${deployment.applicationDeploymentRequestId}`; + const statusRes = await fetch(statusUrl, { cache: 'no-store' }).then( + (res) => res.json(), + ); + if (!statusRes.logAvailable) { + setDeploymentLogs(statusRes.lastState); + handleOpenDialog(); + } else { + const logsUrl = `${deployment.deployer.deployerApiUrl}/log/${deployment.applicationDeploymentRequestId}`; + const logsRes = await fetch(logsUrl, { cache: 'no-store' }).then((res) => + res.text(), + ); + setDeploymentLogs(logsRes); + handleOpenDialog(); } };