From ce18b63eeae370227fd7246ceebacd6749b8410e Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Sat, 7 Dec 2024 15:57:37 -0800 Subject: [PATCH] hide oauth sources (#3368) --- .../[connector]/AddConnectorPage.tsx | 40 ++++++++++--------- web/src/lib/types.ts | 6 +++ 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/web/src/app/admin/connectors/[connector]/AddConnectorPage.tsx b/web/src/app/admin/connectors/[connector]/AddConnectorPage.tsx index feec833a8e8b..62556993a918 100644 --- a/web/src/app/admin/connectors/[connector]/AddConnectorPage.tsx +++ b/web/src/app/admin/connectors/[connector]/AddConnectorPage.tsx @@ -19,7 +19,11 @@ import AdvancedFormPage from "./pages/Advanced"; import DynamicConnectionForm from "./pages/DynamicConnectorCreationForm"; import CreateCredential from "@/components/credentials/actions/CreateCredential"; import ModifyCredential from "@/components/credentials/actions/ModifyCredential"; -import { ConfigurableSources, ValidSources } from "@/lib/types"; +import { + ConfigurableSources, + oauthSupportedSources, + ValidSources, +} from "@/lib/types"; import { Credential, credentialTemplates } from "@/lib/connectors/credentials"; import { ConnectionConfiguration, @@ -154,13 +158,7 @@ export default function AddConnector({ const configuration: ConnectionConfiguration = connectorConfigs[connector]; // Form context and popup management - const { - setFormStep, - setAllowCreate: setAllowCreate, - formStep, - nextFormStep, - prevFormStep, - } = useFormContext(); + const { setFormStep, setAllowCreate, formStep } = useFormContext(); const { popup, setPopup } = usePopup(); // Hooks for Google Drive and Gmail credentials @@ -452,18 +450,22 @@ export default function AddConnector({ > Create New - {/* Button to sign in via OAuth */} - + {oauthSupportedSources.includes(connector) && + NEXT_PUBLIC_CLOUD_ENABLED && ( + + )} )} diff --git a/web/src/lib/types.ts b/web/src/lib/types.ts index 0face76c4202..29f0acf995ea 100644 --- a/web/src/lib/types.ts +++ b/web/src/lib/types.ts @@ -325,3 +325,9 @@ export type ConfigurableSources = Exclude< ValidSources, ValidSources.NotApplicable | ValidSources.IngestionApi >; + +export const oauthSupportedSources: ConfigurableSources[] = [ + ValidSources.Slack, +]; + +export type OAuthSupportedSource = (typeof oauthSupportedSources)[number];