Display deployment status if logs are not available
This commit is contained in:
parent
d96a7af224
commit
96c00cc371
@ -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 && (
|
||||||
|
@ -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(
|
||||||
|
(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();
|
handleOpenDialog();
|
||||||
if (res.ok) {
|
|
||||||
const logs = await res.text();
|
|
||||||
setDeploymentLogs(logs);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user