Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix(cert-manager): offer inline connection creation when installing an intermediate CA via external CA

Claude4cc987b106db
diff --git a/AGENTS.md b/AGENTS.md
index 6c1be655f4..6fe637991b 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -28,6 +28,8 @@ When building frontend UI, follow [DESIGN.md](DESIGN.md) for the v3 design syste
Before changing a shared frontend component's lifecycle, read the [shared component lifecycle ledger](frontend/src/components/COMPONENT_LIFECYCLE.md) for current deprecations, blockers, and replacement decisions.
+Pickers for entities a user may need to create first (app connections, gateways, and similar) must offer an inline "Create new X" row, gated on the create permission, so the user never has to leave the flow. Build them with the v3 `Combobox` and its `creation` prop, which renders that row; `Combobox` replaces both the deprecated `FilterableSelect` and `CreatableSelect`. For app connections, have `creation` open `AddAppConnectionModal` with the app preset and select the new connection on completion (see `CaInstallCertModal/VenafiCaInstallForm.tsx`).
+
## Issue and PR Guidelines
- Never create a GitHub issue.
diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/AdcsCaInstallForm.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/AdcsCaInstallForm.tsx
index 2748044bac..bb64149a91 100644
--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/AdcsCaInstallForm.tsx
+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/AdcsCaInstallForm.tsx
@@ -1,3 +1,4 @@
+import { useState } from "react";
import { Controller, useForm } from "react-hook-form";
import { SingleValue } from "react-select";
import { zodResolver } from "@hookform/resolvers/zod";
@@ -12,7 +13,10 @@ import {
Select,
SelectItem
} from "@app/components/v2";
-import { useProject } from "@app/context";
+import { Combobox, Field, FieldError, FieldLabel } from "@app/components/v3";
+import { ProjectPermissionSub, useProject, useProjectPermission } from "@app/context";
+import { ProjectPermissionAppConnectionActions } from "@app/context/ProjectPermissionContext/types";
+import { APP_CONNECTION_MAP } from "@app/helpers/appConnections";
import {
CaSigningConfigType,
useCreateCaSigningConfig,
@@ -20,13 +24,11 @@ import {
useInstallCaCertificateAdcs,
useUpdateCaSigningConfig
} from "@app/hooks/api";
-import {
- TAvailableAppConnection,
- useListAvailableAppConnections
-} from "@app/hooks/api/appConnections";
+import { useListAvailableAppConnections } from "@app/hooks/api/appConnections";
import { useAzureAdcsConnectionListTemplates } from "@app/hooks/api/appConnections/azure-adcs";
import { AppConnection } from "@app/hooks/api/appConnections/enums";
import { UsePopUpState } from "@app/hooks/usePopUp";
+import { AddAppConnectionModal } from "@app/pages/organization/AppConnections/AppConnectionsPage/components";
const schema = z.object({
appConnectionId: z.string().min(1, "App connection is required"),
@@ -52,12 +54,19 @@ export const AdcsCaInstallForm = ({ caId, handlePopUpToggle }: Props) => {
const { data: availableAdcsConnections, isPending: isAdcsPending } =
useListAvailableAppConnections(AppConnection.AzureADCS, currentProject.id);
+ const { permission } = useProjectPermission();
+ const [isCreateConnectionOpen, setIsCreateConnectionOpen] = useState(false);
+ const canCreateConnection = permission.can(
+ ProjectPermissionAppConnectionActions.Create,
+ ProjectPermissionSub.AppConnections
+ );
const {
control,
handleSubmit,
reset,
watch,
+ setValue,
formState: { isSubmitting }
} = useForm<FormData>({
resolver: zodResolver(schema),
@@ -134,27 +143,51 @@ export const AdcsCaInstallForm = ({ caId, handlePopUpToggle }: Props) => {
control={control}
name="appConnectionId"
render={({ field: { onChange, value }, fieldState: { error } }) => (
- <FormControl
- label="Azure AD CS Connection"
- errorText={error?.message}
- isError={Boolean(error)}
- isRequired
- >
- <FilterableSelect
+ <Field className="mb-4">
+ <FieldLabel>
+ Azure AD CS Connection <span className="text-danger">*</span>
+ </FieldLabel>
+ <Combobox
+ isError={Boolean(error)}
+ modal
+ isClearable={false}
isLoading={isAdcsPending}
- value={(availableAdcsConnections || []).find((conn) => conn.id === value)}
- onChange={(option) => {
- const selected = option as SingleValue<TAvailableAppConnection>;
- onChange(selected?.id ?? "");
+ value={(availableAdcsConnections || []).find((conn) => conn.id === value) ?? null}
+ onValueChange={(option) => {
+ onChange(option.id);
}}
options={availableAdcsConnections || []}
placeholder="Select an Azure AD CS connection..."
getOptionLabel={(option) => option.name}
getOptionValue={(option) => option.id}
+ creation={
+ canCreateConnection
+ ? {
+ emptyLabel: `Create ${APP_CONNECTION_MAP[AppConnection.AzureADCS].name} Connection`,
+ formatLabel: () =>
+ `Create ${APP_CONNECTION_MAP[AppConnection.AzureADCS].name} Connection`,
+ onCreate: () => setIsCreateConnectionOpen(true)
+ }
+ : undefined
+ }
/>
- </FormControl>
+ <FieldError errors={[error]} />
+ </Field>
)}
/>
+ {/* the modal portals out of the DOM but React still bubbles its submit to this form */}
+ <div className="contents" onSubmit={(e) => e.stopPropagation()}>
+ <AddAppConnectionModal
+ isOpen={isCreateConnectionOpen}
+ onOpenChange={setIsCreateConnectionOpen}
+ projectType={currentProject.type}
+ projectId={currentProject.id}
+ app={AppConnection.AzureADCS}
+ onComplete={(connection) => {
+ setValue("appConnectionId", connection.id, { shouldValidate: true });
+ }}
+ />
+ </div>
<Controller
control={control}
name="template"
diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/AdcsNativeCaInstallForm.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/AdcsNativeCaInstallForm.tsx
index 8e86a4b064..cb25f2177b 100644
--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/AdcsNativeCaInstallForm.tsx
+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/AdcsNativeCaInstallForm.tsx
@@ -1,3 +1,4 @@
+import { useState } from "react";
import { Controller, useForm } from "react-hook-form";
import { SingleValue } from "react-select";
import { zodResolver } from "@hookform/resolvers/zod";
@@ -12,7 +13,10 @@ import {
Select,
SelectItem
} from "@app/components/v2";
-import { useProject } from "@app/context";
+import { Combobox, Field, FieldError, FieldLabel } from "@app/components/v3";
+import { ProjectPermissionSub, useProject, useProjectPermission } from "@app/context";
+import { ProjectPermissionAppConnectionActions } from "@app/context/ProjectPermissionContext/types";
+import { APP_CONNECTION_MAP } from "@app/helpers/appConnections";
import {
CaSigningConfigType,
useCreateCaSigningConfig,
@@ -20,13 +24,11 @@ import {
useInstallCaCertificateAdcsNative,
useUpdateCaSigningConfig
} from "@app/hooks/api";
-import {
- TAvailableAppConnection,
- useListAvailableAppConnections
-} from "@app/hooks/api/appConnections";
+import { useListAvailableAppConnections } from "@app/hooks/api/appConnections";
import { useAdcsConnectionListCertificateTemplates } from "@app/hooks/api/appConnections/adcs";
import { AppConnection } from "@app/hooks/api/appConnections/enums";
import { UsePopUpState } from "@app/hooks/usePopUp";
+import { AddAppConnectionModal } from "@app/pages/organization/AppConnections/AppConnectionsPage/components";
const schema = z.object({
appConnectionId: z.string().min(1, "App connection is required"),
@@ -46,12 +48,19 @@ export const AdcsNativeCaInstallForm = ({ caId, handlePopUpToggle }: Props) => {
const { data: availableAdcsConnections, isPending: isAdcsPending } =
useListAvailableAppConnections(AppConnection.ADCS, currentProject.id);
+ const { permission } = useProjectPermission();
+ const [isCreateConnectionOpen, setIsCreateConnectionOpen] = useState(false);
+ const canCreateConnection = permission.can(
+ ProjectPermissionAppConnectionActions.Create,
+ ProjectPermissionSub.AppConnections
+ );
const {
control,
handleSubmit,
reset,
watch,
+ setValue,
formState: { isSubmitting }
} = useForm<FormData>({
resolver: zodResolver(schema),
@@ -120,27 +129,51 @@ export const AdcsNativeCaInstallForm = ({ caId, handlePopUpToggle }: Props) => {
control={control}
name="appConnectionId"
render={({ field: { onChange, value }, fieldState: { error } }) => (
- <FormControl
- label="Microsoft ADCS Connection"
- errorText={error?.message}
- isError={Boolean(error)}
- isRequired
- >
- <FilterableSelect
+ <Field className="mb-4">
+ <FieldLabel>
+ Microsoft ADCS Connection <span className="text-danger">*</span>
+ </FieldLabel>
+ <Combobox
+ isError={Boolean(error)}
+ modal
+ isClearable={false}
isLoading={isAdcsPending}
- value={(availableAdcsConnections || []).find((conn) => conn.id === value)}
- onChange={(option) => {
- const selected = option as SingleValue<TAvailableAppConnection>;
- onChange(selected?.id ?? "");
+ value={(availableAdcsConnections || []).find((conn) => conn.id === value) ?? null}
+ onValueChange={(option) => {
+ onChange(option.id);
}}
options={availableAdcsConnections || []}
placeholder="Select a Microsoft ADCS connection..."
getOptionLabel={(option) => option.name}
getOptionValue={(option) => option.id}
+ creation={
+ canCreateConnection
+ ? {
+ emptyLabel: `Create ${APP_CONNECTION_MAP[AppConnection.ADCS].name} Connection`,
+ formatLabel: () =>
+ `Create ${APP_CONNECTION_MAP[AppConnection.ADCS].name} Connection`,
+ onCreate: () => setIsCreateConnectionOpen(true)
+ }
+ : undefined
+ }
/>
- </FormControl>
+ <FieldError errors={[error]} />
+ </Field>
)}
/>
+ {/* the modal portals out of the DOM but React still bubbles its submit to this form */}
+ <div className="contents" onSubmit={(e) => e.stopPropagation()}>
+ <AddAppConnectionModal
+ isOpen={isCreateConnectionOpen}
+ onOpenChange={setIsCreateConnectionOpen}
+ projectType={currentProject.type}
+ projectId={currentProject.id}
+ app={AppConnection.ADCS}
+ onComplete={(connection) => {
+ setValue("appConnectionId", connection.id, { shouldValidate: true });
+ }}
+ />
+ </div>
<Controller
control={control}
name="template"
diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/VenafiCaInstallForm.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/VenafiCaInstallForm.tsx
index 97b575653c..ed22261d9d 100644
--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/VenafiCaInstallForm.tsx
+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/VenafiCaInstallForm.tsx
@@ -1,3 +1,4 @@
+import { useState } from "react";
import { Controller, useForm } from "react-hook-form";
import { SingleValue } from "react-select";
import { zodResolver } from "@hookform/resolvers/zod";
@@ -12,7 +13,10 @@ import {
Select,
SelectItem
} from "@app/components/v2";
-import { useProject } from "@app/context";
+import { Combobox, Field, FieldError, FieldLabel } from "@app/components/v3";
+import { ProjectPermissionSub, useProject, useProjectPermission } from "@app/context";
+import { ProjectPermissionAppConnectionActions } from "@app/context/ProjectPermissionContext/types";
+import { APP_CONNECTION_MAP } from "@app/helpers/appConnections";
import {
CaSigningConfigType,
useCreateCaSigningConfig,
@@ -20,10 +24,7 @@ import {
useInstallCaCertificateVenafi,
useUpdateCaSigningConfig
} from "@app/hooks/api";
-import {
- TAvailableAppConnection,
- useListAvailableAppConnections
-} from "@app/hooks/api/appConnections";
+import { useListAvailableAppConnections } from "@app/hooks/api/appConnections";
import { AppConnection } from "@app/hooks/api/appConnections/enums";
import {
TVenafiApplication,
@@ -32,6 +33,7 @@ import {
useVenafiConnectionListIssuingTemplates
} from "@app/hooks/api/appConnections/venafi";
import { UsePopUpState } from "@app/hooks/usePopUp";
+import { AddAppConnectionModal } from "@app/pages/organization/AppConnections/AppConnectionsPage/components";
const schema = z.object({
appConnectionId: z.string().min(1, "App connection is required"),
@@ -58,6 +60,12 @@ export const VenafiCaInstallForm = ({ caId, handlePopUpToggle }: Props) => {
const { data: availableVenafiConnections, isPending: isVenafiPending } =
useListAvailableAppConnections(AppConnection.Venafi, currentProject.id);
+ const { permission } = useProjectPermission();
+ const [isCreateConnectionOpen, setIsCreateConnectionOpen] = useState(false);
+ const canCreateConnection = permission.can(
+ ProjectPermissionAppConnectionActions.Create,
+ ProjectPermissionSub.AppConnections
+ );
const {
control,
@@ -153,18 +161,18 @@ export const VenafiCaInstallForm = ({ caId, handlePopUpToggle }: Props) => {
control={control}
name="appConnectionId"
render={({ field: { onChange, value }, fieldState: { error } }) => (
- <FormControl
- label="Venafi Connection"
- errorText={error?.message}
- isError={Boolean(error)}
- isRequired
- >
- <FilterableSelect
+ <Field className="mb-4">
+ <FieldLabel>
+ Venafi Connection <span className="text-danger">*</span>
+ </FieldLabel>
+ <Combobox
+ isError={Boolean(error)}
+ modal
+ isClearable={false}
isLoading={isVenafiPending}
- value={(availableVenafiConnections || []).find((conn) => conn.id === value)}
- onChange={(option) => {
- const selected = option as SingleValue<TAvailableAppConnection>;
- onChange(selected?.id ?? "");
+ value={(availableVenafiConnections || []).find((conn) => conn.id === value) ?? null}
+ onValueChange={(option) => {
+ onChange(option.id);
setValue("applicationId", "");
setValue("issuingTemplateId", "");
}}
@@ -172,10 +180,36 @@ export const VenafiCaInstallForm = ({ caId, handlePopUpToggle }: Props) => {
placeholder="Select a Venafi connection..."
getOptionLabel={(option) => option.name}
getOptionValue={(option) => option.id}
+ creation={
+ canCreateConnection
+ ? {
+ emptyLabel: `Create ${APP_CONNECTION_MAP[AppConnection.Venafi].name} Connection`,
+ formatLabel: () =>
+ `Create ${APP_CONNECTION_MAP[AppConnection.Venafi].name} Connection`,
+ onCreate: () => setIsCreateConnectionOpen(true)
+ }
+ : undefined
+ }
/>
- </FormControl>
+ <FieldError errors={[error]} />
+ </Field>
)}
/>
+ {/* the modal portals out of the DOM but React still bubbles its submit to this form */}
+ <div className="contents" onSubmit={(e) => e.stopPropagation()}>
+ <AddAppConnectionModal
+ isOpen={isCreateConnectionOpen}
+ onOpenChange={setIsCreateConnectionOpen}
+ projectType={currentProject.type}
+ projectId={currentProject.id}
+ app={AppConnection.Venafi}
+ onComplete={(connection) => {
+ setValue("appConnectionId", connection.id, { shouldValidate: true });
+ setValue("applicationId", "");
+ setValue("issuingTemplateId", "");
+ }}
+ />
+ </div>
<Controller
control={control}
name="applicationId"