Put acme behind the flag

This commit is contained in:
Fang-Pen Lin
2025-11-07 09:20:56 -08:00
parent f6db76a23c
commit e8eb238744
@@ -1,8 +1,8 @@
import { useEffect } from "react";
import { Controller, useForm } from "react-hook-form";
import { faQuestionCircle } from "@fortawesome/free-solid-svg-icons"; import { faQuestionCircle } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { zodResolver } from "@hookform/resolvers/zod"; import { zodResolver } from "@hookform/resolvers/zod";
import { useEffect } from "react";
import { Controller, useForm } from "react-hook-form";
import { z } from "zod"; import { z } from "zod";
import { createNotification } from "@app/components/notifications"; import { createNotification } from "@app/components/notifications";
@@ -18,6 +18,7 @@ import {
TextArea, TextArea,
Tooltip Tooltip
} from "@app/components/v2"; } from "@app/components/v2";
import { envConfig } from "@app/config/env";
import { useProject } from "@app/context"; import { useProject } from "@app/context";
import { useListCasByProjectId } from "@app/hooks/api/ca/queries"; import { useListCasByProjectId } from "@app/hooks/api/ca/queries";
import { import {
@@ -109,7 +110,7 @@ const editSchema = z
.trim() .trim()
.max(1000, "Description must be less than 1000 characters") .max(1000, "Description must be less than 1000 characters")
.optional(), .optional(),
enrollmentType: z.enum(["api", "est"]), enrollmentType: z.enum(["api", "est", "acme"]),
certificateAuthorityId: z.string().optional(), certificateAuthorityId: z.string().optional(),
certificateTemplateId: z.string().optional(), certificateTemplateId: z.string().optional(),
estConfig: z estConfig: z
@@ -124,7 +125,8 @@ const editSchema = z
autoRenew: z.boolean().optional(), autoRenew: z.boolean().optional(),
renewBeforeDays: z.number().min(1).max(365).optional() renewBeforeDays: z.number().min(1).max(365).optional()
}) })
.optional() .optional(),
acmeConfig: z.object({}).optional()
}) })
.refine( .refine(
(data) => { (data) => {
@@ -134,6 +136,9 @@ const editSchema = z
if (data.enrollmentType === "api" && !data.apiConfig) { if (data.enrollmentType === "api" && !data.apiConfig) {
return false; return false;
} }
if (data.enrollmentType === "acme" && !data.acmeConfig) {
return false;
}
return true; return true;
}, },
{ {
@@ -448,7 +453,7 @@ export const CreateProfileModal = ({ isOpen, onClose, profile, mode = "create" }
> >
<SelectItem value="api">API</SelectItem> <SelectItem value="api">API</SelectItem>
<SelectItem value="est">EST</SelectItem> <SelectItem value="est">EST</SelectItem>
<SelectItem value="acme">ACME</SelectItem> {envConfig.isAcmeFeatureEnabled && <SelectItem value="acme">ACME</SelectItem>}
</Select> </Select>
</FormControl> </FormControl>
)} )}