import * as React from 'react'; import { useParams } from 'react-router-dom'; import Grid from '@mui/material/Grid'; import Box from '@mui/material/Box'; import AlertTitle from '@mui/material/AlertTitle'; import Alert from '@mui/material/Alert'; import useFormatMessage from 'hooks/useFormatMessage'; import ExecutionHeader from 'components/ExecutionHeader'; import ExecutionStep from 'components/ExecutionStep'; import Container from 'components/Container'; import useExecutionSteps from 'hooks/useExecutionSteps'; import useExecution from 'hooks/useExecution'; export default function Execution() { const { executionId } = useParams(); const formatMessage = useFormatMessage(); const { data: execution } = useExecution({ executionId }); const { data, isLoading: isExecutionStepsLoading, fetchNextPage, hasNextPage, isFetching, isFetchingNextPage, } = useExecutionSteps({ executionId: executionId, }); React.useEffect(() => { if (!isFetching && !isFetchingNextPage && hasNextPage) { fetchNextPage(); } }, [isFetching, isFetchingNextPage, hasNextPage, fetchNextPage]); return ( {!isExecutionStepsLoading && !data?.pages?.[0].data.length && ( {formatMessage('execution.noDataTitle')} {formatMessage('execution.noDataMessage')} )} {data?.pages?.map((group, i) => ( {group?.data?.map((executionStep) => ( ))} ))} ); }