MCPcopy
hub / github.com/deepops-ai/deepops / DatasourceSelect

Function DatasourceSelect

ui/src/components/datasource/Select.tsx:30–54  ·  view source on GitHub ↗
({ value, onChange, allowTypes = [], variant = "unstyled",size="md" }: Props)

Source from the content-addressed store, hash-verified

28}
29
30const DatasourceSelect = ({ value, onChange, allowTypes = [], variant = "unstyled",size="md" }: Props) => {
31 const datasources = useStore($datasources)
32
33 const options = []
34 datasources.forEach((ds) => {
35 if (allowTypes.length > 0 && !allowTypes.includes(ds.type)) {
36 return
37 }
38
39 options.push({
40 label: ds.name,
41 value: ds.id,
42 icon: <Image width="30px" height="30px" mr="2" src={`/plugins/datasource/${ds.type}.svg`} />
43 })
44 })
45
46
47 return (
48 <InputSelect width="100%" isClearable value={value?.toString()} label={datasources.find(ds => ds.id == value)?.name} placeholder={"select datasource, support variable"} size="md" options={options} onChange={onChange} enableInput />
49 // <ChakraSelect value={{ value: value, label: datasources.find(ds => ds.id == value)?.name }} placeholder="select datasource" variant={variant} size={size} options={options}
50 // onChange={onChange}
51 // components={customComponents}
52 // />
53 )
54}
55
56export default DatasourceSelect
57

Callers

nothing calls this directly

Calls 1

findMethod · 0.80

Tested by

no test coverage detected