-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support setup output fields for vector search (#568)
* support setup output fields for vector search Signed-off-by: ryjiang <[email protected]> * remove console Signed-off-by: ryjiang <[email protected]> --------- Signed-off-by: ryjiang <[email protected]>
- Loading branch information
1 parent
2191f9c
commit 376f769
Showing
8 changed files
with
123 additions
and
5 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
client/src/components/customSelector/CustomMultiSelector.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { FC } from 'react'; | ||
import { | ||
FormControl, | ||
InputLabel, | ||
MenuItem, | ||
Select, | ||
Checkbox, | ||
} from '@material-ui/core'; | ||
import { withStyles } from '@material-ui/core/styles'; | ||
import { CustomMultiSelectorType } from './Types'; | ||
import { generateId } from '../../utils/Common'; | ||
import { render } from '@testing-library/react'; | ||
|
||
const CustomMenuItem = withStyles({ | ||
root: { | ||
minHeight: 'auto', | ||
padding: '0 8px', | ||
fontSize: '0.875rem', | ||
}, | ||
})(MenuItem); | ||
|
||
const CustomSelector: FC<CustomMultiSelectorType> = props => { | ||
const { | ||
label, | ||
values, | ||
onChange, | ||
options, | ||
classes, | ||
variant, | ||
wrapperClass = '', | ||
labelClass = '', | ||
size = 'small', | ||
renderValue = selected => <>selected</>, | ||
...others | ||
} = props; | ||
|
||
const id = generateId('selector'); | ||
|
||
return ( | ||
<FormControl variant={variant} className={wrapperClass} size={size}> | ||
{label && ( | ||
<InputLabel classes={{ root: labelClass }} htmlFor={id}> | ||
{label} | ||
</InputLabel> | ||
)} | ||
<Select | ||
classes={{ ...classes }} | ||
{...others} | ||
multiple={true} | ||
value={values} | ||
onChange={onChange} | ||
inputProps={{ | ||
id, | ||
}} | ||
renderValue={renderValue} | ||
> | ||
{options.map(v => ( | ||
<CustomMenuItem key={v.value} value={v.value}> | ||
<Checkbox checked={values.indexOf(v.value as string) !== -1} /> | ||
{v.label} | ||
</CustomMenuItem> | ||
))} | ||
</Select> | ||
</FormControl> | ||
); | ||
}; | ||
|
||
export default CustomSelector; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters