فهرست منبع

using default textarea instead of MUI4 broken multipleline text field in
vector search page

Signed-off-by: ruiyi.jiang <ruiyi.jiang@zilliz.com>

ruiyi.jiang 1 سال پیش
والد
کامیت
b780680c70
3فایلهای تغییر یافته به همراه7 افزوده شده و 48 حذف شده
  1. 4 37
      client/src/pages/search/Styles.ts
  2. 2 10
      client/src/pages/search/VectorSearch.tsx
  3. 1 1
      client/src/utils/Common.ts

+ 4 - 37
client/src/pages/search/Styles.ts

@@ -17,43 +17,10 @@ export const getVectorSearchStyles = makeStyles((theme: Theme) => ({
       '& .textarea': {
         border: `1px solid ${theme.palette.attuGrey.main}`,
         borderRadius: theme.spacing(0.5),
-        padding: theme.spacing(0, 1),
-        marginBottom: theme.spacing(0.5),
-      },
-
-      // reset default style
-      '& .textfield': {
-        fontSize: '14px',
-        lineHeight: '20px',
-        fontWeight: 400,
-        height: '128px',
-
-        '&::before': {
-          borderBottom: 'none',
-        },
-
-        '&::after': {
-          borderBottom: 'none',
-        },
-      },
-
-      '& .multiline': {
-        '& textarea': {
-          overflow: 'auto',
-          // change scrollbar style
-          '&::-webkit-scrollbar': {
-            width: '8px',
-          },
-
-          '&::-webkit-scrollbar-track': {
-            backgroundColor: '#f9f9f9',
-          },
-
-          '&::-webkit-scrollbar-thumb': {
-            borderRadius: '8px',
-            backgroundColor: '#eee',
-          },
-        },
+        padding: theme.spacing(0.5, 1),
+        marginBottom: theme.spacing(1),
+        overflow: 'scroll',
+        height: '120px',
       },
     },
 

+ 2 - 10
client/src/pages/search/VectorSearch.tsx

@@ -1,5 +1,5 @@
 import { useCallback, useEffect, useMemo, useState, useContext } from 'react';
-import { TextField, Typography, Button } from '@material-ui/core';
+import { Typography, Button } from '@material-ui/core';
 import { useTranslation } from 'react-i18next';
 import { useLocation } from 'react-router-dom';
 import { ALL_ROUTER_TYPES } from '@/router/Types';
@@ -438,16 +438,8 @@ const VectorSearch = () => {
             ) : null}
           </Typography>
 
-          <TextField
+          <textarea
             className="textarea"
-            InputProps={{
-              classes: {
-                root: 'textfield',
-                multiline: 'multiline',
-              },
-            }}
-            multiline
-            minRows={5}
             placeholder={searchTrans('vectorPlaceholder')}
             value={vectors}
             onChange={(e: React.ChangeEvent<{ value: unknown }>) => {

+ 1 - 1
client/src/utils/Common.ts

@@ -63,7 +63,7 @@ export const generateIdByHash = (salt?: string) => {
 };
 
 export const generateVector = (dim: number) => {
-  return Array.from({ length: dim }).map(() => (Math.random() > 0.5 ? 1 : 0));
+  return Array.from({ length: dim }).map(() => (Math.random()));
 };
 
 export const cloneObj = (obj: any) => {