mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-03 22:26:07 +00:00
+7
-10
@@ -10,21 +10,18 @@ export const genericAccountFieldsSchema = z.object({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const GenericAccountFields = () => {
|
export const GenericAccountFields = () => {
|
||||||
const {
|
const { control } = useFormContext<{ name: string; description: string }>();
|
||||||
formState: { errors },
|
|
||||||
control
|
|
||||||
} = useFormContext<{ name: string; description: string }>();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Controller
|
<Controller
|
||||||
name="name"
|
name="name"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field }) => (
|
render={({ field, fieldState: { error } }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
helperText="Name must be slug-friendly"
|
helperText="Name must be slug-friendly"
|
||||||
errorText={errors.name?.message}
|
errorText={error?.message}
|
||||||
isError={Boolean(errors.name?.message)}
|
isError={Boolean(error?.message)}
|
||||||
label="Name"
|
label="Name"
|
||||||
>
|
>
|
||||||
<Input autoFocus placeholder="my-account" {...field} />
|
<Input autoFocus placeholder="my-account" {...field} />
|
||||||
@@ -34,10 +31,10 @@ export const GenericAccountFields = () => {
|
|||||||
<Controller
|
<Controller
|
||||||
name="description"
|
name="description"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field }) => (
|
render={({ field, fieldState: { error } }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
errorText={errors.name?.message}
|
errorText={error?.message}
|
||||||
isError={Boolean(errors.name?.message)}
|
isError={Boolean(error?.message)}
|
||||||
label="Description"
|
label="Description"
|
||||||
>
|
>
|
||||||
<TextArea {...field} />
|
<TextArea {...field} />
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export const PamFolderForm = ({ folder, onSubmit }: Props) => {
|
|||||||
const {
|
const {
|
||||||
control,
|
control,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
formState: { isSubmitting, isDirty, errors }
|
formState: { isSubmitting, isDirty }
|
||||||
} = form;
|
} = form;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -47,11 +47,11 @@ export const PamFolderForm = ({ folder, onSubmit }: Props) => {
|
|||||||
<Controller
|
<Controller
|
||||||
name="name"
|
name="name"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field }) => (
|
render={({ field, fieldState: { error } }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
helperText="Name must be slug-friendly"
|
helperText="Name must be slug-friendly"
|
||||||
errorText={errors.name?.message}
|
errorText={error?.message}
|
||||||
isError={Boolean(errors.name?.message)}
|
isError={Boolean(error?.message)}
|
||||||
label="Name"
|
label="Name"
|
||||||
>
|
>
|
||||||
<Input autoFocus placeholder="my-folder" {...field} />
|
<Input autoFocus placeholder="my-folder" {...field} />
|
||||||
@@ -61,10 +61,10 @@ export const PamFolderForm = ({ folder, onSubmit }: Props) => {
|
|||||||
<Controller
|
<Controller
|
||||||
name="description"
|
name="description"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field }) => (
|
render={({ field, fieldState: { error } }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
errorText={errors.name?.message}
|
errorText={error?.message}
|
||||||
isError={Boolean(errors.name?.message)}
|
isError={Boolean(error?.message)}
|
||||||
label="Description"
|
label="Description"
|
||||||
isOptional
|
isOptional
|
||||||
>
|
>
|
||||||
|
|||||||
+4
-7
@@ -14,21 +14,18 @@ export const genericResourceFieldsSchema = z.object({
|
|||||||
export const GenericResourceFields = () => {
|
export const GenericResourceFields = () => {
|
||||||
const { data: gateways, isPending: isGatewaysLoading } = useQuery(gatewaysQueryKeys.list());
|
const { data: gateways, isPending: isGatewaysLoading } = useQuery(gatewaysQueryKeys.list());
|
||||||
|
|
||||||
const {
|
const { control } = useFormContext<{ name: string; gatewayId: string }>();
|
||||||
formState: { errors },
|
|
||||||
control
|
|
||||||
} = useFormContext<{ name: string; gatewayId: string }>();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Controller
|
<Controller
|
||||||
name="name"
|
name="name"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field }) => (
|
render={({ field, fieldState: { error } }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
helperText="Name must be slug-friendly"
|
helperText="Name must be slug-friendly"
|
||||||
errorText={errors.name?.message}
|
errorText={error?.message}
|
||||||
isError={Boolean(errors.name?.message)}
|
isError={Boolean(error?.message)}
|
||||||
label="Name"
|
label="Name"
|
||||||
>
|
>
|
||||||
<Input autoFocus placeholder="my-resource" {...field} />
|
<Input autoFocus placeholder="my-resource" {...field} />
|
||||||
|
|||||||
Reference in New Issue
Block a user