style: auto format whole project
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import { Link, useSearchParams } from 'react-router-dom';
|
||||
import { Link, useSearchParams } from 'react-router-dom';
|
||||
import { useQuery } from '@apollo/client';
|
||||
import Box from '@mui/material/Box';
|
||||
import Grid from '@mui/material/Grid';
|
||||
@@ -13,7 +13,7 @@ import NoResultFound from 'components/NoResultFound';
|
||||
import ExecutionRow from 'components/ExecutionRow';
|
||||
import Container from 'components/Container';
|
||||
import PageTitle from 'components/PageTitle';
|
||||
import useFormatMessage from 'hooks/useFormatMessage'
|
||||
import useFormatMessage from 'hooks/useFormatMessage';
|
||||
import { GET_EXECUTIONS } from 'graphql/queries/get-executions';
|
||||
|
||||
const EXECUTION_PER_PAGE = 10;
|
||||
@@ -38,44 +38,65 @@ export default function Executions(): React.ReactElement {
|
||||
|
||||
React.useEffect(() => {
|
||||
refetch(getLimitAndOffset(page));
|
||||
}, [refetch, page])
|
||||
}, [refetch, page]);
|
||||
|
||||
const executions: IExecution[] = edges?.map(({ node }: { node: IExecution }) => node);
|
||||
const executions: IExecution[] = edges?.map(
|
||||
({ node }: { node: IExecution }) => node
|
||||
);
|
||||
const hasExecutions = executions?.length;
|
||||
|
||||
return (
|
||||
<Box sx={{ py: 3 }}>
|
||||
<Container>
|
||||
<Grid container sx={{ mb: [0, 3] }} columnSpacing={1.5} rowSpacing={3}>
|
||||
<Grid container item xs sm alignItems="center" order={{ xs: 0, height: 80 }}>
|
||||
<Grid
|
||||
container
|
||||
item
|
||||
xs
|
||||
sm
|
||||
alignItems="center"
|
||||
order={{ xs: 0, height: 80 }}
|
||||
>
|
||||
<PageTitle>{formatMessage('executions.title')}</PageTitle>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<Divider sx={{ mt: [2, 0], mb: 2 }} />
|
||||
|
||||
{loading && <CircularProgress data-test="executions-loader" sx={{ display: 'block', margin: '20px auto' }} />}
|
||||
{loading && (
|
||||
<CircularProgress
|
||||
data-test="executions-loader"
|
||||
sx={{ display: 'block', margin: '20px auto' }}
|
||||
/>
|
||||
)}
|
||||
|
||||
{!loading && !hasExecutions && (<NoResultFound
|
||||
text={formatMessage('executions.noExecutions')}
|
||||
/>)}
|
||||
{!loading && !hasExecutions && (
|
||||
<NoResultFound text={formatMessage('executions.noExecutions')} />
|
||||
)}
|
||||
|
||||
{!loading && executions?.map((execution) => (<ExecutionRow key={execution.id} execution={execution} />))}
|
||||
{!loading &&
|
||||
executions?.map((execution) => (
|
||||
<ExecutionRow key={execution.id} execution={execution} />
|
||||
))}
|
||||
|
||||
{pageInfo && pageInfo.totalPages > 1 && <Pagination
|
||||
sx={{ display: 'flex', justifyContent: 'center', mt: 3 }}
|
||||
page={pageInfo?.currentPage}
|
||||
count={pageInfo?.totalPages}
|
||||
onChange={(event, page) => setSearchParams({ page: page.toString() })}
|
||||
renderItem={(item) => (
|
||||
<PaginationItem
|
||||
component={Link}
|
||||
to={`${item.page === 1 ? '' : `?page=${item.page}`}`}
|
||||
{...item}
|
||||
/>
|
||||
)}
|
||||
/>}
|
||||
{pageInfo && pageInfo.totalPages > 1 && (
|
||||
<Pagination
|
||||
sx={{ display: 'flex', justifyContent: 'center', mt: 3 }}
|
||||
page={pageInfo?.currentPage}
|
||||
count={pageInfo?.totalPages}
|
||||
onChange={(event, page) =>
|
||||
setSearchParams({ page: page.toString() })
|
||||
}
|
||||
renderItem={(item) => (
|
||||
<PaginationItem
|
||||
component={Link}
|
||||
to={`${item.page === 1 ? '' : `?page=${item.page}`}`}
|
||||
{...item}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
</Container>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user