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,18 +450,22 @@ export default function AddConnector({
> >
Create New Create New
</button> </button>
{/* Button to sign in via OAuth */} {/* Button to sign in via OAuth */}
<button {oauthSupportedSources.includes(connector) &&
onClick={handleAuthorize} NEXT_PUBLIC_CLOUD_ENABLED && (
className="mt-6 text-sm bg-blue-500 px-2 py-1.5 flex text-text-200 flex-none rounded" <button
disabled={isAuthorizing} onClick={handleAuthorize}
hidden={!isAuthorizeVisible} className="mt-6 text-sm bg-blue-500 px-2 py-1.5 flex text-text-200 flex-none rounded"
> disabled={isAuthorizing}
{isAuthorizing hidden={!isAuthorizeVisible}
? "Authorizing..." >
: `Authorize with ${getSourceDisplayName(connector)}`} {isAuthorizing
</button> ? "Authorizing..."
: `Authorize with ${getSourceDisplayName(
connector
)}`}
</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];