Display build logs only when available #10
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user