in radlab-ui/webapp/src/routes/DeploymentDetails.tsx [84:173]
message: t("error"),
durationMs: 10000,
type: ALERT_TYPE.ERROR,
})
} finally {
setLoading(false)
}
}
const renderTabHeader = (
tab: TAB_DETAILS,
title: string,
currentTab: TAB_DETAILS,
) => (
<a
className={classNames(
"tab md:tab-lg lg:tab-lg",
"mr-1 rounded-t-lg",
currentTab === tab ? "bg-base-100" : "bg-base-300",
currentTab === tab ? "tab-active" : "",
)}
onClick={() => setTabStatus(tab)}
>
{title}
</a>
)
const isDeployInProgress = (deploymentStatus: DEPLOYMENT_STATUS) => {
return [
DEPLOYMENT_STATUS.QUEUED,
DEPLOYMENT_STATUS.PENDING,
DEPLOYMENT_STATUS.WORKING,
].includes(deploymentStatus)
}
useEffect(() => {
// @ts-ignore
if (state?.deployment) {
// Already have deployment from previous page
// @ts-ignore
setDeployment(state.deployment)
// @ts-ignore
setDeployInProgress(isDeployInProgress(state.deployment.status))
} else {
fetchDeployment()
}
}, [])
useEffect(() => {
const t: TAB_DETAILS = !deployment
? TAB_DETAILS.BUILDS
: deployment.deletedAt
? TAB_DETAILS.BUILDS
: deployment.status === DEPLOYMENT_STATUS.SUCCESS
? TAB_DETAILS.OUTPUTS
: TAB_DETAILS.LOG
setTabStatus(t)
}, [deployment])
return (
<RouteContainer>
{deployment && (
<>
<div className="w-full flex flex-col sm:flex-row justify-between">
<button
className="btn btn-link gap-1 hover:no-underline transition"
onClick={() => navigate("/deployments")}
>
<ArrowLeftIcon className="h-5 w-5" />
{t("back")}
</button>
<div className="text-center mt-2">
<button
className="btn btn-link btn-sm gap-1 hover:no-underline transition hover:bg-base-300"
onClick={fetchDeployment}
disabled={isLoading}
>
<RefreshIcon
className={classNames(
"h-5 w-5",
isLoading ? "animate-spin" : "",
)}
/>
{isLoading ? t("refreshing") : t("refresh")}
</button>
{!deployment.deletedAt && (
<>
<span
className={classNames(