From 35cba7e04b35bd4a78bdff02c5bbd0d1e70e1bd9 Mon Sep 17 00:00:00 2001 From: "ruiyi.jiang" Date: Thu, 10 Aug 2023 10:30:38 +0800 Subject: [PATCH] update vectorsearch page style Signed-off-by: ruiyi.jiang --- client/src/i18n/en/button.ts | 2 +- client/src/pages/search/Styles.ts | 85 +++++----- client/src/pages/search/VectorSearch.tsx | 205 +++++++++++------------ 3 files changed, 146 insertions(+), 146 deletions(-) diff --git a/client/src/i18n/en/button.ts b/client/src/i18n/en/button.ts index 0e1de520..6936417c 100644 --- a/client/src/i18n/en/button.ts +++ b/client/src/i18n/en/button.ts @@ -22,7 +22,7 @@ const btnTrans = { importSampleData: 'Import Sample data', loading: 'Loading...', importing: 'Importing...', - example: 'Example', + example: 'Generate random vector', rename: 'Rename', }; diff --git a/client/src/pages/search/Styles.ts b/client/src/pages/search/Styles.ts index 974a0641..3ce54260 100644 --- a/client/src/pages/search/Styles.ts +++ b/client/src/pages/search/Styles.ts @@ -1,63 +1,64 @@ import { makeStyles, Theme } from '@material-ui/core'; export const getVectorSearchStyles = makeStyles((theme: Theme) => ({ + pageContainer: { + display: 'flex', + flexDirection: 'column', + }, form: { display: 'flex', - justifyContent: 'space-between', + flexDirection: 'row', + gap: theme.spacing(0), - '& .field': { - display: 'flex', - flexDirection: 'column', - width: 250, - padding: theme.spacing(2), - backgroundColor: '#fff', + '& textarea': { + border: `1px solid ${theme.palette.attuGrey.main}`, borderRadius: theme.spacing(0.5), - boxShadow: '3px 3px 10px rgba(0, 0, 0, 0.05)', - - '& .textarea': { - border: `1px solid ${theme.palette.attuGrey.main}`, - borderRadius: theme.spacing(0.5), - padding: theme.spacing(0.5, 1), - marginBottom: theme.spacing(1), - overflow: 'scroll', - height: '120px', - }, - }, - - '& .field-second': { - flexGrow: 1, - flexBasis: '50%', - margin: theme.spacing(0, 1), - }, - - // Textfield component has more bottom space to show error msg when validation - // if still set padding-bottom, the whole form space will be stretched - '& .field-params': { - paddingBottom: 0, - width: 390, + padding: theme.spacing(0.5, 1), + marginTop: theme.spacing(0), + overflow: 'scroll', + height: '130px', + maxWidth: '100%', + width: '100%', + display: 'block', + boxSizing: 'border-box', }, - '& .text': { - color: theme.palette.attuGrey.dark, - fontWeight: 500, - marginBottom: theme.spacing(1), - height: theme.spacing(4), - '& button': { - marginLeft: '8px', - position: 'relative', - top: -5, - verticalAlign: 'top', - }, + marginBottom: theme.spacing(2), + }, + height: '210px', + overflow: 'hidden', + }, + s1: { + '& .MuiSelect-root': { + minWidth: '240px', }, }, + s2: { + minWidth: '600px', + position: 'relative', + }, + s3: { + minWidth: '260px', + }, selector: { - width: '100%', + display: 'block', marginBottom: theme.spacing(2), }, + exampleBtn: { + right: theme.spacing(2), + top: theme.spacing(1.5), + position: 'absolute', + }, paramsWrapper: { display: 'flex', flexDirection: 'column', }, + + resultsWrapper: { + display: 'flex', + flexDirection: 'column', + flexGrow: 1, + }, toolbar: { display: 'flex', justifyContent: 'space-between', diff --git a/client/src/pages/search/VectorSearch.tsx b/client/src/pages/search/VectorSearch.tsx index 61b82465..19d2a968 100644 --- a/client/src/pages/search/VectorSearch.tsx +++ b/client/src/pages/search/VectorSearch.tsx @@ -1,5 +1,11 @@ import { useCallback, useEffect, useMemo, useState, useContext } from 'react'; -import { Typography, Button } from '@material-ui/core'; +import { + Typography, + Button, + Card, + CardContent, + CardActionArea, +} from '@material-ui/core'; import { useTranslation } from 'react-i18next'; import { useLocation } from 'react-router-dom'; import { ALL_ROUTER_TYPES } from '@/router/Types'; @@ -371,11 +377,9 @@ const VectorSearch = () => { }; return ( -
- {/* form section */} -
- {/* collection and field selectors */} -
+
+ + {searchTrans('secondTip')} { setSelectedField(field as string); }} /> -
- {/** - * vector value textarea - * use field-params class because it also has error msg if invalid - */} -
+ + + {searchTrans('firstTip', { dimensionTip: @@ -423,6 +424,7 @@ const VectorSearch = () => { })} {selectedFieldDimension !== 0 ? (
+ - {/* search params selectors */} -
+ {searchTrans('thirdTip')} { topK={topK} setParamsDisabled={setParamDisabled} /> -
-
- - {/** - * search toolbar section - * including topK selector, advanced filter, search and reset btn - */} -
-
- - {`${searchTrans('result')}: `} - - {/* topK selector */} - ({ - label: item.toString(), - callback: () => { - setTopK(item); - if (!searchDisabled) { - handleSearch(item); - } - }, - wrapperClass: classes.menuItem, - }))} - buttonProps={{ - className: classes.menuLabel, - endIcon: , - }} - menuItemWidth="108px" - /> - - + + +
+
+
+ + {`${searchTrans('result')}: `} + + {/* topK selector */} + ({ + label: item.toString(), + callback: () => { + setTopK(item); + if (!searchDisabled) { + handleSearch(item); + } + }, + wrapperClass: classes.menuItem, + }))} + buttonProps={{ + className: classes.menuLabel, + endIcon: , + }} + menuItemWidth="108px" + /> + + + +
+
+ + + {btnTrans('reset')} + + handleSearch(topK)} + > + {btnTrans('search')} + +
+
+ + {/* search result table section */} + {(searchResult && searchResult.length > 0) || tableLoading ? ( + - } + text={ + searchResult !== null + ? searchTrans('empty') + : searchTrans('startTip') + } /> -
-
- - - {btnTrans('reset')} - - handleSearch(topK)} - > - {btnTrans('search')} - -
+ )}
- - {/* search result table section */} - {(searchResult && searchResult.length > 0) || tableLoading ? ( - - ) : ( - } - text={ - searchResult !== null - ? searchTrans('empty') - : searchTrans('startTip') - } - /> - )}
); };