Browse Source

add limits for query

Signed-off-by: shanghaikid <jiangruiyi@gmail.com>
shanghaikid 2 years ago
parent
commit
5a199ea288

+ 8 - 1
client/src/components/cards/EmptyCard.tsx

@@ -10,19 +10,25 @@ const useStyles = makeStyles((theme: Theme) => ({
     flexDirection: 'column',
     flexDirection: 'column',
   },
   },
   text: {
   text: {
-    marginTop: theme.spacing(4),
+    marginTop: theme.spacing(2),
     fontSize: '36px',
     fontSize: '36px',
     lineHeight: '42px',
     lineHeight: '42px',
     color: theme.palette.attuGrey.dark,
     color: theme.palette.attuGrey.dark,
     fontWeight: 'bold',
     fontWeight: 'bold',
     letterSpacing: '-0.02em',
     letterSpacing: '-0.02em',
   },
   },
+  subText: {
+    fontSize: '18px',
+    marginTop: theme.spacing(1),
+    color: theme.palette.attuGrey.dark,
+  },
 }));
 }));
 
 
 const EmptyCard: FC<EmptyCardProps> = ({
 const EmptyCard: FC<EmptyCardProps> = ({
   icon,
   icon,
   text,
   text,
   wrapperClass = '',
   wrapperClass = '',
+  subText = '',
   loading = false,
   loading = false,
 }) => {
 }) => {
   const classes = useStyles();
   const classes = useStyles();
@@ -34,6 +40,7 @@ const EmptyCard: FC<EmptyCardProps> = ({
       {loading && <StatusIcon type={ChildrenStatusType.CREATING} size={40} />}
       {loading && <StatusIcon type={ChildrenStatusType.CREATING} size={40} />}
       {icon}
       {icon}
       <Typography className={classes.text}>{text}</Typography>
       <Typography className={classes.text}>{text}</Typography>
+      <Typography className={classes.subText}>{subText}</Typography>
     </section>
     </section>
   );
   );
 };
 };

+ 1 - 0
client/src/components/cards/Types.ts

@@ -2,6 +2,7 @@ import { ReactElement } from 'react';
 
 
 export interface EmptyCardProps {
 export interface EmptyCardProps {
   text: string;
   text: string;
+  subText?: string;
   icon?: ReactElement;
   icon?: ReactElement;
   wrapperClass?: string;
   wrapperClass?: string;
   loading?: boolean;
   loading?: boolean;

+ 3 - 1
client/src/i18n/en/collection.ts

@@ -84,7 +84,9 @@ const collectionTrans = {
   schemaTab: 'Schema',
   schemaTab: 'Schema',
   queryTab: 'Data Query',
   queryTab: 'Data Query',
   previewTab: 'Data Preview',
   previewTab: 'Data Preview',
-  startTip: 'Start your data query',
+  startTip: 'Start your data query.',
+  dataQuerylimits:
+    ' Please note that the maximum number of results for your data query is 16384.',
   exprPlaceHolder: 'Please enter your data query, for example id > 0',
   exprPlaceHolder: 'Please enter your data query, for example id > 0',
 
 
   // alias dialog
   // alias dialog

+ 3 - 0
client/src/pages/query/Query.tsx

@@ -143,6 +143,8 @@ const Query: FC<{
       const res = await CollectionHttp.queryData(collectionName, {
       const res = await CollectionHttp.queryData(collectionName, {
         expr: expr,
         expr: expr,
         output_fields: fields.map(i => i.name),
         output_fields: fields.map(i => i.name),
+        offset: 0,
+        limit: 16384,
         // travel_timestamp: timeTravelInfo.timestamp,
         // travel_timestamp: timeTravelInfo.timestamp,
       });
       });
       const result = res.data;
       const result = res.data;
@@ -322,6 +324,7 @@ const Query: FC<{
               ? searchTrans('empty')
               ? searchTrans('empty')
               : collectionTrans('startTip')
               : collectionTrans('startTip')
           }
           }
+          subText={collectionTrans('dataQuerylimits')}
         />
         />
       )}
       )}
     </div>
     </div>