diff --git a/izanami-frontend/src/components/FeatureForm.tsx b/izanami-frontend/src/components/FeatureForm.tsx index 4254e99bf..d5f62ed88 100644 --- a/izanami-frontend/src/components/FeatureForm.tsx +++ b/izanami-frontend/src/components/FeatureForm.tsx @@ -341,7 +341,7 @@ function LegacyFeatureForm(props: { const tagQuery = useQuery({ queryKey: [tagsQueryKey(tenant!)], - queryFn: () => queryTags(tenant!) + queryFn: () => queryTags(tenant!), }); const strategy = watch("activationStrategy"); @@ -801,6 +801,7 @@ export function FeatureForm(props: { submit: (overload: TCompleteFeature) => void; defaultValue?: TLightFeature; additionalFields?: () => JSX.Element; + displayId?: Boolean; }) { const { tenant } = useParams(); const { defaultValue, submit, ...rest } = props; @@ -808,7 +809,7 @@ export function FeatureForm(props: { const completeFeatureQuery = useQuery({ queryKey: [defaultValue ? JSON.stringify(defaultValue) : ""], queryFn: () => toCompleteFeature(tenant!, defaultValue!), - enabled: !!defaultValue + enabled: !!defaultValue, }); const [legacy, setLegacy] = useState( @@ -947,17 +948,20 @@ export function V2FeatureForm(props: { submit: (overload: TCompleteFeature) => void; defaultValue?: TCompleteFeature; additionalFields?: () => JSX.Element; + displayId?: Boolean; }) { const { cancel, submit, defaultValue, additionalFields } = props; const methods = useForm({ defaultValues: { resultType: "boolean", ...defaultValue }, }); const { tenant } = useParams(); + const canDisplayId = Boolean(props.displayId); const isWasm = defaultValue && isWasmFeature(defaultValue); const [type, setType] = useState(isWasm ? "Existing WASM script" : "Classic"); + const [idFieldDisplayed, setIdFieldDisplayed] = useState(false); const tagQuery = useQuery({ queryKey: [tagsQueryKey(tenant!)], - queryFn: () => queryTags(tenant!) + queryFn: () => queryTags(tenant!), }); const { @@ -1131,6 +1135,40 @@ export function V2FeatureForm(props: { {...register("enabled")} /> + {canDisplayId && ( + <> +
+ +
+ {idFieldDisplayed && ( +
+ +
+ )} + + )} {additionalFields && additionalFields()}
)}