Display build logs only when available #10

Merged
nabarun merged 2 commits from update-ui into main 2024-10-22 12:43:21 +00:00
Showing only changes of commit 75cc73f1d1 - Show all commits

View File

@ -68,7 +68,9 @@ const DeploymentDetailsCard = ({
prodBranchDomains, prodBranchDomains,
}: DeployDetailsCardProps) => { }: DeployDetailsCardProps) => {
const [openDialog, setOpenDialog] = useState<boolean>(false); const [openDialog, setOpenDialog] = useState<boolean>(false);
const [deploymentLogs, setDeploymentLogs] = useState<string>(); const [deploymentLogs, setDeploymentLogs] = useState<string>(
'No deployment logs available',
);
const handleOpenDialog = () => setOpenDialog(true); const handleOpenDialog = () => setOpenDialog(true);
const handleCloseDialog = () => setOpenDialog(false); const handleCloseDialog = () => setOpenDialog(false);
@ -92,9 +94,11 @@ const DeploymentDetailsCard = ({
const fetchDeploymentLogs = useCallback(async () => { const fetchDeploymentLogs = useCallback(async () => {
let url = `${deployment.deployer.deployerApiUrl}/log/${deployment.applicationDeploymentRequestId}`; let url = `${deployment.deployer.deployerApiUrl}/log/${deployment.applicationDeploymentRequestId}`;
const res = await fetch(url, { cache: 'no-store' }); const res = await fetch(url, { cache: 'no-store' });
handleOpenDialog();
if (res.ok) {
const logs = await res.text(); const logs = await res.text();
setDeploymentLogs(logs); setDeploymentLogs(logs);
handleOpenDialog(); }
}, [ }, [
deployment.deployer.deployerApiUrl, deployment.deployer.deployerApiUrl,
deployment.applicationDeploymentRequestId, deployment.applicationDeploymentRequestId,