Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
improve ui
Thiago Araujo da Silvabae4c313f2b8
diff --git a/frontend/src/components/v3/generic/Switch/Switch.tsx b/frontend/src/components/v3/generic/Switch/Switch.tsxindex 527e2ed757..0c6a0c0349 100644--- a/frontend/src/components/v3/generic/Switch/Switch.tsx+++ b/frontend/src/components/v3/generic/Switch/Switch.tsx@@ -21,6 +21,8 @@ const switchVariants = cva({variants: {variant: {+ primary:+ "data-[state=checked]:border-primary/25 data-[state=checked]:bg-primary/10 data-[state=checked]:hover:bg-primary/15 data-[state=checked]:hover:border-primary/30",outline:"data-[state=checked]:border-border data-[state=checked]:bg-foreground/10 data-[state=checked]:hover:bg-foreground/15 data-[state=checked]:hover:border-foreground/30",neutral:@@ -56,7 +58,9 @@ const switchThumbVariants = cva("data-[state=unchecked]:border-foreground/5 data-[state=unchecked]:bg-foreground/15","data-[state=unchecked]:group-hover/switch:bg-foreground/35","data-[state=checked]:border-foreground/5 data-[state=checked]:bg-foreground/65",- "data-[state=checked]:group-hover/switch:bg-foreground/75"+ "data-[state=checked]:group-hover/switch:bg-foreground/75",+ "group-data-[variant=primary]/switch:data-[state=checked]:bg-primary/80",+ "group-data-[variant=primary]/switch:data-[state=checked]:group-hover/switch:bg-primary"));@@ -70,6 +74,7 @@ function Switch({ className, variant, size = "default", ...props }: SwitchProps)<SwitchPrimitive.Rootdata-slot="switch"data-size={size}+ data-variant={variant ?? "outline"}className={cn(switchVariants({ variant }), className)}{...props}>diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitHubConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitHubConnectionForm.tsxindex 960c0d227c..d4ec187df7 100644--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitHubConnectionForm.tsx+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitHubConnectionForm.tsx@@ -6,10 +6,6 @@ import { z } from "zod";import { createNotification } from "@app/components/notifications";import { OrgPermissionCan } from "@app/components/permissions";import {- Accordion,- AccordionContent,- AccordionItem,- AccordionTrigger,Button,FormControl,Input,@@ -19,6 +15,7 @@ import {SelectItem,Tooltip} from "@app/components/v2";+import { Switch } from "@app/components/v3/generic/Switch";import { GatewayPicker } from "@app/components/v3/platform/GatewayPicker";import { apiRequest } from "@app/config/request";import { useOrganization, useSubscription } from "@app/context";@@ -109,6 +106,13 @@ type FormData = z.infer<typeof formSchema>;export const GitHubConnectionForm = ({ appConnection, projectId, onSubmit }: Props) => {const isUpdate = Boolean(appConnection);const [isRedirecting, setIsRedirecting] = useState(false);+ const [isEnterpriseEnabled, setIsEnterpriseEnabled] = useState(() =>+ Boolean(+ appConnection?.credentials &&+ "host" in appConnection.credentials &&+ appConnection.credentials.host+ )+ );const { currentOrg } = useOrganization();@@ -192,6 +196,7 @@ export const GitHubConnectionForm = ({ appConnection, projectId, onSubmit }: Pro...(stored.credentials?.host ? { host: stored.credentials.host } : {})}} as FormData);+ if (stored.credentials?.host) setIsEnterpriseEnabled(true);setPendingGitHubAppId(stored.resumeWithGitHubAppId);setIsResumed(true);} catch {@@ -391,6 +396,101 @@ export const GitHubConnectionForm = ({ appConnection, projectId, onSubmit }: Pro<FormProvider {...form}><form onSubmit={handleSubmit(submitHandler)}>{!isUpdate && <GenericAppConnectionsFields />}+ <div className="mb-4 flex items-center gap-3">+ <Switch+ id="github-enterprise"+ variant="primary"+ checked={isEnterpriseEnabled}+ onCheckedChange={(checked) => {+ setIsEnterpriseEnabled(checked);+ if (!checked) {+ setValue("credentials.instanceType" as never, "cloud" as never);+ setValue("credentials.host" as never, "" as never);+ setValue("gatewayId", null);+ setValue("gatewayPoolId", null);+ }+ }}+ />+ {/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}+ <label htmlFor="github-enterprise" className="cursor-pointer text-sm text-mineshaft-200">+ GitHub Enterprise+ </label>+ </div>+ {isEnterpriseEnabled && (+ <div className="mb-4 rounded-md border border-mineshaft-600 bg-mineshaft-800/40 p-4">+ <Controller+ name="credentials.instanceType"+ control={control}+ render={({ field }) => (+ <FormControl label="Instance Type">+ <Select+ value={field.value}+ onValueChange={(e) => {+ field.onChange(e);+ if (e === "cloud") {+ setValue("gatewayId", null);+ setValue("gatewayPoolId", null);+ }+ }}+ containerClassName="w-full"+ className="w-full border border-mineshaft-500"+ dropdownContainerClassName="max-w-none"+ placeholder="Enterprise Cloud"+ position="popper"+ >+ <SelectItem value="cloud">Enterprise Cloud</SelectItem>+ <SelectItem value="server">Enterprise Server</SelectItem>+ </Select>+ </FormControl>+ )}+ />+ <Controller+ name="credentials.host"+ control={control}+ shouldUnregister+ render={({ field, fieldState: { error } }) => (+ <FormControl+ errorText={error?.message}+ isError={Boolean(error?.message)}+ label="Instance Hostname"+ isOptional={instanceType === "cloud"}+ isRequired={instanceType === "server"}+ >+ <Input {...field} placeholder="github.mycompany.com" />+ </FormControl>+ )}+ />+ {subscription.gateway && instanceType === "server" && (+ <OrgPermissionCan+ I={OrgGatewayPermissionActions.AttachGateways}+ a={OrgPermissionSubjects.Gateway}+ >+ {(isAllowed) => (+ <FormControl label="Gateway">+ <Tooltip+ isDisabled={isAllowed}+ content="Restricted access. You don't have permission to attach gateways to resources."+ >+ <div>+ <GatewayPicker+ isDisabled={!isAllowed}+ value={{+ gatewayId: gatewayId ?? null,+ gatewayPoolId: gatewayPoolId ?? null+ }}+ onChange={({ gatewayId: newGwId, gatewayPoolId: newPoolId }) => {+ setValue("gatewayId", newGwId, { shouldDirty: true });+ setValue("gatewayPoolId", newPoolId, { shouldDirty: true });+ }}+ />+ </div>+ </Tooltip>+ </FormControl>+ )}+ </OrgPermissionCan>+ )}+ </div>+ )}<Controllername="method"control={control}@@ -424,87 +524,6 @@ export const GitHubConnectionForm = ({ appConnection, projectId, onSubmit }: Pro</FormControl>)}/>- <Accordion type="single" collapsible className="w-full">- <AccordionItem value="enterprise-options" className="data-[state=open]:border-none">- <AccordionTrigger className="h-fit flex-none pl-1 text-sm">- <div className="order-1 ml-3">GitHub Enterprise Options</div>- </AccordionTrigger>- <AccordionContent childrenClassName="px-0">- <Controller- name="credentials.instanceType"- control={control}- render={({ field }) => (- <FormControl label="Instance Type">- <Select- value={field.value}- onValueChange={(e) => {- field.onChange(e);- if (e === "cloud") {- setValue("gatewayId", null);- setValue("gatewayPoolId", null);- }- }}- containerClassName="w-full"- className="w-full border border-mineshaft-500"- dropdownContainerClassName="max-w-none"- placeholder="Enterprise Cloud"- position="popper"- >- <SelectItem value="cloud">Enterprise Cloud</SelectItem>- <SelectItem value="server">Enterprise Server</SelectItem>- </Select>- </FormControl>- )}- />-- <Controller- name="credentials.host"- control={control}- shouldUnregister- render={({ field, fieldState: { error } }) => (- <FormControl- errorText={error?.message}- isError={Boolean(error?.message)}- label="Instance Hostname"- isOptional={instanceType === "cloud"}- isRequired={instanceType === "server"}- >- <Input {...field} placeholder="github.com" />- </FormControl>- )}- />- {subscription.gateway && instanceType === "server" && (- <OrgPermissionCan- I={OrgGatewayPermissionActions.AttachGateways}- a={OrgPermissionSubjects.Gateway}- >- {(isAllowed) => (- <FormControl label="Gateway">- <Tooltip- isDisabled={isAllowed}- content="Restricted access. You don't have permission to attach gateways to resources."- >- <div>- <GatewayPicker- isDisabled={!isAllowed}- value={{- gatewayId: gatewayId ?? null,- gatewayPoolId: gatewayPoolId ?? null- }}- onChange={({ gatewayId: newGwId, gatewayPoolId: newPoolId }) => {- setValue("gatewayId", newGwId, { shouldDirty: true });- setValue("gatewayPoolId", newPoolId, { shouldDirty: true });- }}- />- </div>- </Tooltip>- </FormControl>- )}- </OrgPermissionCan>- )}- </AccordionContent>- </AccordionItem>- </Accordion>{selectedMethod === GitHubConnectionMethod.App && !isUpdate && (<FormControllabel="GitHub App"