import { useEffect, useState } from "react"; import { Helmet } from "react-helmet"; import { faArrowUpRightFromSquare, faBookOpen, faBugs } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { useNavigate, useSearch } from "@tanstack/react-router"; import { motion } from "framer-motion"; import { Button, Card, CardTitle, FormControl, Input, Select, SelectItem, Tab, TabList, TabPanel, Tabs } 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, useGetIntegrationAuthChecklyGroups } from "@app/hooks/api/integrationAuth"; import { useGetWorkspaceById } from "@app/hooks/api/workspace"; enum TabSections { Connection = "connection", Options = "options" } export const ChecklyConfigurePage = () => { const navigate = useNavigate(); const { mutateAsync } = useCreateIntegration(); const integrationAuthId = useSearch({ from: ROUTE_PATHS.SecretManager.Integratons.ChecklyConfigurePage.id, select: (el) => el.integrationAuthId }); const { currentWorkspace } = useWorkspace(); const [selectedSourceEnvironment, setSelectedSourceEnvironment] = useState(""); const [secretPath, setSecretPath] = useState("/"); const [secretSuffix, setSecretSuffix] = useState(""); const [targetAppId, setTargetAppId] = useState(""); const [targetGroupId, setTargetGroupId] = useState(""); const [isLoading, setIsLoading] = useState(false); const { data: workspace } = useGetWorkspaceById(currentWorkspace.id); const { data: integrationAuth } = useGetIntegrationAuthById((integrationAuthId as string) ?? ""); const { data: integrationAuthApps, isPending: isIntegrationAuthAppsLoading } = useGetIntegrationAuthApps({ integrationAuthId: (integrationAuthId as string) ?? "" }); const { data: integrationAuthGroups, isPending: isintegrationAuthGroupsLoading } = useGetIntegrationAuthChecklyGroups({ integrationAuthId: (integrationAuthId as string) ?? "", accountId: targetAppId }); useEffect(() => { if (workspace) { setSelectedSourceEnvironment(workspace.environments[0].slug); } }, [workspace]); useEffect(() => { if (integrationAuthApps) { if (integrationAuthApps.length > 0) { setTargetAppId(integrationAuthApps[0].appId as string); } else { setTargetAppId("none"); } } }, [integrationAuthApps]); const handleButtonClick = async () => { try { if (!integrationAuth?.id) return; setIsLoading(true); const targetApp = integrationAuthApps?.find( (integrationAuthApp) => integrationAuthApp.appId === targetAppId ); const targetGroup = integrationAuthGroups?.find( (group) => group.groupId === Number(targetGroupId) ); if (!targetApp) return; await mutateAsync({ integrationAuthId: integrationAuth?.id, isActive: true, app: targetApp?.name, appId: targetApp?.appId, sourceEnvironment: selectedSourceEnvironment, targetService: targetGroup?.name, targetServiceId: targetGroup?.groupId ? String(targetGroup?.groupId) : undefined, secretPath, metadata: { secretSuffix } }); setIsLoading(false); navigate({ to: "/secret-manager/$projectId/integrations", params: { projectId: currentWorkspace.id } }); } catch (err) { console.error(err); } }; return integrationAuth && workspace && selectedSourceEnvironment && integrationAuthApps && integrationAuthGroups && targetAppId ? (
Set Up Checkly Integration
Checkly logo
Checkly Integration
Docs
Connection Options
setSecretPath(evt.target.value)} placeholder="Provide a path, default is /" /> setSecretSuffix(evt.target.value)} placeholder="Provide a suffix for secret names, default is no suffix" />
) : (
Set Up Checkly Integration {isIntegrationAuthAppsLoading || isintegrationAuthGroupsLoading ? ( infisical loading indicator ) : (

Something went wrong. Please contact{" "} support@infisical.com {" "} if the issue persists.

)}
); };