Check deployment status while creating project with single deployer #15

Merged
nabarun merged 7 commits from sk-check-deployment-status into main 2024-10-25 10:47:05 +00:00
2 changed files with 19 additions and 13 deletions
Showing only changes of commit 96c00cc371 - Show all commits

View File

@ -21,12 +21,7 @@ interface DeployStepsProps {
processTime?: string; processTime?: string;
} }
const DeployStep = ({ const DeployStep = ({ step, status, title, startTime }: DeployStepsProps) => {
step,
status,
title,
startTime,
}: DeployStepsProps) => {
return ( return (
<div className="border-b border-border-separator"> <div className="border-b border-border-separator">
<button <button
@ -60,7 +55,10 @@ const DeployStep = ({
{status === DeployStatus.PROCESSING && ( {status === DeployStatus.PROCESSING && (
<div className="flex items-center gap-1.5"> <div className="flex items-center gap-1.5">
<ClockOutlineIcon size={16} className="text-elements-low-em" /> <ClockOutlineIcon size={16} className="text-elements-low-em" />
<Stopwatch offsetTimestamp={setStopWatchOffset(startTime!)} isPaused={false}/> <Stopwatch
offsetTimestamp={setStopWatchOffset(startTime!)}
isPaused={false}
/>
</div> </div>
)} )}
{status === DeployStatus.COMPLETE && ( {status === DeployStatus.COMPLETE && (

View File

@ -93,12 +93,20 @@ const DeploymentDetailsCard = ({
}; };
const fetchDeploymentLogs = async () => { const fetchDeploymentLogs = async () => {
let url = `${deployment.deployer.deployerApiUrl}/log/${deployment.applicationDeploymentRequestId}`; const statusUrl = `${deployment.deployer.deployerApiUrl}/${deployment.applicationDeploymentRequestId}`;
const res = await fetch(url, { cache: 'no-store' }); const statusRes = await fetch(statusUrl, { cache: 'no-store' }).then(
handleOpenDialog(); (res) => res.json(),
if (res.ok) { );
const logs = await res.text(); if (!statusRes.logAvailable) {
setDeploymentLogs(logs); 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();
} }
}; };