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

View File

@ -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' });
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();
if (res.ok) {
const logs = await res.text();
setDeploymentLogs(logs);
}
};