@@ -290,15 +278,14 @@ const CopilotRequestForm: FC<{}> = () => {
Select the project you want the copilot for
diff --git a/src/apps/copilots/src/services/projects.ts b/src/apps/copilots/src/services/projects.ts
index 9bdca01b0..45b26131e 100644
--- a/src/apps/copilots/src/services/projects.ts
+++ b/src/apps/copilots/src/services/projects.ts
@@ -42,3 +42,9 @@ export const useProjects = (search?: string, config?: {isPaused?: () => boolean,
revalidateOnFocus: false,
})
}
+
+export const getProjects = (search?: string, filter?: any): Promise => {
+ const params = { name: `"${search}"`, ...filter }
+ const url = buildUrl(baseUrl, params)
+ return xhrGetAsync(url)
+}
diff --git a/src/libs/ui/lib/components/form/form-groups/form-input/input-select-react/InputSelectReact.tsx b/src/libs/ui/lib/components/form/form-groups/form-input/input-select-react/InputSelectReact.tsx
index 48546fa7f..224f73928 100644
--- a/src/libs/ui/lib/components/form/form-groups/form-input/input-select-react/InputSelectReact.tsx
+++ b/src/libs/ui/lib/components/form/form-groups/form-input/input-select-react/InputSelectReact.tsx
@@ -8,6 +8,8 @@ import {
useRef,
} from 'react'
import { find } from 'lodash'
+import AsyncCreatable from 'react-select/async-creatable'
+import AsyncSelect from 'react-select/async'
import CreatableSelect from 'react-select/creatable'
import ReactSelect, { GroupBase, OptionsOrGroups } from 'react-select'
import classNames from 'classnames'
@@ -33,7 +35,7 @@ interface InputSelectReactProps {
readonly name: string
readonly onChange: (event: ChangeEvent) => void
readonly onInputChange?: (newValue: string) => void
- readonly options: OptionsOrGroups>
+ readonly options?: OptionsOrGroups>
readonly placeholder?: string
readonly tabIndex?: number
readonly value?: string
@@ -43,6 +45,8 @@ interface InputSelectReactProps {
readonly onBlur?: (event: FocusEvent) => void
readonly openMenuOnClick?: boolean
readonly openMenuOnFocus?: boolean
+ readonly async?: boolean
+ readonly loadOptions?: (inputValue: string, callback: (option: any) => void) => void
readonly filterOption?: (option: InputSelectOption, value: string) => boolean
}
@@ -120,9 +124,13 @@ const InputSelectReact: FC = props => {
} as FocusEvent)
}
- const Input = useMemo(() => (
- props.creatable ? CreatableSelect : ReactSelect
- ), [props.creatable])
+ const Input = useMemo(() => {
+ if (props.async) {
+ return props.creatable ? AsyncCreatable : AsyncSelect
+ }
+
+ return props.creatable ? CreatableSelect : ReactSelect
+ }, [props.creatable, props.async])
return (
= props => {
styles.select,
)
}
+ loadOptions={props.loadOptions}
onChange={handleSelect}
onInputChange={props.onInputChange}
menuPortalTarget={menuPortalTarget}