import { useState } from "react"; import { Helmet } from "react-helmet"; import { faArrowUpRightFromSquare, faBookOpen, faBugs, faCircleInfo } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { useNavigate, useSearch } from "@tanstack/react-router"; import { createNotification } from "@app/components/notifications"; import { Button, Card, CardTitle, FormControl, Input, Select, SelectItem } from "@app/components/v2"; import { ROUTE_PATHS } from "@app/const/routes"; import { useWorkspace } from "@app/context"; import { useCreateIntegration } from "@app/hooks/api"; import { useGetIntegrationAuthApps, useGetIntegrationAuthById } from "@app/hooks/api/integrationAuth"; import { IntegrationsListPageTabs } from "@app/types/integrations"; export const DatabricksConfigurePage = () => { const navigate = useNavigate(); const { mutateAsync, isPending } = useCreateIntegration(); const { currentWorkspace } = useWorkspace(); const integrationAuthId = useSearch({ from: ROUTE_PATHS.SecretManager.Integratons.DatabricksConfigurePage.id, select: (el) => el.integrationAuthId }); const { data: integrationAuth, isPending: isintegrationAuthLoading } = useGetIntegrationAuthById( (integrationAuthId as string) ?? "" ); const { data: integrationAuthScopes, isPending: isIntegrationAuthScopesLoading } = useGetIntegrationAuthApps({ integrationAuthId: (integrationAuthId as string) ?? "" }); const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState( currentWorkspace.environments[0].slug ); const [targetScope, setTargetScope] = useState(""); const [secretPath, setSecretPath] = useState("/"); const handleButtonClick = async () => { try { if (!integrationAuth?.id) return; if (!targetScope) { createNotification({ type: "error", text: "Please select a scope" }); return; } const selectedScope = integrationAuthScopes?.find( (integrationAuthScope) => integrationAuthScope.name === targetScope ); if (!selectedScope) { createNotification({ type: "error", text: "Invalid scope selected" }); return; } await mutateAsync({ integrationAuthId: integrationAuth?.id, isActive: true, app: selectedScope.name, // scope name sourceEnvironment: selectedSourceEnvironment, secretPath }); navigate({ to: "/projects/$projectId/secret-manager/integrations", params: { projectId: currentWorkspace.id }, search: { selectedTab: IntegrationsListPageTabs.NativeIntegrations } }); } catch (err) { console.error(err); } }; return integrationAuth && selectedSourceEnvironment && integrationAuthScopes ? (
) : (
Something went wrong. Please contact{" "} support@infisical.com {" "} if the issue persists.