Display build logs only when available
All checks were successful
Lint / lint (20.x) (pull_request) Successful in 4m53s
All checks were successful
Lint / lint (20.x) (pull_request) Successful in 4m53s
This commit is contained in:
parent
1f7379e561
commit
75cc73f1d1
@ -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