feat: add loading button in test substep

This commit is contained in:
Ali BARIN
2022-08-20 11:15:47 +02:00
parent 5fb988ae2d
commit 17010f9283

View File

@@ -4,7 +4,7 @@ import Box from '@mui/material/Box';
import Collapse from '@mui/material/Collapse'; import Collapse from '@mui/material/Collapse';
import ListItem from '@mui/material/ListItem'; import ListItem from '@mui/material/ListItem';
import Alert from '@mui/material/Alert'; import Alert from '@mui/material/Alert';
import Button from '@mui/material/Button'; import LoadingButton from '@mui/lab/LoadingButton';
import JSONViewer from 'components/JSONViewer'; import JSONViewer from 'components/JSONViewer';
import { EXECUTE_FLOW } from 'graphql/mutations/execute-flow'; import { EXECUTE_FLOW } from 'graphql/mutations/execute-flow';
@@ -31,7 +31,7 @@ function TestSubstep(props: TestSubstepProps): React.ReactElement {
step, step,
} = props; } = props;
const [executeFlow, { data, error }] = useMutation(EXECUTE_FLOW, { context: { autoSnackbar: false }}); const [executeFlow, { data, error, loading }] = useMutation(EXECUTE_FLOW, { context: { autoSnackbar: false }});
const response = data?.executeFlow?.data; const response = data?.executeFlow?.data;
const { const {
@@ -68,14 +68,16 @@ function TestSubstep(props: TestSubstepProps): React.ReactElement {
</Box> </Box>
)} )}
<Button <LoadingButton
fullWidth fullWidth
variant="contained" variant="contained"
onClick={handleSubmit} onClick={handleSubmit}
sx={{ mt: 2 }} sx={{ mt: 2 }}
loading={loading}
color="primary"
> >
Test & Continue Test & Continue
</Button> </LoadingButton>
</ListItem> </ListItem>
</Collapse> </Collapse>
</React.Fragment> </React.Fragment>