Skip to content

Commit

Permalink
fix: fix-bugs
Browse files Browse the repository at this point in the history
Signed-off-by: zhaoxinxin <[email protected]>
  • Loading branch information
Liam-Zhao committed Aug 11, 2023
1 parent d442269 commit 620a494
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 98 deletions.
1 change: 1 addition & 0 deletions public/icons/cluster/unfoldMore.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/components/clusters/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,8 @@ export default function EditCluster() {
setEditLoadingButton(false);
}
}
} else {
setEditLoadingButton(false);
}
};

Expand Down
165 changes: 83 additions & 82 deletions src/components/clusters/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ const theme = createTheme({
xs: 0,
sm: 600,
md: 900,
lg: 1200,
xl: 1536,
lg: 1135,
xl: 1440,
},
},
palette: {
Expand Down Expand Up @@ -301,103 +301,104 @@ export default function Clusters() {
<Grid item xs={12} className={styles.clusterListContainer} component="form" noValidate>
{Array.isArray(allClusters) &&
allClusters.map((item) => (
<Paper
<Box
key={item.id}
variant="outlined"
sx={{
mr: '1rem',
mb: '1rem',
maxWidth: '27rem',
width: '32.4%',
maxWidth: '28rem',
width: '33.333%',
pr: '1rem',
pb: '1rem',
':nth-of-type(3n)': {
mr: '0rem',
pr: '0rem ',
},
[theme.breakpoints.up('xl')]: {
':nth-of-type(3n)': {
mr: '1rem !important',
pr: '1rem !important',
},
},
}}
>
<Box className={styles.clusterListContent}>
<Box display="flex">
<span className={styles.idText}>ID&nbsp;:&nbsp;</span>
<Paper variant="outlined">
<Box className={styles.clusterListContent}>
<Box display="flex">
<span className={styles.idText}>ID&nbsp;:&nbsp;</span>
{clusterIsLoading ? (
<Skeleton sx={{ width: '1rem' }} />
) : (
<span className={styles.idText}>{item.id}</span>
)}
</Box>
{clusterIsLoading ? (
<Skeleton sx={{ width: '1rem' }} />
<Skeleton sx={{ width: '4rem', height: '1.4rem', mt: '0.8rem', mb: '0.8rem' }} />
) : (
<span className={styles.idText}>{item.id}</span>
<Box
display="flex"
alignItems="center"
justifyContent="center"
sx={{
mt: '0.8rem',
mb: '0.8rem',
width: item.is_default ? '4rem' : '6rem',
height: '1.4rem',
background: item.is_default ? 'var(--description-color)' : 'var(--button-color)',
color: item.is_default ? '#FFFFFF' : '#FFFFFF',
}}
>
<Typography variant="body2" fontFamily="system-ui">
{`${item.is_default ? 'Default' : 'Non-Default'}`}
</Typography>
</Box>
)}
</Box>
{clusterIsLoading ? (
<Skeleton sx={{ width: '4rem', height: '1.4rem', mt: '0.8rem', mb: '0.8rem' }} />
) : (
<Box
display="flex"
alignItems="center"
justifyContent="center"
sx={{
mt: '0.8rem',
mb: '0.8rem',
width: item.is_default ? '4rem' : '6rem',
height: '1.4rem',
background: item.is_default ? 'var(--description-color)' : 'var(--button-color)',
color: item.is_default ? '#FFFFFF' : '#FFFFFF',
}}
>
<Typography variant="body2" fontFamily="system-ui">
{`${item.is_default ? 'Default' : 'Non-Default'}`}
</Typography>
</Box>
)}
<Typography variant="h6">
{clusterIsLoading ? <Skeleton sx={{ width: '6rem' }} /> : item.name}
</Typography>
<Box display="flex" mt="0.4rem">
<Box display="flex" className={styles.locationContainer}>
<Typography variant="body2" fontFamily="mabry-bold">
IDC&nbsp;:&nbsp;
</Typography>
<Tooltip title={item.scopes.idc || '-'} placement="top">
<Typography variant="body2" className={styles.locationText}>
{clusterIsLoading ? <Skeleton sx={{ width: '6rem' }} /> : item.scopes.idc || '-'}
<Typography variant="h6">
{clusterIsLoading ? <Skeleton sx={{ width: '6rem' }} /> : item.name}
</Typography>
<Box display="flex" mt="0.4rem">
<Box display="flex" className={styles.locationContainer}>
<Typography variant="body2" fontFamily="mabry-bold">
IDC&nbsp;:&nbsp;
</Typography>
</Tooltip>
</Box>
<Box display="flex" className={styles.locationContainer}>
<Typography variant="body2" fontFamily="mabry-bold">
Location&nbsp;:&nbsp;
</Typography>
<Tooltip title={item.scopes.location || '-'} placement="top">
<Typography variant="body2" className={styles.locationText}>
{clusterIsLoading ? <Skeleton sx={{ width: '6rem' }} /> : item.scopes.location || '-'}
<Tooltip title={item.scopes.idc || '-'} placement="top">
<Typography variant="body2" className={styles.locationText}>
{clusterIsLoading ? <Skeleton sx={{ width: '6rem' }} /> : item.scopes.idc || '-'}
</Typography>
</Tooltip>
</Box>
<Box display="flex" className={styles.locationContainer}>
<Typography variant="body2" fontFamily="mabry-bold">
Location&nbsp;:&nbsp;
</Typography>
</Tooltip>
<Tooltip title={item.scopes.location || '-'} placement="top">
<Typography variant="body2" className={styles.locationText}>
{clusterIsLoading ? <Skeleton sx={{ width: '6rem' }} /> : item.scopes.location || '-'}
</Typography>
</Tooltip>
</Box>
</Box>
<Box className={styles.creatTimeContainer}>
<Chip
avatar={<MoreTimeIcon />}
label={clusterIsLoading ? <Skeleton sx={{ width: '6rem' }} /> : datetime(item.created_at)}
variant="outlined"
size="small"
/>
<IconButton
className={styles.buttonContent}
sx={{
'&.MuiButton-root': {
backgroundColor: '#fff',
padding: 0,
},
}}
onClick={() => {
navigate(`/clusters/${item.id}`);
}}
>
<ArrowCircleRightIcon fontSize="large" sx={{ color: 'var(--button-color)' }} />
</IconButton>
</Box>
</Box>
<Box className={styles.creatTimeContainer}>
<Chip
avatar={<MoreTimeIcon />}
label={clusterIsLoading ? <Skeleton sx={{ width: '6rem' }} /> : datetime(item.created_at)}
variant="outlined"
size="small"
/>
<IconButton
className={styles.buttonContent}
sx={{
'&.MuiButton-root': {
backgroundColor: '#fff',
padding: 0,
},
}}
onClick={() => {
navigate(`/clusters/${item.id}`);
}}
>
<ArrowCircleRightIcon fontSize="large" sx={{ color: 'var(--button-color)' }} />
</IconButton>
</Box>
</Box>
</Paper>
</Paper>
</Box>
))}
</Grid>
<Box display="flex" justifyContent="flex-end" sx={{ marginTop: theme.spacing(2) }}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/clusters/information.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export default function Information(props: { cluster: cluster; isLoading: boolea
<Box className={styles.clusterWrap}>
<Box className={styles.clusterTitle}>
<Typography variant="body2" component="div" color="#80828B" mr="0.2rem">
Seed Peer cluster ID
Seed peer cluster ID
</Typography>
<Tooltip
title="When the seed peer is deployed, the clusterID must be filled with this seed peer cluster ID in scheduler configuration. In this way, the seed peer will become the seed peer service of this cluster."
Expand Down Expand Up @@ -298,7 +298,7 @@ export default function Information(props: { cluster: cluster; isLoading: boolea
<Box className={styles.configContent}>
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<Typography variant="body2" component="div" color="#80828B" sx={{ mr: '0.2rem' }}>
Seed Peer load limit
Seed peer load limit
</Typography>
<Tooltip
title="If other peers download from the seed peer, the load of the seed peer will increase. When the load limit of the seed peer is reached, the scheduler will no longer schedule other peers to download from the seed peer until the it has the free load. seed_peer_cluster_config.load_limit"
Expand Down
2 changes: 1 addition & 1 deletion src/components/menu/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
background-position: center;
height: 100vh;
width: 100%;
max-width: 14rem;
max-width: 15rem;
background-color: rgba(254, 252, 251, 86%);
display: flex;
flex-direction: column;
Expand Down
30 changes: 20 additions & 10 deletions src/components/menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,24 +213,35 @@ export default function Layout(props: any) {
})}
</List>
</Grid>
<Grid sx={{ mb: '4rem' }}>
<Grid sx={{ mb: '4rem', ml: '1rem', mr: '1rem' }}>
<Box
sx={{
display: 'flex',
alignItems: 'flex-start',
justifyContent: 'space-between',
}}
>
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<Avatar className={styles.avatar} src={user?.avatar} />
<Box sx={{ width: '7rem' }}>
<Typography fontFamily="mabry-bold">{user?.name || '-'}</Typography>
<Box sx={{ display: 'flex', height: '100%' }}>
<Avatar
sx={{
width: '2.8rem',
height: '2.8rem',
mr: '0.6rem',
backgroundColor: 'var(--button-color)',
}}
src={user?.avatar}
/>
<Box
sx={{ width: '8rem', display: 'flex', flexDirection: 'column', justifyContent: 'space-between' }}
>
<Typography component="div" fontFamily="mabry-bold">
{user?.name || '-'}
</Typography>
<Tooltip title={user?.email || '-'} placement="top">
<Typography
component="div"
variant="caption"
sx={{
width: '7rem',
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
Expand All @@ -249,9 +260,9 @@ export default function Layout(props: any) {
aria-controls={open ? 'account-menu' : undefined}
aria-haspopup="true"
aria-expanded={open ? 'true' : undefined}
sx={{ mr: '0.6rem', position: 'relative' }}
sx={{ position: 'relative', padding: '0' }}
>
<UnfoldMoreIcon />
<Box component="img" sx={{ width: '1.2rem', height: '1.2rem' }} src="/icons/cluster/unfoldMore.svg" />
</IconButton>
</Box>
<Menu
Expand All @@ -261,12 +272,11 @@ export default function Layout(props: any) {
onClose={() => {
setAnchorEl(null);
}}
sx={{ position: 'absolute', top: '-5.5rem', left: '-4.8rem' }}
sx={{ position: 'absolute', top: '-6rem', left: '-5.5rem' }}
>
<MenuItem
onClick={() => {
setAnchorEl(null);

navigate('/profile');
}}
>
Expand Down
8 changes: 7 additions & 1 deletion src/components/signin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,14 @@ export default function SignIn() {
name: accountElement.value,
password: passwordElement.value,
});

if (accountElement.value === 'root' && passwordElement.value === 'dragonfly') {
router('/clusters', { state: { isFirstLogin: true } });
} else {
router('/clusters');
}

setPageLoding(true);
router('/clusters');
} catch (error) {
if (error instanceof Error) {
setErrorMessage(true);
Expand Down
4 changes: 2 additions & 2 deletions src/components/signup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function SignUp() {
const formList = [
{
formProps: {
name: 'account',
name: 'username',
label: 'Account',
autoComplete: 'family-name',
id: 'account',
Expand Down Expand Up @@ -187,7 +187,7 @@ export default function SignUp() {
const handleSubmit = async (event: any) => {
event.preventDefault();

const accountElement = event.currentTarget.elements.account;
const accountElement = event.currentTarget.elements.username;
const emailElement = event.currentTarget.elements.email;
const passwordElement = event.currentTarget.elements.password;

Expand Down

0 comments on commit 620a494

Please sign in to comment.