diff --git a/web/src/app/admin/connectors/github/page.tsx b/web/src/app/admin/connectors/github/page.tsx index 28a918f3b..6d7e915d3 100644 --- a/web/src/app/admin/connectors/github/page.tsx +++ b/web/src/app/admin/connectors/github/page.tsx @@ -2,7 +2,10 @@ import * as Yup from "yup"; import { GithubIcon, TrashIcon } from "@/components/icons/icons"; -import { TextFormField } from "@/components/admin/connectors/Field"; +import { + BooleanFormField, + TextFormField, +} from "@/components/admin/connectors/Field"; import { HealthCheckBanner } from "@/components/health/healthcheck"; import useSWR, { useSWRConfig } from "swr"; import { errorHandlingFetcher } from "@/lib/fetcher"; @@ -150,8 +153,8 @@ const Main = () => { {githubConnectorIndexingStatuses.length > 0 && ( <> - We pull the latest Pull Requests from each repository listed below - every 10 minutes. + We pull the latest Pull Requests and/or Issues from each repository + listed below every 10 minutes.
@@ -188,7 +191,12 @@ const Main = () => { {githubCredential ? ( -

Connect to a New Repository

+

Connect to a New Repository

+ + + The Github connector can index Pull Requests and Issues. + + nameBuilder={(values) => `GithubConnector-${values.repo_owner}/${values.repo_name}` @@ -202,6 +210,16 @@ const Main = () => { <> + + } validationSchema={Yup.object().shape({ @@ -214,6 +232,15 @@ const Main = () => { include_prs: Yup.boolean().required(), include_issues: Yup.boolean().required(), })} + validate={(values) => { + if (values.include_prs || values.include_issues) { + return {} as Record; + } + return { + include_issues: + "Please select at least one of Pull Requests or Issues", + }; + }} initialValues={{ repo_owner: "", repo_name: "", diff --git a/web/src/components/admin/connectors/ConnectorForm.tsx b/web/src/components/admin/connectors/ConnectorForm.tsx index 626eb0d18..27ddc5db4 100644 --- a/web/src/components/admin/connectors/ConnectorForm.tsx +++ b/web/src/components/admin/connectors/ConnectorForm.tsx @@ -66,6 +66,7 @@ interface BaseProps { formBody?: JSX.Element | null; formBodyBuilder?: FormBodyBuilder; validationSchema: Yup.ObjectSchema; + validate?: (values: T) => Record; initialValues: T; onSubmit?: ( isSuccess: boolean, @@ -92,6 +93,7 @@ export function ConnectorForm({ formBody, formBodyBuilder, validationSchema, + validate, initialValues, refreshFreq, pruneFreq, @@ -136,6 +138,7 @@ export function ConnectorForm({ ...initialValues, }} validationSchema={finalValidationSchema} + validate={validate} onSubmit={async (values, formikHelpers) => { formikHelpers.setSubmitting(true); const connectorName = nameBuilder(values);