|
@@ -1,115 +1,18 @@
|
|
|
-import { Theme, Typography, Chip, Tooltip } from '@mui/material';
|
|
|
+import { Typography, Chip, Tooltip } from '@mui/material';
|
|
|
import { useContext } from 'react';
|
|
|
import { useParams } from 'react-router-dom';
|
|
|
import AttuGrid from '@/components/grid/Grid';
|
|
|
import { ColDefinitionsType } from '@/components/grid/Types';
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
import Icons from '@/components/icons/Icons';
|
|
|
-import { formatFieldType } from '@/utils';
|
|
|
+import { formatFieldType, formatNumber } from '@/utils';
|
|
|
import { dataContext } from '@/context';
|
|
|
import IndexTypeElement from './IndexTypeElement';
|
|
|
import { getLabelDisplayedRows } from '@/pages/search/Utils';
|
|
|
import StatusAction from '@/pages/databases/collections/StatusAction';
|
|
|
import CustomToolTip from '@/components/customToolTip/CustomToolTip';
|
|
|
import { FieldObject } from '@server/types';
|
|
|
-import { makeStyles } from '@mui/styles';
|
|
|
-
|
|
|
-const useStyles = makeStyles((theme: Theme) => ({
|
|
|
- wrapper: {
|
|
|
- display: 'flex',
|
|
|
- flexDirection: 'column',
|
|
|
- flexGrow: 1,
|
|
|
- height: `100%`,
|
|
|
- overflow: 'auto',
|
|
|
- '& h5': {
|
|
|
- color: theme.palette.text.secondary,
|
|
|
- marginBottom: theme.spacing(0.5),
|
|
|
- fontSize: 13,
|
|
|
- fontWeight: 400,
|
|
|
- },
|
|
|
- },
|
|
|
- infoWrapper: {
|
|
|
- marginBottom: theme.spacing(2),
|
|
|
- paddingTop: theme.spacing(0.5),
|
|
|
- },
|
|
|
- horizonalBlock: {
|
|
|
- display: 'flex',
|
|
|
- flexWrap: 'wrap',
|
|
|
- '& >div': {
|
|
|
- marginRight: theme.spacing(2),
|
|
|
- },
|
|
|
- },
|
|
|
- block: {
|
|
|
- '& *': {
|
|
|
- fontSize: '14px',
|
|
|
- lineHeight: 1.5,
|
|
|
- },
|
|
|
- color: theme.palette.text.primary,
|
|
|
- paddingBottom: theme.spacing(2),
|
|
|
- },
|
|
|
- icon: {
|
|
|
- fontSize: '20px',
|
|
|
- marginLeft: theme.spacing(0.5),
|
|
|
- },
|
|
|
- extraBtn: {
|
|
|
- height: 24,
|
|
|
- },
|
|
|
- questionIcon: {
|
|
|
- position: 'relative',
|
|
|
- top: '2px',
|
|
|
- right: '-2px',
|
|
|
- },
|
|
|
- primaryKeyChip: {
|
|
|
- fontSize: '8px',
|
|
|
- position: 'relative',
|
|
|
- top: '3px',
|
|
|
- color: 'grey',
|
|
|
- },
|
|
|
- chip: {
|
|
|
- marginLeft: theme.spacing(0.5),
|
|
|
- marginRight: theme.spacing(0.5),
|
|
|
- fontSize: '12px',
|
|
|
- background: 'rgba(0, 0, 0, 0.04)',
|
|
|
- border: 'none',
|
|
|
- },
|
|
|
- featureChip: {
|
|
|
- marginLeft: 0,
|
|
|
- border: 'none',
|
|
|
- },
|
|
|
- nameWrapper: {
|
|
|
- display: 'flex',
|
|
|
- alignItems: 'center',
|
|
|
-
|
|
|
- '& .key': {
|
|
|
- width: '16px',
|
|
|
- height: '16px',
|
|
|
- marginLeft: theme.spacing(0.5),
|
|
|
- },
|
|
|
- },
|
|
|
-
|
|
|
- paramWrapper: {
|
|
|
- // set min width to prevent other table cell stretching
|
|
|
- minWidth: 180,
|
|
|
-
|
|
|
- '& .param': {
|
|
|
- marginRight: theme.spacing(2),
|
|
|
-
|
|
|
- '& .key': {
|
|
|
- color: theme.palette.text.secondary,
|
|
|
- display: 'inline-block',
|
|
|
- marginRight: theme.spacing(0.5),
|
|
|
- },
|
|
|
-
|
|
|
- '& .value': {
|
|
|
- color: theme.palette.text.primary,
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
-
|
|
|
- gridWrapper: {
|
|
|
- paddingBottom: theme.spacing(2),
|
|
|
- },
|
|
|
-}));
|
|
|
+import { useStyles } from './Styles';
|
|
|
|
|
|
const Overview = () => {
|
|
|
const { fetchCollection, collections, loading } = useContext(dataContext);
|
|
@@ -157,16 +60,10 @@ const Overview = () => {
|
|
|
className={classes.chip}
|
|
|
size="small"
|
|
|
label="Partition key"
|
|
|
- variant="outlined"
|
|
|
/>
|
|
|
) : null}
|
|
|
{f.autoID ? (
|
|
|
- <Chip
|
|
|
- className={classes.chip}
|
|
|
- size="small"
|
|
|
- label="auto id"
|
|
|
- variant="outlined"
|
|
|
- />
|
|
|
+ <Chip className={classes.chip} size="small" label="auto id" />
|
|
|
) : null}
|
|
|
</div>
|
|
|
);
|
|
@@ -279,101 +176,102 @@ const Overview = () => {
|
|
|
<section className={classes.wrapper}>
|
|
|
{collection && (
|
|
|
<section className={classes.infoWrapper}>
|
|
|
- <div className={classes.block}>
|
|
|
- <Typography variant="h5">
|
|
|
- {collectionTrans('description')}
|
|
|
- </Typography>
|
|
|
- <Typography variant="h6">
|
|
|
- {collection?.description || '--'}
|
|
|
- </Typography>
|
|
|
- </div>
|
|
|
+ <div className={classes.cardWrapper}>
|
|
|
+ <div className={classes.card}>
|
|
|
+ <Typography variant="h5">{collectionTrans('name')}</Typography>
|
|
|
+ <Typography variant="h6">{collection.collection_name}</Typography>
|
|
|
+ <Typography variant="h5">
|
|
|
+ {collectionTrans('description')}
|
|
|
+ </Typography>
|
|
|
+ <Typography variant="h6">
|
|
|
+ {collection?.description || '--'}
|
|
|
+ </Typography>
|
|
|
+ <Typography variant="h5">
|
|
|
+ {collectionTrans('createdTime')}
|
|
|
+ </Typography>
|
|
|
+ <Typography variant="h6">
|
|
|
+ {new Date(collection.createdTime).toLocaleString()}
|
|
|
+ </Typography>
|
|
|
+ </div>
|
|
|
|
|
|
- <section className={classes.horizonalBlock}>
|
|
|
- <div className={classes.block}>
|
|
|
+ <div className={classes.card}>
|
|
|
<Typography variant="h5">{collectionTrans('status')}</Typography>
|
|
|
+ <Typography variant="h6">
|
|
|
+ <StatusAction
|
|
|
+ status={collection.status}
|
|
|
+ percentage={collection.loadedPercentage}
|
|
|
+ collection={collection}
|
|
|
+ showExtraAction={true}
|
|
|
+ createIndexElement={CreateIndexElement}
|
|
|
+ />
|
|
|
+ </Typography>
|
|
|
+ <Typography variant="h5">{collectionTrans('replica')}</Typography>
|
|
|
+ <Typography variant="h6">
|
|
|
+ {collection.replicas?.length}
|
|
|
+ </Typography>
|
|
|
|
|
|
- <StatusAction
|
|
|
- status={collection.status}
|
|
|
- percentage={collection.loadedPercentage}
|
|
|
- collection={collection}
|
|
|
- showExtraAction={true}
|
|
|
- createIndexElement={CreateIndexElement}
|
|
|
- />
|
|
|
+ <Typography variant="h5">
|
|
|
+ {collection.loaded ? (
|
|
|
+ collectionTrans('count')
|
|
|
+ ) : (
|
|
|
+ <>
|
|
|
+ {collectionTrans('rowCount')}
|
|
|
+ <CustomToolTip title={collectionTrans('entityCountInfo')}>
|
|
|
+ <Icons.question
|
|
|
+ classes={{ root: classes.questionIcon }}
|
|
|
+ />
|
|
|
+ </CustomToolTip>
|
|
|
+ </>
|
|
|
+ )}
|
|
|
+ </Typography>
|
|
|
+ <Typography variant="h6">
|
|
|
+ {formatNumber(Number(collection?.rowCount || '0'))}
|
|
|
+ </Typography>
|
|
|
</div>
|
|
|
- </section>
|
|
|
-
|
|
|
- <div className={classes.block}>
|
|
|
- <Typography variant="h5">
|
|
|
- {collection.loaded ? (
|
|
|
- collectionTrans('count')
|
|
|
- ) : (
|
|
|
- <>
|
|
|
- {collectionTrans('rowCount')}
|
|
|
- <CustomToolTip title={collectionTrans('entityCountInfo')}>
|
|
|
- <Icons.question classes={{ root: classes.questionIcon }} />
|
|
|
- </CustomToolTip>
|
|
|
- </>
|
|
|
- )}
|
|
|
- </Typography>
|
|
|
- <Typography variant="h6">{collection?.rowCount || '0'}</Typography>
|
|
|
- </div>
|
|
|
+ <div className={classes.card}>
|
|
|
+ <Typography variant="h5">
|
|
|
+ {collectionTrans('features')}
|
|
|
+ </Typography>
|
|
|
+ <Typography variant="h6">
|
|
|
+ <Tooltip
|
|
|
+ title={
|
|
|
+ consistencyTooltipsMap[collection.consistency_level!] || ''
|
|
|
+ }
|
|
|
+ placement="top"
|
|
|
+ arrow
|
|
|
+ >
|
|
|
+ <Chip
|
|
|
+ className={`${classes.chip} ${classes.featureChip}`}
|
|
|
+ label={`${collectionTrans('consistency')}: ${
|
|
|
+ collection.consistency_level
|
|
|
+ }`}
|
|
|
+ size="small"
|
|
|
+ />
|
|
|
+ </Tooltip>
|
|
|
|
|
|
- <div className={classes.block}>
|
|
|
- <Typography variant="h5">
|
|
|
- {collectionTrans('createdTime')}
|
|
|
- </Typography>
|
|
|
- <Typography variant="h6">
|
|
|
- {new Date(collection.createdTime).toLocaleString()}
|
|
|
- </Typography>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div className={classes.block}>
|
|
|
- <Typography variant="h5">
|
|
|
- {collectionTrans('consistency')}
|
|
|
- <CustomToolTip title={collectionTrans('consistencyLevelInfo')}>
|
|
|
- <Icons.question classes={{ root: classes.questionIcon }} />
|
|
|
- </CustomToolTip>
|
|
|
- </Typography>
|
|
|
- <Typography variant="h6">
|
|
|
- <Tooltip
|
|
|
- title={
|
|
|
- consistencyTooltipsMap[collection.consistency_level!] || ''
|
|
|
- }
|
|
|
- placement="top"
|
|
|
- arrow
|
|
|
- >
|
|
|
- <Chip
|
|
|
- className={`${classes.chip} ${classes.featureChip}`}
|
|
|
- label={collection.consistency_level}
|
|
|
- variant="outlined"
|
|
|
- size="small"
|
|
|
- />
|
|
|
- </Tooltip>
|
|
|
- </Typography>
|
|
|
+ {collection &&
|
|
|
+ collection.schema &&
|
|
|
+ collection.schema.enable_dynamic_field ? (
|
|
|
+ <Tooltip
|
|
|
+ title={collectionTrans('dynamicSchemaTooltip')}
|
|
|
+ placement="top"
|
|
|
+ arrow
|
|
|
+ >
|
|
|
+ <Chip
|
|
|
+ className={`${classes.chip}`}
|
|
|
+ label={collectionTrans('dynamicSchema')}
|
|
|
+ size="small"
|
|
|
+ />
|
|
|
+ </Tooltip>
|
|
|
+ ) : null}
|
|
|
+ </Typography>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</section>
|
|
|
)}
|
|
|
|
|
|
<section className={classes.gridWrapper}>
|
|
|
- <Typography variant="h5">
|
|
|
- {collectionTrans('schema')}
|
|
|
- {collection &&
|
|
|
- collection.schema &&
|
|
|
- collection.schema.enable_dynamic_field ? (
|
|
|
- <Tooltip
|
|
|
- title={collectionTrans('dynamicSchemaTooltip')}
|
|
|
- placement="top"
|
|
|
- arrow
|
|
|
- >
|
|
|
- <Chip
|
|
|
- className={`${classes.chip}`}
|
|
|
- label={collectionTrans('dynamicSchema')}
|
|
|
- size="small"
|
|
|
- icon={<Icons.check />}
|
|
|
- />
|
|
|
- </Tooltip>
|
|
|
- ) : null}
|
|
|
- </Typography>
|
|
|
+ {/* <Typography variant="h5">{collectionTrans('schema')}</Typography> */}
|
|
|
|
|
|
<AttuGrid
|
|
|
toolbarConfigs={[]}
|