hide oauth sources (#3368)

This commit is contained in:
pablodanswer
2024-12-07 15:57:37 -08:00
committed by GitHub
parent 7a919c3589
commit ce18b63eea
2 changed files with 27 additions and 19 deletions

View File

@@ -19,7 +19,11 @@ import AdvancedFormPage from "./pages/Advanced";
import DynamicConnectionForm from "./pages/DynamicConnectorCreationForm"; import DynamicConnectionForm from "./pages/DynamicConnectorCreationForm";
import CreateCredential from "@/components/credentials/actions/CreateCredential"; import CreateCredential from "@/components/credentials/actions/CreateCredential";
import ModifyCredential from "@/components/credentials/actions/ModifyCredential"; 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 { Credential, credentialTemplates } from "@/lib/connectors/credentials";
import { import {
ConnectionConfiguration, ConnectionConfiguration,
@@ -154,13 +158,7 @@ export default function AddConnector({
const configuration: ConnectionConfiguration = connectorConfigs[connector]; const configuration: ConnectionConfiguration = connectorConfigs[connector];
// Form context and popup management // Form context and popup management
const { const { setFormStep, setAllowCreate, formStep } = useFormContext();
setFormStep,
setAllowCreate: setAllowCreate,
formStep,
nextFormStep,
prevFormStep,
} = useFormContext();
const { popup, setPopup } = usePopup(); const { popup, setPopup } = usePopup();
// Hooks for Google Drive and Gmail credentials // Hooks for Google Drive and Gmail credentials
@@ -452,8 +450,9 @@ export default function AddConnector({
> >
Create New Create New
</button> </button>
{/* Button to sign in via OAuth */} {/* Button to sign in via OAuth */}
{oauthSupportedSources.includes(connector) &&
NEXT_PUBLIC_CLOUD_ENABLED && (
<button <button
onClick={handleAuthorize} onClick={handleAuthorize}
className="mt-6 text-sm bg-blue-500 px-2 py-1.5 flex text-text-200 flex-none rounded" className="mt-6 text-sm bg-blue-500 px-2 py-1.5 flex text-text-200 flex-none rounded"
@@ -462,8 +461,11 @@ export default function AddConnector({
> >
{isAuthorizing {isAuthorizing
? "Authorizing..." ? "Authorizing..."
: `Authorize with ${getSourceDisplayName(connector)}`} : `Authorize with ${getSourceDisplayName(
connector
)}`}
</button> </button>
)}
</div> </div>
)} )}

View File

@@ -325,3 +325,9 @@ export type ConfigurableSources = Exclude<
ValidSources, ValidSources,
ValidSources.NotApplicable | ValidSources.IngestionApi ValidSources.NotApplicable | ValidSources.IngestionApi
>; >;
export const oauthSupportedSources: ConfigurableSources[] = [
ValidSources.Slack,
];
export type OAuthSupportedSource = (typeof oauthSupportedSources)[number];