Browse Source

update error text position

Signed-off-by: ryjiang <jiangruiyi@gmail.com>
ryjiang 1 year ago
parent
commit
5a94dbbdf4
2 changed files with 15 additions and 12 deletions
  1. 3 0
      client/src/pages/search/Styles.ts
  2. 12 12
      client/src/pages/search/VectorSearch.tsx

+ 3 - 0
client/src/pages/search/Styles.ts

@@ -105,6 +105,9 @@ export const getVectorSearchStyles = makeStyles((theme: Theme) => ({
     color: theme.palette.attuGrey.dark,
   },
   error: {
+    display: 'block',
+    marginTop: theme.spacing(-1),
+    padding:  '8px 0',
     color: theme.palette.error.main,
   },
 

+ 12 - 12
client/src/pages/search/VectorSearch.tsx

@@ -428,6 +428,17 @@ const VectorSearch = () => {
               handleVectorChange(e.target.value as string);
             }}
           />
+          {/* validation */}
+          {!vectorValueValid && (
+            <Typography variant="caption" className={classes.error}>
+              {searchTrans('vectorValueWarning', {
+                dimension:
+                  fieldType === DataTypeEnum.BinaryVector
+                    ? selectedFieldDimension / 8
+                    : selectedFieldDimension,
+              })}
+            </Typography>
+          )}
           {selectedFieldDimension !== 0 ? (
             <Button
               className={classes.exampleBtn}
@@ -449,17 +460,6 @@ const VectorSearch = () => {
           >
             {btnTrans('search')}
           </CustomButton>
-          {/* validation */}
-          {!vectorValueValid && (
-            <Typography variant="caption" className={classes.error}>
-              {searchTrans('vectorValueWarning', {
-                dimension:
-                  fieldType === DataTypeEnum.BinaryVector
-                    ? selectedFieldDimension / 8
-                    : selectedFieldDimension,
-              })}
-            </Typography>
-          )}
         </CardContent>
 
         <CardContent className={classes.s3}>
@@ -519,7 +519,7 @@ const VectorSearch = () => {
               className="btn"
               disabled={result.length === 0}
               onClick={() => {
-                console.log(searchResult)
+                console.log(searchResult);
                 saveCsvAs(searchResult, `search_result_${selectedCollection}`);
               }}
             >