Skip to content

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

improvement(secret-rotations): migrate setup flow to v3 (#7596)

Andrew Huangd72b3c9c4e01
diff --git a/frontend/src/components/secret-rotations-v2/CreateSecretRotationV2Modal.tsx b/frontend/src/components/secret-rotations-v2/CreateSecretRotationV2Modal.tsx
index 6189b5ea31..a4366d3ce2 100644
--- a/frontend/src/components/secret-rotations-v2/CreateSecretRotationV2Modal.tsx
+++ b/frontend/src/components/secret-rotations-v2/CreateSecretRotationV2Modal.tsx
@@ -5,10 +5,17 @@ import { SecretRotationV2Form } from "@app/components/secret-rotations-v2/forms"
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
import { SecretRotationV2ModalHeader } from "@app/components/secret-rotations-v2/SecretRotationV2ModalHeader";
import { SecretRotationV2Select } from "@app/components/secret-rotations-v2/SecretRotationV2Select";
-import { Modal, ModalContent } from "@app/components/v2";
-import { DocumentationLinkBadge } from "@app/components/v3";
+import {
+ DiscardChangesAlertDialog,
+ Sheet,
+ SheetContent,
+ SheetDescription,
+ SheetHeader,
+ SheetTitle
+} from "@app/components/v3";
import { ProjectEnv } from "@app/hooks/api/projects/types";
import { SecretRotation, TSecretRotationV2 } from "@app/hooks/api/secretRotationsV2";
+import { useDiscardChangesGuard } from "@app/hooks/useDiscardChangesGuard";
type SharedProps = {
secretPath: string;
@@ -27,6 +34,7 @@ type ContentProps = {
setSelectedRotation: (selectedRotation: SecretRotation | null) => void;
initialFormData?: Partial<TSecretRotationV2Form>;
onCancel: () => void;
+ onDirtyChange: (isDirty: boolean) => void;
} & SharedProps;
const Content = ({
@@ -34,12 +42,14 @@ const Content = ({
selectedRotation,
initialFormData,
onCancel,
+ onDirtyChange,
...props
}: ContentProps) => {
if (selectedRotation) {
return (
<SecretRotationV2Form
onCancel={onCancel}
+ onDirtyChange={onDirtyChange}
type={selectedRotation}
initialFormData={initialFormData}
{...props}
@@ -53,6 +63,7 @@ const Content = ({
export const CreateSecretRotationV2Modal = ({ onOpenChange, isOpen, ...props }: Props) => {
const [selectedRotation, setSelectedRotation] = useState<SecretRotation | null>(null);
const [initialFormData, setInitialFormData] = useState<Partial<TSecretRotationV2Form>>();
+ const [isDirty, setIsDirty] = useState(false);
const {
location: {
@@ -60,88 +71,115 @@ export const CreateSecretRotationV2Modal = ({ onOpenChange, isOpen, ...props }:
pathname
}
} = useRouterState();
-
const navigate = useNavigate();
useEffect(() => {
- if (connectionId && connectionName) {
- const storedFormData = localStorage.getItem("secretRotationFormData");
+ if (!connectionId || !connectionName) return;
- if (!storedFormData) return;
+ const storedFormData = localStorage.getItem("secretRotationFormData");
+ localStorage.removeItem("secretRotationFormData");
- let form: Partial<TSecretRotationV2Form> = {};
+ if (storedFormData) {
try {
- form = JSON.parse(storedFormData) as TSecretRotationV2Form;
+ const form = JSON.parse(storedFormData) as Partial<TSecretRotationV2Form>;
+ if (form.type) {
+ setSelectedRotation(form.type);
+ setInitialFormData({
+ ...form,
+ connection: { id: connectionId, name: connectionName }
+ });
+ setIsDirty(true);
+ onOpenChange(true);
+ }
} catch {
- return;
- } finally {
- localStorage.removeItem("secretRotationFormData");
+ setSelectedRotation(null);
+ setInitialFormData(undefined);
}
-
- onOpenChange(true);
-
- setSelectedRotation(form.type ?? null);
-
- setInitialFormData({
- ...form,
- connection: { id: connectionId, name: connectionName }
- });
-
- navigate({
- to: pathname,
- search
- });
}
+
+ navigate({
+ to: pathname,
+ search
+ });
}, [connectionId, connectionName]);
const handleReset = () => {
setSelectedRotation(null);
setInitialFormData(undefined);
+ setIsDirty(false);
+ };
+
+ const closeSheet = () => {
+ handleReset();
+ onOpenChange(false);
+ };
+
+ const { confirmDiscard, isDiscardDialogOpen, requestDiscard, setIsDiscardDialogOpen } =
+ useDiscardChangesGuard({ isDirty, onDiscard: closeSheet });
+
+ const handleSheetOpenChange = (open: boolean) => {
+ if (!open) {
+ requestDiscard();
+ return;
+ }
+ onOpenChange(true);
};
return (
- <Modal
- isOpen={isOpen}
- onOpenChange={(open) => {
- if (!open) {
- handleReset();
- }
- onOpenChange(open);
- }}
- >
- {/* z-50 (not the v2 default z-[60]) so the inline "Create Connection" Sheet and its v3 Select
- menus (all z-50, portaled later) stack above this modal instead of being buried behind it,
- while the backdrop still covers page chrome up to z-50 by portal order. */}
- <ModalContent
- overlayClassName="z-50"
- title={
- selectedRotation ? (
- <SecretRotationV2ModalHeader isConfigured={false} type={selectedRotation} />
+ <>
+ <Sheet open={isOpen} onOpenChange={handleSheetOpenChange}>
+ <SheetContent className="flex h-full max-h-full w-full flex-col gap-y-0 p-0 sm:w-3/4 sm:max-w-[1500px]">
+ <SheetHeader>
+ {selectedRotation ? (
+ <>
+ <SheetTitle className="sr-only">Configure secret rotation</SheetTitle>
+ <SecretRotationV2ModalHeader isConfigured={false} type={selectedRotation} />
+ </>
+ ) : (
+ <>
+ <SheetTitle>Choose a rotation provider</SheetTitle>
+ <SheetDescription>
+ Select the provider whose credentials Infisical should rotate.
+ </SheetDescription>
+ </>
+ )}
+ </SheetHeader>
+
+ {selectedRotation ? (
+ <div className="flex min-h-0 flex-1 flex-col">
+ <Content
+ onComplete={closeSheet}
+ onCancel={handleReset}
+ onDirtyChange={setIsDirty}
+ initialFormData={initialFormData}
+ selectedRotation={selectedRotation}
+ setSelectedRotation={setSelectedRotation}
+ {...props}
+ />
+ </div>
) : (
- <div className="flex items-center gap-x-2 text-mineshaft-300">
- Add Secret Rotation
- <DocumentationLinkBadge href="https://infisical.com/docs/documentation/platform/secret-rotation/overview" />
+ <div className="flex min-h-0 flex-1 flex-col overflow-y-auto p-4">
+ <Content
+ onComplete={closeSheet}
+ onCancel={handleReset}
+ onDirtyChange={setIsDirty}
+ initialFormData={initialFormData}
+ selectedRotation={selectedRotation}
+ setSelectedRotation={setSelectedRotation}
+ {...props}
+ />
</div>
- )
- }
- className={selectedRotation ? "z-50 max-w-2xl" : "z-50 max-w-3xl"}
- subTitle={
- selectedRotation ? undefined : "Select a provider to create a secret rotation for."
- }
- bodyClassName="overflow-visible"
- >
- <Content
- onComplete={() => {
- handleReset();
- onOpenChange(false);
- }}
- onCancel={handleReset}
- initialFormData={initialFormData}
- selectedRotation={selectedRotation}
- setSelectedRotation={setSelectedRotation}
- {...props}
- />
- </ModalContent>
- </Modal>
+ )}
+ </SheetContent>
+ </Sheet>
+
+ <DiscardChangesAlertDialog
+ open={isDiscardDialogOpen}
+ onOpenChange={setIsDiscardDialogOpen}
+ onDiscard={confirmDiscard}
+ title="Discard Secret Rotation Setup?"
+ description="Your progress configuring this secret rotation will be lost."
+ />
+ </>
);
};
diff --git a/frontend/src/components/secret-rotations-v2/EditSecretRotationV2Modal.tsx b/frontend/src/components/secret-rotations-v2/EditSecretRotationV2Modal.tsx
index e9efc27f2e..f8a055f127 100644
--- a/frontend/src/components/secret-rotations-v2/EditSecretRotationV2Modal.tsx
+++ b/frontend/src/components/secret-rotations-v2/EditSecretRotationV2Modal.tsx
@@ -1,6 +1,15 @@
+import { useState } from "react";
+
import { SecretRotationV2ModalHeader } from "@app/components/secret-rotations-v2/SecretRotationV2ModalHeader";
-import { Modal, ModalContent } from "@app/components/v2";
+import {
+ DiscardChangesAlertDialog,
+ Sheet,
+ SheetContent,
+ SheetHeader,
+ SheetTitle
+} from "@app/components/v3";
import { TSecretRotationV2 } from "@app/hooks/api/secretRotationsV2";
+import { useDiscardChangesGuard } from "@app/hooks/useDiscardChangesGuard";
import { SecretRotationV2Form } from "./forms";
@@ -10,25 +19,56 @@ type Props = {
secretRotation?: TSecretRotationV2;
};
-export const EditSecretRotationV2Modal = ({ secretRotation, onOpenChange, ...props }: Props) => {
+export const EditSecretRotationV2Modal = ({ secretRotation, isOpen, onOpenChange }: Props) => {
+ const [isDirty, setIsDirty] = useState(false);
+
+ const closeSheet = () => {
+ setIsDirty(false);
+ onOpenChange(false);
+ };
+
+ const { confirmDiscard, isDiscardDialogOpen, requestDiscard, setIsDiscardDialogOpen } =
+ useDiscardChangesGuard({ isDirty, onDiscard: closeSheet });
+
if (!secretRotation) return null;
+ const handleSheetOpenChange = (open: boolean) => {
+ if (!open) {
+ requestDiscard();
+ return;
+ }
+ onOpenChange(true);
+ };
+
return (
- <Modal {...props} onOpenChange={onOpenChange}>
- <ModalContent
- title={<SecretRotationV2ModalHeader isConfigured type={secretRotation.type} />}
- className="max-w-2xl"
- bodyClassName="overflow-visible"
- >
- <SecretRotationV2Form
- onComplete={() => onOpenChange(false)}
- onCancel={() => onOpenChange(false)}
- secretRotation={secretRotation}
- type={secretRotation.type}
- secretPath={secretRotation.folder.path}
- environment={secretRotation.environment.slug}
- />
- </ModalContent>
- </Modal>
+ <>
+ <Sheet open={isOpen} onOpenChange={handleSheetOpenChange}>
+ <SheetContent className="flex h-full max-h-full w-full flex-col gap-y-0 p-0 sm:w-3/4 sm:max-w-[1500px]">
+ <SheetHeader>
+ <SheetTitle className="sr-only">Edit secret rotation</SheetTitle>
+ <SecretRotationV2ModalHeader isConfigured type={secretRotation.type} />
+ </SheetHeader>
+ <div className="flex min-h-0 flex-1 flex-col">
+ <SecretRotationV2Form
+ onComplete={closeSheet}
+ onCancel={closeSheet}
+ onDirtyChange={setIsDirty}
+ secretRotation={secretRotation}
+ type={secretRotation.type}
+ secretPath={secretRotation.folder.path}
+ environment={secretRotation.environment.slug}
+ />
+ </div>
+ </SheetContent>
+ </Sheet>
+
+ <DiscardChangesAlertDialog
+ open={isDiscardDialogOpen}
+ onOpenChange={setIsDiscardDialogOpen}
+ onDiscard={confirmDiscard}
+ title="Discard Changes?"
+ description="Your unsaved changes to this secret rotation will be lost."
+ />
+ </>
);
};
diff --git a/frontend/src/components/secret-rotations-v2/SecretRotationV2ModalHeader.tsx b/frontend/src/components/secret-rotations-v2/SecretRotationV2ModalHeader.tsx
index a834d78dc6..5621c9df58 100644
--- a/frontend/src/components/secret-rotations-v2/SecretRotationV2ModalHeader.tsx
+++ b/frontend/src/components/secret-rotations-v2/SecretRotationV2ModalHeader.tsx
@@ -11,23 +11,23 @@ export const SecretRotationV2ModalHeader = ({ type, isConfigured }: Props) => {
const destinationDetails = SECRET_ROTATION_MAP[type];
return (
- <div className="flex w-full items-start gap-2">
+ <div className="flex w-full items-start gap-3 pr-8">
<img
alt={`${destinationDetails.name} logo`}
src={`/images/integrations/${destinationDetails.image}`}
- className="h-12 w-12 rounded-md bg-bunker-500 p-2"
+ className="size-10 rounded-md border border-border bg-card object-contain p-2"
/>
- <div>
- <div className="flex items-center gap-x-2 text-mineshaft-300">
- {destinationDetails.name} Rotation
+ <div className="min-w-0">
+ <div className="flex flex-wrap items-center gap-x-2 gap-y-1 text-foreground">
+ <span>{destinationDetails.name} secret rotation</span>
<DocumentationLinkBadge
href={`https://infisical.com/docs/documentation/platform/secret-rotation/${type}`}
/>
</div>
- <p className="text-sm leading-4 text-mineshaft-400">
+ <p className="mt-1 text-sm leading-4 font-normal text-muted">
{isConfigured
- ? `Edit ${destinationDetails.name} Rotation`
- : `Rotate ${destinationDetails.name}`}
+ ? `Edit the ${destinationDetails.name} rotation configuration.`
+ : `Configure how Infisical rotates ${destinationDetails.name}.`}
</p>
</div>
</div>
diff --git a/frontend/src/components/secret-rotations-v2/SecretRotationV2Select.tsx b/frontend/src/components/secret-rotations-v2/SecretRotationV2Select.tsx
index a19e8511a2..d8aab2bfd1 100644
--- a/frontend/src/components/secret-rotations-v2/SecretRotationV2Select.tsx
+++ b/frontend/src/components/secret-rotations-v2/SecretRotationV2Select.tsx
@@ -1,49 +1,141 @@
-import { Spinner } from "@app/components/v2";
-import { SECRET_ROTATION_MAP } from "@app/helpers/secretRotationsV2";
+import { useMemo, useState } from "react";
+import { AlertTriangleIcon, Loader2Icon, SearchIcon } from "lucide-react";
+
+import {
+ Button,
+ Empty,
+ EmptyDescription,
+ EmptyHeader,
+ EmptyMedia,
+ EmptyTitle,
+ InputGroup,
+ InputGroupAddon,
+ InputGroupInput
+} from "@app/components/v3";
+import { APP_CONNECTION_MAP } from "@app/helpers/appConnections";
+import {
+ SECRET_ROTATION_CONNECTION_MAP,
+ SECRET_ROTATION_MAP
+} from "@app/helpers/secretRotationsV2";
import { SecretRotation, useSecretRotationV2Options } from "@app/hooks/api/secretRotationsV2";
type Props = {
onSelect: (type: SecretRotation) => void;
};
+const ProviderCard = ({ type, onSelect }: { type: SecretRotation; onSelect: () => void }) => {
+ const { image, name } = SECRET_ROTATION_MAP[type];
+ const connectionName = APP_CONNECTION_MAP[SECRET_ROTATION_CONNECTION_MAP[type]].name;
+
+ return (
+ <button
+ type="button"
+ onClick={onSelect}
+ className="group flex cursor-pointer flex-col gap-3 rounded-md border border-border bg-card p-4 text-left transition-colors hover:border-foreground/15 hover:bg-container-hover focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none"
+ >
+ <div className="flex items-start justify-between gap-2">
+ <div className="flex size-9 items-center justify-center rounded-md bg-container">
+ <img
+ src={`/images/integrations/${image}`}
+ alt={`${name} logo`}
+ className="size-6 object-contain"
+ />
+ </div>
+ <span className="text-xs font-medium text-muted">{connectionName}</span>
+ </div>
+ <div className="flex flex-col gap-1">
+ <p className="text-sm font-semibold text-foreground">{name}</p>
+ <p className="text-xs leading-relaxed text-muted">
+ Rotate {name} and write the generated values to Infisical secrets.
+ </p>
+ </div>
+ </button>
+ );
+};
+
export const SecretRotationV2Select = ({ onSelect }: Props) => {
- const { isPending, data: secretRotationOptions } = useSecretRotationV2Options();
+ const [search, setSearch] = useState("");
+ const { isPending, isError, data: secretRotationOptions, refetch } = useSecretRotationV2Options();
+
+ const filteredOptions = useMemo(() => {
+ const query = search.trim().toLowerCase();
+ if (!query) return secretRotationOptions ?? [];
+
+ return (secretRotationOptions ?? []).filter(({ type }) => {
+ const { name } = SECRET_ROTATION_MAP[type];
+ const connectionName = APP_CONNECTION_MAP[SECRET_ROTATION_CONNECTION_MAP[type]].name;
+ return [name, connectionName, type].some((value) => value.toLowerCase().includes(query));
+ });
+ }, [search, secretRotationOptions]);
if (isPending) {
return (
- <div className="flex h-full flex-col items-center justify-center py-2.5">
- <Spinner size="lg" className="text-mineshaft-500" />
- <p className="mt-4 text-sm text-mineshaft-400">Loading options...</p>
+ <div className="flex h-full flex-col items-center justify-center py-10">
+ <Loader2Icon className="size-8 animate-spin text-accent" />
+ <p className="mt-4 text-sm text-muted">Loading providers...</p>
</div>
);
}
+ if (isError) {
+ return (
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyMedia variant="icon">
+ <AlertTriangleIcon />
+ </EmptyMedia>
+ <EmptyTitle>Unable to load providers</EmptyTitle>
+ <EmptyDescription>
+ Try loading the available secret rotation providers again.
+ </EmptyDescription>
+ </EmptyHeader>
+ <Button variant="outline" onClick={() => refetch()}>
+ Retry
+ </Button>
+ </Empty>
+ );
+ }
+
return (
- <div className="max-h-[60vh] overflow-y-auto">
- <div className="grid grid-cols-3 gap-2">
- {secretRotationOptions?.map(({ type }) => {
- const { image, name, size } = SECRET_ROTATION_MAP[type];
-
- return (
- <button
- type="button"
- key={type}
- onClick={() => onSelect(type)}
- className="group relative flex h-28 cursor-pointer flex-col items-center justify-center rounded-md border border-mineshaft-600 bg-mineshaft-700 p-4 duration-200 hover:bg-mineshaft-600"
- >
- <img
- src={`/images/integrations/${image}`}
- width={size}
- className="mt-auto"
- alt={`${name} logo`}
- />
- <div className="mt-auto max-w-xs text-center text-xs font-medium text-gray-300 duration-200 group-hover:text-gray-200">
- {name}
- </div>
- </button>
- );
- })}
- </div>
+ <div className="flex flex-col gap-6">
+ <InputGroup>
+ <InputGroupAddon align="inline-start">
+ <SearchIcon />
+ </InputGroupAddon>
+ <InputGroupInput
+ value={search}
+ onChange={(event) => setSearch(event.target.value)}
+ placeholder="Search providers — PostgreSQL, AWS, Cloudflare..."
+ aria-label="Search secret rotation providers"
+ />
+ </InputGroup>
+
+ <section>
+ <p className="mb-3 text-xs font-medium text-muted">All providers</p>
+ {filteredOptions.length ? (
+ <div className="grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3">
+ {filteredOptions.map(({ type }) => (
+ <ProviderCard key={type} type={type} onSelect={() => onSelect(type)} />
+ ))}
+ </div>
+ ) : (
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyMedia variant="icon">
+ <SearchIcon />
+ </EmptyMedia>
+ <EmptyTitle>
+ {search.trim() ? "No matching providers" : "No providers available"}
+ </EmptyTitle>
+ <EmptyDescription>
+ {search.trim()
+ ? "Try a different search term."
+ : "No secret rotation providers are available for this instance."}
+ </EmptyDescription>
+ </EmptyHeader>
+ </Empty>
+ )}
+ </section>
</div>
);
};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ConfigurationFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ConfigurationFields.tsx
index aaabe0f72d..ec1c28c84b 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ConfigurationFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ConfigurationFields.tsx
@@ -1,9 +1,20 @@
import { Controller, useFormContext } from "react-hook-form";
-import { faWarning } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { format, setHours, setMinutes } from "date-fns";
+import { TriangleAlertIcon } from "lucide-react";
-import { FilterableSelect, FormControl, Input, Switch } from "@app/components/v2";
+import {
+ Alert,
+ AlertDescription,
+ Field,
+ FieldContent,
+ FieldError,
+ FieldFeedback,
+ FieldLabel,
+ FilterableSelect,
+ Input,
+ Label,
+ Switch
+} from "@app/components/v3";
import {
getRotateAtLocal,
IS_ROTATION_DUAL_CREDENTIALS,
@@ -25,74 +36,82 @@ export const SecretRotationV2ConfigurationFields = ({ isUpdate, environments }:
const [type, isAutoRotationEnabled] = watch(["type", "isAutoRotationEnabled"]);
return (
- <>
- <p className="mb-4 text-sm text-bunker-300">
- Configure the connection rotation strategy for this Secret Rotation.
- </p>
+ <div className="space-y-4">
{!isUpdate && environments && (
<Controller
control={control}
name="environment"
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl label="Environment" isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabel htmlFor="secret-rotation-environment">Environment</FieldLabel>
<FilterableSelect
- value={value}
+ inputId="secret-rotation-environment"
+ value={value ?? null}
+ onBlur={onBlur}
onChange={onChange}
options={environments}
placeholder="Select an environment..."
getOptionLabel={(option) => option?.name}
getOptionValue={(option) => option?.id}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
)}
<SecretRotationV2ConnectionField isUpdate={isUpdate} />
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Rotation Interval (In Days)"
- >
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabel htmlFor="secret-rotation-interval">Rotation Interval (In Days)</FieldLabel>
<Input
+ ref={ref}
+ id="secret-rotation-interval"
value={value}
type="number"
+ onBlur={onBlur}
onChange={onChange}
min={1}
- placeholder="my-secret-rotation"
+ placeholder="30"
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="rotationInterval"
/>
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => {
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => {
return (
- <FormControl
- label="Rotate At (Local Time)"
- isError={Boolean(error)}
- errorText={error?.message}
- >
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabel htmlFor="secret-rotation-rotate-at">Rotate At (Local Time)</FieldLabel>
<Input
+ ref={ref}
+ id="secret-rotation-rotate-at"
type="time"
value={format(getRotateAtLocal(value), "HH:mm")}
+ onBlur={onBlur}
onChange={(e) => {
const time = e.target.value;
- if (time) {
- const [hours, minutes] = time.split(":").map((str) => parseInt(str, 10));
- const newSelectedDate = setHours(setMinutes(new Date(), minutes), hours);
- onChange({
- hours: newSelectedDate.getUTCHours(),
- minutes: newSelectedDate.getUTCMinutes()
- });
- }
+ if (!time) return;
+ const [hours, minutes] = time.split(":").map((str) => parseInt(str, 10));
+ const newSelectedDate = setHours(setMinutes(new Date(), minutes), hours);
+ const next = {
+ hours: newSelectedDate.getUTCHours(),
+ minutes: newSelectedDate.getUTCMinutes()
+ };
+ // Avoid mount/normalization writes that round-trip to the same UTC time.
+ if (next.hours === value.hours && next.minutes === value.minutes) return;
+ onChange(next);
}}
- className="bg-mineshaft-700 text-white scheme-dark"
+ className="scheme-dark [&::-webkit-calendar-picker-indicator]:hidden"
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
);
}}
control={control}
@@ -101,47 +120,56 @@ export const SecretRotationV2ConfigurationFields = ({ isUpdate, environments }:
<Controller
control={control}
name="isAutoRotationEnabled"
- render={({ field: { value, onChange }, fieldState: { error } }) => {
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => {
return (
- <FormControl
- helperText={
- value
- ? "Secrets will automatically be rotated when the rotation interval specified above as elapsed."
- : "Secrets will not be rotated automatically. You can still rotate secrets manually."
- }
- isError={Boolean(error)}
- errorText={error?.message}
- >
+ <Field data-invalid={Boolean(error)} orientation="horizontal">
+ <FieldContent>
+ <Label htmlFor="auto-rotation-enabled">
+ Auto-Rotation {value ? "Enabled" : "Disabled"}
+ </Label>
+ <FieldFeedback
+ id="auto-rotation-enabled-feedback"
+ description={
+ value
+ ? "Secrets will automatically be rotated when the rotation interval specified above has elapsed."
+ : "Secrets will not be rotated automatically. You can still rotate secrets manually."
+ }
+ error={error?.message}
+ />
+ </FieldContent>
<Switch
- className="bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"
+ ref={ref}
id="auto-rotation-enabled"
- thumbClassName="bg-mineshaft-800"
+ variant="project"
+ checked={value}
+ onBlur={onBlur}
onCheckedChange={onChange}
- isChecked={value}
- >
- <p className="w-[9.6rem]">Auto-Rotation {value ? "Enabled" : "Disabled"}</p>
- </Switch>
- </FormControl>
+ aria-invalid={Boolean(error)}
+ aria-describedby="auto-rotation-enabled-feedback"
+ />
+ </Field>
);
}}
/>
{!IS_ROTATION_DUAL_CREDENTIALS[type] && isAutoRotationEnabled && (
- <div className="rounded-sm border border-yellow bg-yellow/10 p-2 px-3 text-xs text-yellow">
- <FontAwesomeIcon icon={faWarning} className="mr-1" /> Due to{" "}
- {SECRET_ROTATION_MAP[type].name} Rotations rotating a single credential set, auto-rotation
- may result in service interruptions. If you need to ensure service continuity, we
- recommend disabling this option. <br />
- <a
- href="https://infisical.com/docs/documentation/platform/secret-rotation/overview#how-rotation-works"
- target="_blank"
- rel="noopener noreferrer"
- className="underline decoration-yellow underline-offset-2 hover:text-mineshaft-200"
- >
- Read more
- </a>
- .
- </div>
+ <Alert variant="warning">
+ <TriangleAlertIcon />
+ <AlertDescription>
+ Due to {SECRET_ROTATION_MAP[type].name} Rotations rotating a single credential set,
+ auto-rotation may result in service interruptions. If you need to ensure service
+ continuity, we recommend disabling this option.{" "}
+ <a
+ href="https://infisical.com/docs/documentation/platform/secret-rotation/overview#how-rotation-works"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="underline underline-offset-2 hover:text-foreground"
+ >
+ Read more
+ </a>
+ .
+ </AlertDescription>
+ </Alert>
)}
- </>
+ </div>
);
};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ConnectionField.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ConnectionField.tsx
index 6f05b13b9d..854f3505e6 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ConnectionField.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ConnectionField.tsx
@@ -2,11 +2,17 @@ import { useMemo } from "react";
import { Controller, useFormContext } from "react-hook-form";
import { SingleValue } from "react-select";
import { subject } from "@casl/ability";
-import { faInfoCircle } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { InfoIcon } from "lucide-react";
import { AppConnectionOption } from "@app/components/app-connections";
-import { FilterableSelect, FormControl } from "@app/components/v2";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import {
+ Alert,
+ AlertDescription,
+ Field,
+ FieldFeedback,
+ FilterableSelect
+} from "@app/components/v3";
import { ProjectPermissionSub, useProject, useProjectPermission } from "@app/context";
import {
ProjectPermissionAppConnectionActions,
@@ -71,39 +77,27 @@ export const SecretRotationV2ConnectionField = ({ onChange: callback, isUpdate }
return (
<>
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- tooltipText="App Connections can be created from the Organization Settings page."
- isError={Boolean(error)}
- errorText={error?.message}
- label={`${connectionName} Connection`}
- helperText={
- isUpdate ? (
- "Cannot be updated"
- ) : (
- <p>
- Check out{" "}
- <a
- href={`https://infisical.com/docs/integrations/app-connections/${app}`}
- target="_blank"
- className="underline"
- rel="noopener noreferrer"
- >
- our docs
- </a>{" "}
- to ensure your connection has the required permissions for secret rotation.
- </p>
- )
- }
- >
+ render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ htmlFor="secret-rotation-connection"
+ tooltip="App Connections can be created from the Organization Settings page."
+ >
+ {connectionName} Connection
+ </FieldLabelWithTooltip>
<FilterableSelect
- value={value}
+ inputId="secret-rotation-connection"
+ value={value ?? null}
+ onBlur={onBlur}
onChange={(newValue) => {
if ((newValue as SingleValue<{ id: string; name: string }>)?.id === "_create") {
handlePopUpOpen("addConnection");
- onChange(null);
- // store for oauth callback connections
- localStorage.setItem("secretRotationFormData", JSON.stringify(watch()));
+ localStorage.setItem(
+ "secretRotationFormData",
+ JSON.stringify(watch(), (key, serializedValue) =>
+ key === "temporaryParameters" ? undefined : serializedValue
+ )
+ );
if (callback) callback();
return;
}
@@ -121,22 +115,47 @@ export const SecretRotationV2ConnectionField = ({ onChange: callback, isUpdate }
getOptionLabel={(option) => option.name}
getOptionValue={(option) => option.id}
components={{ Option: AppConnectionOption }}
+ isError={Boolean(error)}
+ aria-describedby="secret-rotation-connection-feedback"
+ />
+ <FieldFeedback
+ id="secret-rotation-connection-feedback"
+ description={
+ isUpdate ? (
+ "Cannot be updated"
+ ) : (
+ <>
+ Check out{" "}
+ <a
+ href={`https://infisical.com/docs/integrations/app-connections/${app}`}
+ target="_blank"
+ className="underline"
+ rel="noopener noreferrer"
+ >
+ our docs
+ </a>{" "}
+ to ensure your connection has the required permissions for secret rotation.
+ </>
+ )
+ }
+ error={error?.message}
/>
- </FormControl>
+ </Field>
)}
control={control}
name="connection"
/>
{!isUpdate && !isPending && !allowedConnections.length && !canCreateConnection && (
- <p className="-mt-2.5 mb-2.5 text-xs text-yellow">
- <FontAwesomeIcon className="mr-1" size="xs" icon={faInfoCircle} />
- You do not have access to any {appName} Connections. Contact an admin to create one.
- </p>
+ <Alert variant="warning">
+ <InfoIcon />
+ <AlertDescription>
+ You do not have access to any {appName} Connections. Contact an admin to create one.
+ </AlertDescription>
+ </Alert>
)}
<AddAppConnectionModal
isOpen={popUp.addConnection.isOpen}
onOpenChange={(isOpen) => {
- // remove form storage, not oauth connection
localStorage.removeItem("secretRotationFormData");
handlePopUpToggle("addConnection", isOpen);
}}
@@ -145,7 +164,7 @@ export const SecretRotationV2ConnectionField = ({ onChange: callback, isUpdate }
app={app}
onComplete={(connection) => {
if (connection) {
- setValue("connection", connection);
+ setValue("connection", connection, { shouldValidate: true, shouldDirty: true });
}
}}
/>
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2DetailsFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2DetailsFields.tsx
index 988b266b95..4fcef1a16c 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2DetailsFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2DetailsFields.tsx
@@ -1,6 +1,6 @@
import { Controller, useFormContext } from "react-hook-form";
-import { FormControl, Input, TextArea } from "@app/components/v2";
+import { Field, FieldError, FieldFeedback, FieldLabel, Input, TextArea } from "@app/components/v3";
import { TSecretRotationV2Form } from "./schemas";
@@ -8,44 +8,55 @@ export const SecretRotationV2DetailsFields = () => {
const { control } = useFormContext<TSecretRotationV2Form>();
return (
- <>
- <p className="mb-4 text-sm text-bunker-300">
- Provide a name and description for this Secret Rotation.
- </p>
+ <div className="space-y-4">
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- helperText="Must be slug-friendly"
- isError={Boolean(error)}
- errorText={error?.message}
- label="Name"
- >
- <Input autoFocus value={value} onChange={onChange} placeholder="my-secret-rotation" />
- </FormControl>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabel htmlFor="secret-rotation-name">Name</FieldLabel>
+ <Input
+ ref={ref}
+ id="secret-rotation-name"
+ autoFocus
+ value={value}
+ onBlur={onBlur}
+ onChange={onChange}
+ placeholder="my-secret-rotation"
+ isError={Boolean(error)}
+ aria-describedby="secret-rotation-name-feedback"
+ />
+ <FieldFeedback
+ id="secret-rotation-name-feedback"
+ description="Must be slug-friendly"
+ error={error?.message}
+ />
+ </Field>
)}
control={control}
name="name"
/>
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- isOptional
- errorText={error?.message}
- label="Description"
- >
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabel htmlFor="secret-rotation-description">
+ Description <span className="font-normal text-muted">(optional)</span>
+ </FieldLabel>
<TextArea
+ ref={ref}
+ id="secret-rotation-description"
value={value ?? ""}
+ onBlur={onBlur}
onChange={onChange}
placeholder="Describe the purpose of this rotation..."
- className="resize-none!"
+ className="resize-none"
rows={4}
+ aria-invalid={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="description"
/>
- </>
+ </div>
);
};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2Form.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2Form.tsx
index 9520e68224..f7b6b6a7ba 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2Form.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2Form.tsx
@@ -1,6 +1,5 @@
-import { useState } from "react";
+import { useEffect, useState } from "react";
import { FormProvider, useForm } from "react-hook-form";
-import { Tab } from "@headlessui/react";
import { zodResolver } from "@hookform/resolvers/zod";
import { createNotification } from "@app/components/notifications";
@@ -9,7 +8,14 @@ import { SecretRotationV2DetailsFields } from "@app/components/secret-rotations-
import { SecretRotationV2ParametersFields } from "@app/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields";
import { SecretRotationV2ReviewFields } from "@app/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields";
import { SecretRotationV2SecretsMappingFields } from "@app/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields";
-import { Button } from "@app/components/v2";
+import {
+ Button,
+ DiscardChangesAlertDialog,
+ DocumentationLinkBadge,
+ Stepper,
+ StepperList,
+ StepperStep
+} from "@app/components/v3";
import { useProject } from "@app/context";
import { IS_ROTATION_DUAL_CREDENTIALS, SECRET_ROTATION_MAP } from "@app/helpers/secretRotationsV2";
import { ProjectEnv } from "@app/hooks/api/projects/types";
@@ -22,6 +28,7 @@ import {
useCreateSecretRotationV2,
useUpdateSecretRotationV2
} from "@app/hooks/api/secretRotationsV2/mutations";
+import { useDiscardChangesGuard } from "@app/hooks/useDiscardChangesGuard";
import { SecretRotationV2FormSchema, TSecretRotationV2Form } from "./schemas";
@@ -29,6 +36,7 @@ type Props = {
onComplete: (secretRotation: TSecretRotationV2) => void;
type: SecretRotation;
onCancel: () => void;
+ onDirtyChange?: (isDirty: boolean) => void;
secretPath: string;
environment?: string;
environments?: ProjectEnv[];
@@ -36,10 +44,27 @@ type Props = {
initialFormData?: Partial<TSecretRotationV2Form>;
};
-const FORM_TABS: { name: string; key: string; fields: (keyof TSecretRotationV2Form)[] }[] = [
+type FormStep = {
+ name: string;
+ key: string;
+ shortDescription: string;
+ title: string;
+ subtitle: string;
+ rightLabel: string;
+ rightDescription: string;
+ fields: (keyof TSecretRotationV2Form)[];
+};
+
+const FORM_STEPS: FormStep[] = [
{
name: "Configuration",
key: "configuration",
+ shortDescription: "Connection and schedule",
+ title: "Configure the rotation",
+ subtitle: "Choose the connection and decide when Infisical should rotate these credentials.",
+ rightLabel: "Configuration",
+ rightDescription:
+ "The connection identifies the provider account. The schedule controls how often Infisical replaces its active credentials.",
fields: [
"isAutoRotationEnabled",
"environment",
@@ -48,11 +73,51 @@ const FORM_TABS: { name: string; key: string; fields: (keyof TSecretRotationV2Fo
"rotateAtUtc"
]
},
- // @ts-expect-error temporary parameters aren't present on all forms
- { name: "Parameters", key: "parameters", fields: ["parameters", "temporaryParameters"] },
- { name: "Mappings", key: "secretsMapping", fields: ["secretsMapping"] },
- { name: "Details", key: "details", fields: ["name", "description"] },
- { name: "Review", key: "review", fields: [] }
+ {
+ name: "Parameters",
+ key: "parameters",
+ shortDescription: "Provider settings",
+ title: "Set provider parameters",
+ subtitle: "Choose the provider resource and configure how its credentials should be rotated.",
+ rightLabel: "Parameters",
+ rightDescription:
+ "These settings are specific to the selected provider and determine which account or resource Infisical manages.",
+ // @ts-expect-error temporary parameters are only present on rotations that need setup credentials
+ fields: ["parameters", "temporaryParameters"]
+ },
+ {
+ name: "Mappings",
+ key: "secretsMapping",
+ shortDescription: "Generated secret keys",
+ title: "Map generated credentials",
+ subtitle: "Choose the Infisical secret keys that will receive each generated credential.",
+ rightLabel: "Mappings",
+ rightDescription:
+ "Each generated value is written to the mapped secret key in the selected environment and path.",
+ fields: ["secretsMapping"]
+ },
+ {
+ name: "Details",
+ key: "details",
+ shortDescription: "Name and description",
+ title: "Add rotation details",
+ subtitle: "Give this rotation a clear name and an optional description.",
+ rightLabel: "Details",
+ rightDescription:
+ "Use a name that distinguishes this rotation from other provider accounts and environments.",
+ fields: ["name", "description"]
+ },
+ {
+ name: "Review",
+ key: "review",
+ shortDescription: "Confirm configuration",
+ title: "Review the rotation",
+ subtitle: "Confirm the configuration before saving the secret rotation.",
+ rightLabel: "Review",
+ rightDescription:
+ "Verify the connection, schedule, provider parameters, and generated secret mappings before continuing.",
+ fields: []
+ }
];
const DEFAULT_ROTATION_INTERVAL = 30;
@@ -61,6 +126,7 @@ export const SecretRotationV2Form = ({
type,
onComplete,
onCancel,
+ onDirtyChange,
environment: envSlug,
secretPath,
secretRotation,
@@ -71,9 +137,7 @@ export const SecretRotationV2Form = ({
const updateSecretRotation = useUpdateSecretRotationV2();
const { currentProject } = useProject();
const { name: rotationType } = SECRET_ROTATION_MAP[type];
-
- const [selectedTabIndex, setSelectedTabIndex] = useState(0);
-
+ const [selectedStepIndex, setSelectedStepIndex] = useState(0);
const { rotationOption } = useSecretRotationV2Option(type);
const formMethods = useForm<TSecretRotationV2Form>({
@@ -94,12 +158,27 @@ export const SecretRotationV2Form = ({
},
environment: currentProject?.environments.find((env) => env.slug === envSlug),
secretPath,
- ...((rotationOption?.template as object) ?? {}), // can't infer type since we don't know which specific type it is
+ ...((rotationOption?.template as object) ?? {}),
...(initialFormData as object)
}) as Partial<TSecretRotationV2Form>,
+ mode: "onChange",
reValidateMode: "onChange"
});
+ const { handleSubmit, trigger, formState } = formMethods;
+ const hasUnsavedChanges = formState.isDirty || Boolean(initialFormData);
+ const {
+ confirmDiscard,
+ isDiscardDialogOpen,
+ requestDiscard: requestCancel,
+ setIsDiscardDialogOpen
+ } = useDiscardChangesGuard({ isDirty: hasUnsavedChanges, onDiscard: onCancel });
+
+ useEffect(() => {
+ onDirtyChange?.(hasUnsavedChanges);
+ return () => onDirtyChange?.(false);
+ }, [hasUnsavedChanges, onDirtyChange]);
+
const onSubmit = async ({ environment, connection, ...formData }: TSecretRotationV2Form) => {
const mutation = secretRotation
? updateSecretRotation.mutateAsync({
@@ -109,7 +188,6 @@ export const SecretRotationV2Form = ({
})
: createSecretRotation.mutateAsync({
...formData,
-
connectionId: connection.id,
environment: environment.slug,
projectId: currentProject.id
@@ -117,116 +195,158 @@ export const SecretRotationV2Form = ({
const rotation = await mutation;
createNotification({
- text: `Successfully ${secretRotation ? "updated" : "created"} ${rotationType} Rotation`,
+ text: `Successfully ${secretRotation ? "updated" : "created"} ${rotationType} rotation`,
type: "success"
});
onComplete(rotation);
};
const handlePrev = () => {
- if (selectedTabIndex === 0) {
- onCancel();
+ if (selectedStepIndex === 0) {
+ requestCancel();
return;
}
-
- setSelectedTabIndex((prev) => prev - 1);
+ setSelectedStepIndex((previous) => previous - 1);
};
- const {
- handleSubmit,
- trigger,
- formState: { isSubmitting }
- } = formMethods;
-
- const isStepValid = async (index: number) => trigger(FORM_TABS[index].fields);
-
- const isFinalStep = selectedTabIndex === FORM_TABS.length - 1;
+ const isStepValid = async (index: number) => trigger(FORM_STEPS[index].fields);
+ const isFinalStep = selectedStepIndex === FORM_STEPS.length - 1;
const handleNext = async () => {
if (isFinalStep) {
- handleSubmit(onSubmit)();
+ await handleSubmit(onSubmit)();
return;
}
- const isValid = await isStepValid(selectedTabIndex);
-
- if (!isValid) return;
-
- setSelectedTabIndex((prev) => prev + 1);
+ if (await isStepValid(selectedStepIndex)) {
+ setSelectedStepIndex((previous) => previous + 1);
+ }
};
- const isTabEnabled = async (index: number) => {
- let isEnabled = true;
- for (let i = index - 1; i >= 0; i -= 1) {
- // eslint-disable-next-line no-await-in-loop
- isEnabled = isEnabled && (await isStepValid(i));
+ const providerStepOffset = secretRotation ? 0 : 1;
+ const activeStepperIndex = selectedStepIndex + providerStepOffset;
+ const totalSteps = FORM_STEPS.length + providerStepOffset;
+ const displayedStepNumber = activeStepperIndex + 1;
+
+ const handleStepperChange = (stepperIndex: number) => {
+ if (!secretRotation && stepperIndex === 0) {
+ requestCancel();
+ return;
}
- return isEnabled;
+ const targetStepIndex = stepperIndex - providerStepOffset;
+ if (targetStepIndex >= 0 && targetStepIndex < selectedStepIndex) {
+ setSelectedStepIndex(targetStepIndex);
+ }
};
+ const currentStep = FORM_STEPS[selectedStepIndex];
+ const stepperSteps = (
+ <Stepper
+ activeStep={activeStepperIndex}
+ orientation="vertical"
+ onStepChange={handleStepperChange}
+ >
+ <StepperList>
+ {!secretRotation && (
+ <StepperStep index={0} title="Provider" description={SECRET_ROTATION_MAP[type].name} />
+ )}
+ {FORM_STEPS.map((step, index) => (
+ <StepperStep
+ key={step.key}
+ index={index + providerStepOffset}
+ title={step.name}
+ description={step.shortDescription}
+ />
+ ))}
+ </StepperList>
+ </Stepper>
+ );
+
return (
- <form className="flex max-h-[70vh] flex-col overflow-hidden">
- <div className="flex min-h-0 flex-1 flex-col">
- <FormProvider {...formMethods}>
- <Tab.Group selectedIndex={selectedTabIndex} onChange={setSelectedTabIndex}>
- <Tab.List className="-pb-1 mb-6 w-full flex-shrink-0 border-b-2 border-mineshaft-600">
- {FORM_TABS.map((tab, index) => (
- <Tab
- onClick={async (e) => {
- e.preventDefault();
- const isEnabled = await isTabEnabled(index);
- setSelectedTabIndex((prev) => (isEnabled ? index : prev));
- }}
- className={({ selected }) =>
- `-mb-[0.14rem] whitespace-nowrap ${index > selectedTabIndex ? "opacity-30" : ""} px-4 py-2 text-sm font-medium outline-hidden disabled:opacity-60 ${
- selected
- ? "border-b-2 border-mineshaft-300 text-mineshaft-200"
- : "text-bunker-300"
- }`
- }
- key={tab.key}
- >
- {index + 1}. {tab.name}
- </Tab>
- ))}
- </Tab.List>
- <Tab.Panels className="min-h-0 thin-scrollbar flex-1 overflow-y-auto">
- <Tab.Panel>
+ <FormProvider {...formMethods}>
+ <form className="flex h-full min-h-0 flex-col" onSubmit={(event) => event.preventDefault()}>
+ <div className="flex min-h-0 flex-1 overflow-hidden">
+ <aside className="hidden w-60 shrink-0 flex-col border-r border-border px-5 py-6 md:flex">
+ <p className="mb-5 text-[11px] font-medium tracking-wider text-muted uppercase">
+ Setup steps
+ </p>
+ {stepperSteps}
+ </aside>
+
+ <div className="flex min-w-0 flex-1 flex-col overflow-y-auto">
+ <div className="border-b border-border px-4 py-4 md:hidden">
+ <p className="text-xs font-medium text-muted">
+ Step {displayedStepNumber} of {totalSteps}: {currentStep.name}
+ </p>
+ </div>
+ <div className="flex w-full max-w-3xl flex-col gap-y-2 px-4 py-6 md:px-8">
+ <div className="mb-6">
+ <h2 className="text-lg font-semibold text-foreground">{currentStep.title}</h2>
+ <p className="mt-1 text-sm text-muted">{currentStep.subtitle}</p>
+ </div>
+
+ {selectedStepIndex === 0 && (
<SecretRotationV2ConfigurationFields
isUpdate={Boolean(secretRotation)}
environments={environments}
/>
- </Tab.Panel>
- <Tab.Panel>
- <SecretRotationV2ParametersFields />
- </Tab.Panel>
- <Tab.Panel>
- <SecretRotationV2SecretsMappingFields />
- </Tab.Panel>
- <Tab.Panel>
- <SecretRotationV2DetailsFields />
- </Tab.Panel>
- <Tab.Panel>
- <SecretRotationV2ReviewFields />
- </Tab.Panel>
- </Tab.Panels>
- </Tab.Group>
- </FormProvider>
- </div>
- <div className="flex w-full flex-shrink-0 flex-row-reverse justify-between gap-4 pt-4">
- <Button
- onClick={handleNext}
- isLoading={isSubmitting}
- isDisabled={isSubmitting}
- colorSchema="secondary"
- >
- {isFinalStep ? `${secretRotation ? "Update" : "Create"} Secret Rotation` : "Next"}
- </Button>
- <Button onClick={handlePrev} colorSchema="secondary">
- Back
- </Button>
- </div>
- </form>
+ )}
+ {selectedStepIndex === 1 && <SecretRotationV2ParametersFields />}
+ {selectedStepIndex === 2 && <SecretRotationV2SecretsMappingFields />}
+ {selectedStepIndex === 3 && <SecretRotationV2DetailsFields />}
+ {selectedStepIndex === 4 && <SecretRotationV2ReviewFields />}
+ </div>
+ </div>
+
+ <aside className="hidden w-80 shrink-0 flex-col border-l border-border px-6 py-6 xl:flex">
+ <div className="flex items-center justify-between gap-2">
+ <p className="text-[11px] font-medium tracking-wider text-muted uppercase">
+ Step {displayedStepNumber} · {currentStep.rightLabel}
+ </p>
+ <DocumentationLinkBadge
+ href={`https://infisical.com/docs/documentation/platform/secret-rotation/${type}`}
+ />
+ </div>
+ <p className="mt-4 text-sm font-semibold text-foreground">What this step does</p>
+ <p className="mt-2 text-sm leading-relaxed text-muted">
+ {currentStep.rightDescription}
+ </p>
+ </aside>
+ </div>
+
+ <div className="flex shrink-0 items-center justify-between gap-3 border-t border-border px-4 py-4 md:px-6">
+ <span className="text-xs text-muted">{hasUnsavedChanges ? "Unsaved changes" : ""}</span>
+ <div className="flex items-center gap-3">
+ <span className="hidden text-xs text-muted sm:inline">
+ Step {displayedStepNumber} of {totalSteps}
+ </span>
+ <Button variant="outline" onClick={handlePrev} isDisabled={formState.isSubmitting}>
+ Back
+ </Button>
+ <Button
+ variant="project"
+ onClick={handleNext}
+ isPending={formState.isSubmitting}
+ isDisabled={formState.isSubmitting}
+ >
+ {isFinalStep ? `${secretRotation ? "Update" : "Create"} secret rotation` : "Continue"}
+ </Button>
+ </div>
+ </div>
+ </form>
+
+ <DiscardChangesAlertDialog
+ open={isDiscardDialogOpen}
+ onOpenChange={setIsDiscardDialogOpen}
+ onDiscard={confirmDiscard}
+ title={secretRotation ? "Discard Changes?" : "Discard Secret Rotation Setup?"}
+ description={
+ secretRotation
+ ? "Your unsaved changes to this secret rotation will be lost."
+ : "Your progress configuring this secret rotation will be lost."
+ }
+ />
+ </FormProvider>
);
};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/Auth0ClientSecretRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/Auth0ClientSecretRotationParametersFields.tsx
index 03e4a41cb8..edec1ba27a 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/Auth0ClientSecretRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/Auth0ClientSecretRotationParametersFields.tsx
@@ -1,10 +1,17 @@
import { Controller, useFormContext } from "react-hook-form";
import { SingleValue } from "react-select";
-import { faCircleInfo } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { InfoIcon } from "lucide-react";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FilterableSelect, FormControl, Tooltip } from "@app/components/v2";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import {
+ Field,
+ FieldFeedback,
+ FilterableSelect,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import { useAuth0ConnectionListClients } from "@app/hooks/api/appConnections/auth0";
import { TAuth0Client } from "@app/hooks/api/appConnections/auth0/types";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
@@ -27,34 +34,15 @@ export const Auth0ClientSecretRotationParametersFields = () => {
<Controller
name="parameters.clientId"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Application"
- helperText={
- <Tooltip
- className="max-w-md"
- content={
- <>
- Ensure that your connection has the{" "}
- <span className="font-medium">read_clients</span> permission and the application
- exists in the connection&#39;s audience.
- </>
- }
- >
- <div>
- <span>Don&#39;t see the application you&#39;re looking for?</span>{" "}
- <FontAwesomeIcon icon={faCircleInfo} className="text-mineshaft-400" />
- </div>
- </Tooltip>
- }
- >
+ render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip htmlFor="auth0-application">Application</FieldLabelWithTooltip>
<FilterableSelect
- menuPlacement="top"
+ inputId="auth0-application"
isLoading={isClientsPending && Boolean(connectionId)}
isDisabled={!connectionId}
value={clients?.find((client) => client.id === value) ?? null}
+ onBlur={onBlur}
onChange={(option) => {
onChange((option as SingleValue<TAuth0Client>)?.id ?? null);
}}
@@ -62,8 +50,29 @@ export const Auth0ClientSecretRotationParametersFields = () => {
placeholder="Select an application..."
getOptionLabel={(option) => option.name}
getOptionValue={(option) => option.id}
+ isError={Boolean(error)}
+ aria-describedby="auth0-application-feedback"
+ />
+ <FieldFeedback
+ id="auth0-application-feedback"
+ description={
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <button type="button" className="inline-flex items-center gap-1 text-left">
+ <span>Don&#39;t see the application you&#39;re looking for?</span>
+ <InfoIcon className="size-3 shrink-0 text-muted" />
+ </button>
+ </TooltipTrigger>
+ <TooltipContent className="max-w-md">
+ Ensure that your connection has the{" "}
+ <span className="font-medium">read_clients</span> permission and the application
+ exists in the connection&#39;s audience.
+ </TooltipContent>
+ </Tooltip>
+ }
+ error={error?.message}
/>
- </FormControl>
+ </Field>
)}
/>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/AwsIamUserSecretRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/AwsIamUserSecretRotationParametersFields.tsx
index 525bde198f..732eddea37 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/AwsIamUserSecretRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/AwsIamUserSecretRotationParametersFields.tsx
@@ -1,11 +1,19 @@
import { Controller, useFormContext } from "react-hook-form";
import { SingleValue } from "react-select";
-import { faCircleInfo } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { InfoIcon } from "lucide-react";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
import { AwsRegionSelect } from "@app/components/secret-syncs/forms/SecretSyncDestinationFields/shared";
-import { FilterableSelect, FormControl, Tooltip } from "@app/components/v2";
+import {
+ Field,
+ FieldError,
+ FieldFeedback,
+ FilterableSelect,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import { TAwsIamUserSecret, useListAwsConnectionIamUsers } from "@app/hooks/api/appConnections/aws";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
@@ -27,28 +35,15 @@ export const AwsIamUserSecretRotationParametersFields = () => {
<Controller
name="parameters.userName"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="IAM User"
- helperText={
- <Tooltip
- className="max-w-md"
- content={<>Ensure that your connection has the correct permissions.</>}
- >
- <div>
- <span>Don&#39;t see the IAM user you&#39;re looking for?</span>{" "}
- <FontAwesomeIcon icon={faCircleInfo} className="text-mineshaft-400" />
- </div>
- </Tooltip>
- }
- >
+ render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip htmlFor="aws-iam-user">IAM User</FieldLabelWithTooltip>
<FilterableSelect
- menuPlacement="top"
+ inputId="aws-iam-user"
isLoading={isClientsPending && Boolean(connectionId)}
isDisabled={!connectionId}
value={clients?.find((client) => client.UserName === value) ?? ""}
+ onBlur={onBlur}
onChange={(option) => {
onChange((option as SingleValue<TAwsIamUserSecret>)?.UserName ?? "");
}}
@@ -60,23 +55,43 @@ export const AwsIamUserSecretRotationParametersFields = () => {
getOptionValue={(option) =>
(option as SingleValue<TAwsIamUserSecret>)?.UserName ?? ""
}
+ isError={Boolean(error)}
+ aria-describedby="aws-iam-user-feedback"
+ />
+ <FieldFeedback
+ id="aws-iam-user-feedback"
+ description={
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <button type="button" className="inline-flex items-center gap-1 text-left">
+ <span>Don&#39;t see the IAM user you&#39;re looking for?</span>
+ <InfoIcon className="size-3 shrink-0 text-muted" />
+ </button>
+ </TooltipTrigger>
+ <TooltipContent className="max-w-md">
+ Ensure that your connection has the correct permissions.
+ </TooltipContent>
+ </Tooltip>
+ }
+ error={error?.message}
/>
- </FormControl>
+ </Field>
)}
/>
<Controller
control={control}
name="parameters.region"
render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isOptional
- isError={Boolean(error)}
- errorText={error?.message}
- label="Region"
- tooltipText="Required only if no global scope is set."
- >
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ htmlFor="aws-region"
+ tooltip="Required only if no global scope is set."
+ >
+ Region <span className="font-normal text-muted">(optional)</span>
+ </FieldLabelWithTooltip>
<AwsRegionSelect value={value ?? ""} onChange={onChange} />
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
</>
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/AzureClientSecretRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/AzureClientSecretRotationParametersFields.tsx
index 150533fcf1..d895f8c710 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/AzureClientSecretRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/AzureClientSecretRotationParametersFields.tsx
@@ -1,10 +1,17 @@
import { Controller, useFormContext } from "react-hook-form";
import { SingleValue } from "react-select";
-import { faCircleInfo } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { InfoIcon } from "lucide-react";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FilterableSelect, FormControl, Tooltip } from "@app/components/v2";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import {
+ Field,
+ FieldFeedback,
+ FilterableSelect,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import { useAzureConnectionListClients } from "@app/hooks/api/appConnections/azure";
import { TAzureClient } from "@app/hooks/api/appConnections/azure/types";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
@@ -27,37 +34,15 @@ export const AzureClientSecretRotationParametersFields = () => {
<Controller
name="parameters.objectId"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Application"
- helperText={
- <Tooltip
- className="max-w-md"
- content={
- <>
- Ensure that your connection has the{" "}
- <span className="font-medium">
- Application.ReadWrite.All, Directory.ReadWrite.All,
- Application.ReadWrite.OwnedBy, user_impersonation and User.Read
- </span>{" "}
- permissions and the application exists in Azure.
- </>
- }
- >
- <div>
- <span>Don&#39;t see the application you&#39;re looking for?</span>{" "}
- <FontAwesomeIcon icon={faCircleInfo} className="text-mineshaft-400" />
- </div>
- </Tooltip>
- }
- >
+ render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip htmlFor="azure-application">Application</FieldLabelWithTooltip>
<FilterableSelect
- menuPlacement="top"
+ inputId="azure-application"
isLoading={isClientsPending && Boolean(connectionId)}
isDisabled={!connectionId}
value={clients?.find((client) => client.id === value) ?? null}
+ onBlur={onBlur}
onChange={(option) => {
onChange((option as SingleValue<TAzureClient>)?.id ?? null);
setValue("parameters.appName", (option as SingleValue<TAzureClient>)?.name ?? "");
@@ -67,8 +52,32 @@ export const AzureClientSecretRotationParametersFields = () => {
placeholder="Select an application..."
getOptionLabel={(option) => option.name}
getOptionValue={(option) => option.id}
+ isError={Boolean(error)}
+ aria-describedby="azure-application-feedback"
+ />
+ <FieldFeedback
+ id="azure-application-feedback"
+ description={
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <button type="button" className="inline-flex items-center gap-1 text-left">
+ <span>Don&#39;t see the application you&#39;re looking for?</span>
+ <InfoIcon className="size-3 shrink-0 text-muted" />
+ </button>
+ </TooltipTrigger>
+ <TooltipContent className="max-w-md">
+ Ensure that your connection has the{" "}
+ <span className="font-medium">
+ Application.ReadWrite.All, Directory.ReadWrite.All,
+ Application.ReadWrite.OwnedBy, user_impersonation and User.Read
+ </span>{" "}
+ permissions and the application exists in Azure.
+ </TooltipContent>
+ </Tooltip>
+ }
+ error={error?.message}
/>
- </FormControl>
+ </Field>
)}
/>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/CloudflareApiTokenRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/CloudflareApiTokenRotationParametersFields.tsx
index 8d82b20ac9..ccd623a4f7 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/CloudflareApiTokenRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/CloudflareApiTokenRotationParametersFields.tsx
@@ -1,25 +1,28 @@
import { useEffect, useMemo } from "react";
import { Controller, useFieldArray, useFormContext } from "react-hook-form";
import { MultiValue, SingleValue } from "react-select";
-import { faPlus, faTrash } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { PlusIcon, TrashIcon } from "lucide-react";
import { twMerge } from "tailwind-merge";
import { z } from "zod";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
import {
Button,
+ Field,
+ FieldError,
FilterableSelect,
- FormControl,
- FormLabel,
IconButton,
Input,
Select,
+ SelectContent,
SelectItem,
- Tab,
- TabList,
- TabPanel,
- Tabs
-} from "@app/components/v2";
+ SelectTrigger,
+ SelectValue,
+ Tabs,
+ TabsContent,
+ TabsList,
+ TabsTrigger
+} from "@app/components/v3";
import {
TCloudflarePermissionGroup,
TCloudflareZone,
@@ -117,193 +120,204 @@ export const CloudflareApiTokenRotationParametersFields = () => {
return (
<Tabs defaultValue={ParameterTab.General}>
- <TabList>
- <Tab value={ParameterTab.General}>General</Tab>
- <Tab value={ParameterTab.Restrictions}>Restrictions</Tab>
- </TabList>
- <TabPanel value={ParameterTab.General}>
+ <TabsList variant="project" className="w-full justify-start">
+ <TabsTrigger value={ParameterTab.General}>General</TabsTrigger>
+ <TabsTrigger value={ParameterTab.Restrictions}>Restrictions</TabsTrigger>
+ </TabsList>
+ <TabsContent value={ParameterTab.General} className="space-y-4">
<Controller
control={control}
name="parameters.name"
render={({ field, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error?.message)}
- errorText={error?.message}
- label="Token Name"
- tooltipText="The name for the generated Cloudflare API token. A timestamp is appended so each rotated token is distinct."
- >
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip tooltip="The name for the generated Cloudflare API token. A timestamp is appended so each rotated token is distinct.">
+ Token Name
+ </FieldLabelWithTooltip>
<Input
{...field}
placeholder="infisical-rotated-token"
maxLength={CLOUDFLARE_TOKEN_NAME_MAX_LENGTH}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
- <FormLabel
- label="Access Policies"
- tooltipText="Each row grants one permission group over the entire account, all zones in the account, or a specific set of zones. Rows targeting the same resources are combined into a single Cloudflare policy."
- />
- <div className="mb-3 flex w-full flex-col space-y-2">
- {policyFields.fields.map(({ id: policyFieldId }, i) => {
- const policyScope = policies?.[i]?.scope ?? CloudflareApiTokenPolicyScope.Account;
- const permissionGroupOptions = permissionGroupsByScope[policyScope];
- const showZones = policyScope === CloudflareApiTokenPolicyScope.Zones;
+ <div className="space-y-3">
+ <FieldLabelWithTooltip tooltip="Each row grants one permission group over the entire account, all zones in the account, or a specific set of zones. Rows targeting the same resources are combined into a single Cloudflare policy.">
+ Access Policies
+ </FieldLabelWithTooltip>
+ <div className="flex w-full flex-col gap-3">
+ {policyFields.fields.map(({ id: policyFieldId }, i) => {
+ const policyScope = policies?.[i]?.scope ?? CloudflareApiTokenPolicyScope.Account;
+ const permissionGroupOptions = permissionGroupsByScope[policyScope];
+ const showZones = policyScope === CloudflareApiTokenPolicyScope.Zones;
- return (
- // A card per policy rather than one flat row: four selects side by side don't fit the
- // modal width, and cramming them wraps the placeholders and misaligns the labels.
- <div
- key={policyFieldId}
- className="rounded-md border border-mineshaft-600 bg-mineshaft-800 p-3"
- >
- <div className="mb-1 flex items-center justify-between">
- <span className="text-xs text-mineshaft-400">Policy {i + 1}</span>
- <IconButton
- ariaLabel="delete policy"
- variant="plain"
- colorSchema="danger"
- onClick={() => {
- const currentPolicies = getValues("parameters.policies");
- if (currentPolicies && currentPolicies.length > 1) {
- policyFields.remove(i);
- } else {
- setValue("parameters.policies", [DEFAULT_POLICY]);
- }
- }}
- >
- <FontAwesomeIcon icon={faTrash} />
- </IconButton>
- </div>
- <div className="grid grid-cols-2 gap-x-3">
- <Controller
- control={control}
- name={`parameters.policies.${i}.effect`}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error?.message)}
- errorText={error?.message}
- label="Effect"
- className="mb-0"
- >
- <Select
- className="w-full"
- position="popper"
- value={field.value}
- onValueChange={field.onChange}
- >
- {Object.entries(CLOUDFLARE_POLICY_EFFECT_MAP).map(([effect, label]) => (
- <SelectItem key={effect} value={effect}>
- {label}
- </SelectItem>
- ))}
- </Select>
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name={`parameters.policies.${i}.scope`}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error?.message)}
- errorText={error?.message}
- label="Scope"
- className="mb-0"
- >
- <Select
- className="w-full"
- position="popper"
- value={field.value}
- onValueChange={(scope) => {
- field.onChange(scope);
- // the zones and permission group from the previous scope no longer apply
- setValue(`parameters.policies.${i}.zoneIds`, []);
- setValue(`parameters.policies.${i}.permissionGroupId`, "");
- }}
- >
- {Object.entries(CLOUDFLARE_POLICY_SCOPE_MAP).map(([scope, label]) => (
- <SelectItem key={scope} value={scope}>
- {label}
- </SelectItem>
- ))}
- </Select>
- </FormControl>
+ return (
+ // A card per policy rather than one flat row: four selects side by side don't fit the
+ // modal width, and cramming them wraps the placeholders and misaligns the labels.
+ <div key={policyFieldId} className="rounded-md border border-border bg-card p-3">
+ <div className="mb-1 flex items-center justify-between">
+ <span className="text-xs text-muted">Policy {i + 1}</span>
+ <IconButton
+ type="button"
+ aria-label="Delete policy"
+ variant="ghost"
+ onClick={() => {
+ const currentPolicies = getValues("parameters.policies");
+ if (currentPolicies && currentPolicies.length > 1) {
+ policyFields.remove(i);
+ } else {
+ setValue("parameters.policies", [DEFAULT_POLICY]);
+ }
+ }}
+ >
+ <TrashIcon />
+ </IconButton>
+ </div>
+ <div className="grid grid-cols-2 gap-x-3">
+ <Controller
+ control={control}
+ name={`parameters.policies.${i}.effect`}
+ render={({ field, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip>Effect</FieldLabelWithTooltip>
+ <Select
+ value={field.value}
+ onValueChange={(nextValue) => {
+ // Radix Select can emit a spurious empty onValueChange while options mount.
+ if (!nextValue || nextValue === field.value) return;
+ field.onChange(nextValue);
+ }}
+ >
+ <SelectTrigger className="w-full" isError={Boolean(error)}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent position="popper">
+ {Object.entries(CLOUDFLARE_POLICY_EFFECT_MAP).map(
+ ([effect, label]) => (
+ <SelectItem key={effect} value={effect}>
+ {label}
+ </SelectItem>
+ )
+ )}
+ </SelectContent>
+ </Select>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name={`parameters.policies.${i}.scope`}
+ render={({ field, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip>Scope</FieldLabelWithTooltip>
+ <Select
+ value={field.value}
+ onValueChange={(scope) => {
+ // Radix Select can emit a spurious empty onValueChange while options mount.
+ if (!scope || scope === field.value) return;
+ field.onChange(scope);
+ // the zones and permission group from the previous scope no longer apply
+ setValue(`parameters.policies.${i}.zoneIds`, []);
+ setValue(`parameters.policies.${i}.permissionGroupId`, "");
+ }}
+ >
+ <SelectTrigger className="w-full" isError={Boolean(error)}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent position="popper">
+ {Object.entries(CLOUDFLARE_POLICY_SCOPE_MAP).map(([scope, label]) => (
+ <SelectItem key={scope} value={scope}>
+ {label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ {showZones && (
+ <Controller
+ control={control}
+ name={`parameters.policies.${i}.zoneIds`}
+ render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => (
+ <Field className="mt-3" data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip>Zones</FieldLabelWithTooltip>
+ <FilterableSelect
+ isMulti
+ isLoading={isZonesPending && Boolean(connectionId)}
+ isDisabled={!connectionId}
+ options={zones}
+ placeholder="Select zones..."
+ getOptionLabel={(option) => option.name}
+ getOptionValue={(option) => option.id}
+ value={zones?.filter((zone) => (value ?? []).includes(zone.id)) ?? []}
+ onBlur={onBlur}
+ onChange={(option) =>
+ onChange(
+ (option as MultiValue<TCloudflareZone>).map((zone) => zone.id)
+ )
+ }
+ isError={Boolean(error)}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
)}
- />
- {showZones && (
<Controller
control={control}
- name={`parameters.policies.${i}.zoneIds`}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error?.message)}
- errorText={error?.message}
- label="Zones"
- className="mt-3 mb-0"
+ name={`parameters.policies.${i}.permissionGroupId`}
+ render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => (
+ <Field
+ className={twMerge("mt-3", showZones ? "" : "col-span-2")}
+ data-invalid={Boolean(error)}
>
+ <FieldLabelWithTooltip>Permission group</FieldLabelWithTooltip>
<FilterableSelect
- isMulti
- isLoading={isZonesPending && Boolean(connectionId)}
+ isLoading={isPermissionGroupsPending && Boolean(connectionId)}
isDisabled={!connectionId}
- options={zones}
- placeholder="Select zones..."
+ options={permissionGroupOptions}
+ placeholder="Select a permission group..."
getOptionLabel={(option) => option.name}
getOptionValue={(option) => option.id}
- value={zones?.filter((zone) => (value ?? []).includes(zone.id)) ?? []}
+ value={
+ permissionGroupOptions.find((group) => group.id === value) ?? null
+ }
+ onBlur={onBlur}
onChange={(option) =>
onChange(
- (option as MultiValue<TCloudflareZone>).map((zone) => zone.id)
+ (option as SingleValue<TCloudflarePermissionGroup>)?.id ?? ""
)
}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
- )}
- <Controller
- control={control}
- name={`parameters.policies.${i}.permissionGroupId`}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error?.message)}
- errorText={error?.message}
- label="Permission group"
- // fills the row when there's no zone picker beside it
- className={twMerge("mt-3 mb-0", showZones ? "" : "col-span-2")}
- >
- <FilterableSelect
- isLoading={isPermissionGroupsPending && Boolean(connectionId)}
- isDisabled={!connectionId}
- options={permissionGroupOptions}
- placeholder="Select a permission group..."
- getOptionLabel={(option) => option.name}
- getOptionValue={(option) => option.id}
- value={permissionGroupOptions.find((group) => group.id === value) ?? null}
- onChange={(option) =>
- onChange((option as SingleValue<TCloudflarePermissionGroup>)?.id ?? "")
- }
- />
- </FormControl>
- )}
- />
+ </div>
</div>
- </div>
- );
- })}
- <div>
- <Button
- leftIcon={<FontAwesomeIcon icon={faPlus} />}
- size="xs"
- variant="outline_bg"
- onClick={() => policyFields.append(DEFAULT_POLICY)}
- >
- Add policy
- </Button>
+ );
+ })}
+ <div>
+ <Button
+ type="button"
+ size="xs"
+ variant="outline"
+ onClick={() => policyFields.append(DEFAULT_POLICY)}
+ >
+ <PlusIcon />
+ Add policy
+ </Button>
+ </div>
</div>
</div>
- </TabPanel>
- <TabPanel value={ParameterTab.Restrictions}>
+ </TabsContent>
+ <TabsContent value={ParameterTab.Restrictions} className="space-y-4">
<CloudflareIpListField
control={control}
name="parameters.allowedIps"
@@ -316,7 +330,7 @@ export const CloudflareApiTokenRotationParametersFields = () => {
label="Disallowed IPs"
tooltipText="The generated token cannot be used from these IP addresses or CIDR blocks. One entry per line."
/>
- </TabPanel>
+ </TabsContent>
</Tabs>
);
};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/CloudflareR2AccessKeyRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/CloudflareR2AccessKeyRotationParametersFields.tsx
index 0c5e31bf2e..21139ae43f 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/CloudflareR2AccessKeyRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/CloudflareR2AccessKeyRotationParametersFields.tsx
@@ -2,17 +2,22 @@ import { useMemo } from "react";
import { Controller, useFormContext } from "react-hook-form";
import { MultiValue } from "react-select";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
import {
+ Field,
+ FieldError,
FilterableSelect,
- FormControl,
Input,
Select,
+ SelectContent,
SelectItem,
- Tab,
- TabList,
- TabPanel,
- Tabs
-} from "@app/components/v2";
+ SelectTrigger,
+ SelectValue,
+ Tabs,
+ TabsContent,
+ TabsList,
+ TabsTrigger
+} from "@app/components/v3";
import { useCloudflareConnectionListR2Buckets } from "@app/hooks/api/appConnections/cloudflare";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
@@ -45,7 +50,7 @@ const formatBucketOptionLabel = (bucket: TCloudflareR2BucketSelection) => {
return (
<span>
- {name} <span className="text-mineshaft-400">{jurisdiction}</span>
+ {name} <span className="text-muted">{jurisdiction}</span>
</span>
);
};
@@ -79,39 +84,37 @@ export const CloudflareR2AccessKeyRotationParametersFields = () => {
return (
<Tabs defaultValue={ParameterTab.General}>
- <TabList>
- <Tab value={ParameterTab.General}>General</Tab>
- <Tab value={ParameterTab.Restrictions}>Restrictions</Tab>
- </TabList>
- <TabPanel value={ParameterTab.General}>
+ <TabsList variant="project" className="w-full justify-start">
+ <TabsTrigger value={ParameterTab.General}>General</TabsTrigger>
+ <TabsTrigger value={ParameterTab.Restrictions}>Restrictions</TabsTrigger>
+ </TabsList>
+ <TabsContent value={ParameterTab.General} className="space-y-4">
<Controller
control={control}
name="parameters.name"
render={({ field, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error?.message)}
- errorText={error?.message}
- label="Token Name"
- tooltipText="The name for the generated Cloudflare API token that backs the access key. A timestamp is appended so each rotated key is distinct."
- >
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip tooltip="The name for the generated Cloudflare API token that backs the access key. A timestamp is appended so each rotated key is distinct.">
+ Token Name
+ </FieldLabelWithTooltip>
<Input
{...field}
placeholder="infisical-r2-access-key"
maxLength={CLOUDFLARE_TOKEN_NAME_MAX_LENGTH}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
<Controller
control={control}
name="parameters.buckets"
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error?.message)}
- errorText={error?.message}
- label="Buckets"
- tooltipText="The R2 buckets the generated access key can act on. Buckets are granted by name, so renaming one in Cloudflare requires updating this rotation."
- >
+ render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip tooltip="The R2 buckets the generated access key can act on. Buckets are granted by name, so renaming one in Cloudflare requires updating this rotation.">
+ Buckets
+ </FieldLabelWithTooltip>
<FilterableSelect
isMulti
isLoading={isBucketsPending && Boolean(connectionId)}
@@ -124,38 +127,47 @@ export const CloudflareR2AccessKeyRotationParametersFields = () => {
// the form field holds the option shape itself, and react-select matches selections by
// `getOptionValue`, so the stored value can be handed back as-is
value={value ?? []}
+ onBlur={onBlur}
onChange={(option) => onChange(option as MultiValue<TCloudflareR2BucketSelection>)}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
<Controller
control={control}
name="parameters.accessLevel"
render={({ field, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error?.message)}
- errorText={error?.message}
- label="Access Level"
- tooltipText="What the generated key can do on the selected buckets. Read only allows get and list; Read & Write also allows put and delete."
- >
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip tooltip="What the generated key can do on the selected buckets. Read only allows get and list; Read & Write also allows put and delete.">
+ Access Level
+ </FieldLabelWithTooltip>
<Select
- className="w-full"
- position="popper"
value={field.value}
- onValueChange={field.onChange}
+ onValueChange={(nextValue) => {
+ // Radix Select can emit a spurious empty onValueChange while options mount.
+ if (!nextValue || nextValue === field.value) return;
+ field.onChange(nextValue);
+ }}
>
- {Object.entries(CLOUDFLARE_R2_ACCESS_LEVEL_MAP).map(([accessLevel, label]) => (
- <SelectItem key={accessLevel} value={accessLevel}>
- {label}
- </SelectItem>
- ))}
+ <SelectTrigger className="w-full" isError={Boolean(error)}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent position="popper">
+ {Object.entries(CLOUDFLARE_R2_ACCESS_LEVEL_MAP).map(([accessLevel, label]) => (
+ <SelectItem key={accessLevel} value={accessLevel}>
+ {label}
+ </SelectItem>
+ ))}
+ </SelectContent>
</Select>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
- </TabPanel>
- <TabPanel value={ParameterTab.Restrictions}>
+ </TabsContent>
+ <TabsContent value={ParameterTab.Restrictions} className="space-y-4">
<CloudflareIpListField
control={control}
name="parameters.allowedIps"
@@ -168,7 +180,7 @@ export const CloudflareR2AccessKeyRotationParametersFields = () => {
label="Disallowed IPs"
tooltipText="The generated access key cannot be used from these IP addresses or CIDR blocks. One entry per line."
/>
- </TabPanel>
+ </TabsContent>
</Tabs>
);
};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/ConvexAccessKeyRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/ConvexAccessKeyRotationParametersFields.tsx
index 4e5bfa6839..f5d0f615e3 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/ConvexAccessKeyRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/ConvexAccessKeyRotationParametersFields.tsx
@@ -1,7 +1,8 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
export const ConvexAccessKeyRotationParametersFields = () => {
@@ -15,10 +16,20 @@ export const ConvexAccessKeyRotationParametersFields = () => {
<Controller
name="parameters.namePrefix"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message} label="Name Prefix">
- <Input value={value} onChange={onChange} placeholder="e.g. infisical-rotation" />
- </FormControl>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip htmlFor="convex-name-prefix">Name Prefix</FieldLabelWithTooltip>
+ <Input
+ ref={ref}
+ id="convex-name-prefix"
+ value={value}
+ onBlur={onBlur}
+ onChange={onChange}
+ placeholder="e.g. infisical-rotation"
+ isError={Boolean(error)}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatabricksServiceAccountSecretRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatabricksServiceAccountSecretRotationParametersFields.tsx
index 5413a4b8f2..973c52b65b 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatabricksServiceAccountSecretRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatabricksServiceAccountSecretRotationParametersFields.tsx
@@ -1,15 +1,22 @@
import { Controller, useFormContext } from "react-hook-form";
import { SingleValue } from "react-select";
-import { faCircleInfo } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { InfoIcon } from "lucide-react";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FilterableSelect, FormControl, Tooltip } from "@app/components/v2";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import {
+ Field,
+ FieldFeedback,
+ FilterableSelect,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import { useDatabricksConnectionListServicePrincipals } from "@app/hooks/api/appConnections/databricks";
import { TDatabricksServicePrincipal } from "@app/hooks/api/appConnections/databricks/types";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
-export const DatabricksServicePrincipalSecretRotationParametersFields = () => {
+export const DatabricksServiceAccountSecretRotationParametersFields = () => {
const { control, watch, setValue } = useFormContext<
TSecretRotationV2Form & {
type: SecretRotation.DatabricksServicePrincipalSecret;
@@ -27,33 +34,17 @@ export const DatabricksServicePrincipalSecretRotationParametersFields = () => {
<Controller
name="parameters.servicePrincipalId"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Service Principal"
- helperText={
- <Tooltip
- className="max-w-md"
- content={
- <>
- Ensure that your connection has the necessary permissions to list and manage
- service principals in your Databricks workspace.
- </>
- }
- >
- <div>
- <span>Don&#39;t see the service principal you&#39;re looking for?</span>{" "}
- <FontAwesomeIcon icon={faCircleInfo} className="text-mineshaft-400" />
- </div>
- </Tooltip>
- }
- >
+ render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip htmlFor="databricks-service-account-principal">
+ Service Principal
+ </FieldLabelWithTooltip>
<FilterableSelect
- menuPlacement="top"
+ inputId="databricks-service-account-principal"
isLoading={isServicePrincipalsPending && Boolean(connectionId)}
isDisabled={!connectionId}
value={servicePrincipals?.find((sp) => sp.id === value) ?? null}
+ onBlur={onBlur}
onChange={(option) => {
const selectedSp = option as SingleValue<TDatabricksServicePrincipal>;
onChange(selectedSp?.id ?? null);
@@ -64,8 +55,28 @@ export const DatabricksServicePrincipalSecretRotationParametersFields = () => {
placeholder="Select a service principal..."
getOptionLabel={(option) => option.name}
getOptionValue={(option) => option.id}
+ isError={Boolean(error)}
+ aria-describedby="databricks-service-account-principal-feedback"
+ />
+ <FieldFeedback
+ id="databricks-service-account-principal-feedback"
+ description={
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <button type="button" className="inline-flex items-center gap-1 text-left">
+ <span>Don&#39;t see the service principal you&#39;re looking for?</span>
+ <InfoIcon className="size-3 shrink-0 text-muted" />
+ </button>
+ </TooltipTrigger>
+ <TooltipContent className="max-w-md">
+ Ensure that your connection has the necessary permissions to list and manage
+ service principals in your Databricks workspace.
+ </TooltipContent>
+ </Tooltip>
+ }
+ error={error?.message}
/>
- </FormControl>
+ </Field>
)}
/>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatabricksServicePrincipalSecretRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatabricksServicePrincipalSecretRotationParametersFields.tsx
index 5413a4b8f2..9ab9f41557 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatabricksServicePrincipalSecretRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatabricksServicePrincipalSecretRotationParametersFields.tsx
@@ -1,10 +1,17 @@
import { Controller, useFormContext } from "react-hook-form";
import { SingleValue } from "react-select";
-import { faCircleInfo } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { InfoIcon } from "lucide-react";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FilterableSelect, FormControl, Tooltip } from "@app/components/v2";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import {
+ Field,
+ FieldFeedback,
+ FilterableSelect,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import { useDatabricksConnectionListServicePrincipals } from "@app/hooks/api/appConnections/databricks";
import { TDatabricksServicePrincipal } from "@app/hooks/api/appConnections/databricks/types";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
@@ -27,33 +34,17 @@ export const DatabricksServicePrincipalSecretRotationParametersFields = () => {
<Controller
name="parameters.servicePrincipalId"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Service Principal"
- helperText={
- <Tooltip
- className="max-w-md"
- content={
- <>
- Ensure that your connection has the necessary permissions to list and manage
- service principals in your Databricks workspace.
- </>
- }
- >
- <div>
- <span>Don&#39;t see the service principal you&#39;re looking for?</span>{" "}
- <FontAwesomeIcon icon={faCircleInfo} className="text-mineshaft-400" />
- </div>
- </Tooltip>
- }
- >
+ render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip htmlFor="databricks-service-principal">
+ Service Principal
+ </FieldLabelWithTooltip>
<FilterableSelect
- menuPlacement="top"
+ inputId="databricks-service-principal"
isLoading={isServicePrincipalsPending && Boolean(connectionId)}
isDisabled={!connectionId}
value={servicePrincipals?.find((sp) => sp.id === value) ?? null}
+ onBlur={onBlur}
onChange={(option) => {
const selectedSp = option as SingleValue<TDatabricksServicePrincipal>;
onChange(selectedSp?.id ?? null);
@@ -64,8 +55,28 @@ export const DatabricksServicePrincipalSecretRotationParametersFields = () => {
placeholder="Select a service principal..."
getOptionLabel={(option) => option.name}
getOptionValue={(option) => option.id}
+ isError={Boolean(error)}
+ aria-describedby="databricks-service-principal-feedback"
+ />
+ <FieldFeedback
+ id="databricks-service-principal-feedback"
+ description={
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <button type="button" className="inline-flex items-center gap-1 text-left">
+ <span>Don&#39;t see the service principal you&#39;re looking for?</span>
+ <InfoIcon className="size-3 shrink-0 text-muted" />
+ </button>
+ </TooltipTrigger>
+ <TooltipContent className="max-w-md">
+ Ensure that your connection has the necessary permissions to list and manage
+ service principals in your Databricks workspace.
+ </TooltipContent>
+ </Tooltip>
+ }
+ error={error?.message}
/>
- </FormControl>
+ </Field>
)}
/>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatadogApiKeyRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatadogApiKeyRotationParametersFields.tsx
index 6954c385de..55ea83a12e 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatadogApiKeyRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatadogApiKeyRotationParametersFields.tsx
@@ -1,7 +1,8 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
/** Max length for the generated Datadog API key name (matches backend schema). */
@@ -18,20 +19,26 @@ export const DatadogApiKeyRotationParametersFields = () => {
<Controller
name="parameters.name"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Key Name"
- tooltipText="The name for the generated Datadog API key"
- >
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ htmlFor="datadog-api-key-name"
+ tooltip="The name for the generated Datadog API key"
+ >
+ Key Name
+ </FieldLabelWithTooltip>
<Input
+ ref={ref}
+ id="datadog-api-key-name"
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder="Infisical Rotated API Key"
maxLength={DATADOG_API_KEY_NAME_MAX_LENGTH}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatadogApplicationKeySecretRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatadogApplicationKeySecretRotationParametersFields.tsx
index d9f0bbc0fa..9aa110d56f 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatadogApplicationKeySecretRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatadogApplicationKeySecretRotationParametersFields.tsx
@@ -2,7 +2,8 @@ import { Controller, useFormContext } from "react-hook-form";
import { SingleValue } from "react-select";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FilterableSelect, FormControl } from "@app/components/v2";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import { Field, FieldError, FilterableSelect } from "@app/components/v3";
import { useListDatadogConnectionServiceAccounts } from "@app/hooks/api/appConnections/datadog";
import { TDatadogServiceAccount } from "@app/hooks/api/appConnections/datadog/types";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
@@ -25,13 +26,17 @@ export const DatadogApplicationKeySecretRotationParametersFields = () => {
<Controller
name="parameters.serviceAccountId"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message} label="Service Account">
+ render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip htmlFor="datadog-service-account">
+ Service Account
+ </FieldLabelWithTooltip>
<FilterableSelect
- menuPlacement="top"
+ inputId="datadog-service-account"
isLoading={isServiceAccountsPending && Boolean(connectionId)}
isDisabled={!connectionId}
value={serviceAccounts?.find((serviceAccount) => serviceAccount.id === value) ?? null}
+ onBlur={onBlur}
onChange={(option) => {
onChange((option as SingleValue<TDatadogServiceAccount>)?.id ?? "");
}}
@@ -39,8 +44,10 @@ export const DatadogApplicationKeySecretRotationParametersFields = () => {
placeholder="Select a service account..."
getOptionLabel={(option) => option.name}
getOptionValue={(option) => option.id}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DbtServiceTokenRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DbtServiceTokenRotationParametersFields.tsx
index 6a8d4deab3..28d7445ce1 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DbtServiceTokenRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DbtServiceTokenRotationParametersFields.tsx
@@ -1,22 +1,26 @@
import { useEffect, useMemo } from "react";
import { Controller, useFieldArray, useFormContext } from "react-hook-form";
import { SingleValue } from "react-select";
-import { faPlus, faTrash } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { PlusIcon, TrashIcon } from "lucide-react";
import { twMerge } from "tailwind-merge";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
import {
+ Badge,
Button,
+ Field,
+ FieldError,
+ FieldLabel,
FilterableSelect,
- FormControl,
- FormLabel,
IconButton,
Input,
Select,
- SelectItem
-} from "@app/components/v2";
-import { Badge } from "@app/components/v3";
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue
+} from "@app/components/v3";
import { TDbtProject, useDbtConnectionListProjects } from "@app/hooks/api/appConnections/dbt";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
@@ -71,69 +75,71 @@ export const DbtServiceTokenRotationParametersFields = () => {
control={control}
name="parameters.tokenName"
render={({ field, fieldState: { error } }) => (
- <FormControl
- tooltipText="Enter a name for the service token to be created."
- isError={Boolean(error?.message)}
- errorText={error?.message}
- label="Service Token Name"
- >
- <Input {...field} placeholder="infisical-service-token" />
- </FormControl>
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip tooltip="Enter a name for the service token to be created.">
+ Service Token Name
+ </FieldLabelWithTooltip>
+ <Input {...field} placeholder="infisical-service-token" isError={Boolean(error)} />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
- <FormLabel label="Permission Grants" />
- <div
- className={twMerge(
- "mb-3 flex w-full flex-col space-y-2",
- permissionGrantsFields?.fields?.length >= 5 ? "max-h-72 overflow-y-auto" : ""
- )}
- >
- {permissionGrantsFields.fields.map(({ id: roleFieldId }, i) => (
- <div key={roleFieldId} className="flex items-end space-x-2">
- <div className="w-80">
- {i === 0 && <span className="text-xs text-mineshaft-400">Permission set</span>}
+ <div className="space-y-2">
+ <FieldLabel>Permission Grants</FieldLabel>
+ <div
+ className={twMerge(
+ "flex w-full flex-col gap-2",
+ permissionGrantsFields.fields.length >= 5 ? "max-h-72 overflow-y-auto" : ""
+ )}
+ >
+ <div className="grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)_2.25rem] items-center gap-2 text-xs text-muted">
+ <span>Permission set</span>
+ <span>Projects</span>
+ <span className="size-9" aria-hidden />
+ </div>
+ {permissionGrantsFields.fields.map(({ id: roleFieldId }, i) => (
+ <div
+ key={roleFieldId}
+ className="grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)_2.25rem] items-start gap-2"
+ >
<Controller
control={control}
name={`parameters.permissionGrants.${i}.permissionSet`}
render={({ field, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error?.message)}
- errorText={error?.message}
- className="mb-0"
- >
+ <Field className="min-w-0" data-invalid={Boolean(error)}>
<Select
- className="w-80"
- position="popper"
- dropdownContainerClassName="max-h-72"
value={field.value}
- onValueChange={field.onChange}
+ onValueChange={(nextValue) => {
+ // Radix Select can emit a spurious empty onValueChange while options mount.
+ if (!nextValue || nextValue === field.value) return;
+ field.onChange(nextValue);
+ }}
>
- {Object.entries(DBT_PERMISSION_SET_MAP).map(
- ([permissionSet, { label, isEnterpriseOnly }]) => (
- <SelectItem key={permissionSet} value={permissionSet}>
- <div className="flex items-center gap-2">
- {label}
- {isEnterpriseOnly && <Badge variant="info">DBT Enterprise</Badge>}
- </div>
- </SelectItem>
- )
- )}
+ <SelectTrigger className="w-full" isError={Boolean(error)}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent position="popper" className="max-h-72">
+ {Object.entries(DBT_PERMISSION_SET_MAP).map(
+ ([permissionSet, { label, isEnterpriseOnly }]) => (
+ <SelectItem key={permissionSet} value={permissionSet}>
+ <div className="flex items-center gap-2">
+ {label}
+ {isEnterpriseOnly && <Badge variant="info">DBT Enterprise</Badge>}
+ </div>
+ </SelectItem>
+ )
+ )}
+ </SelectContent>
</Select>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
- </div>
- <div className="grow">
- {i === 0 && <FormLabel label="Projects" className="text-xs text-mineshaft-400" />}
<Controller
control={control}
name={`parameters.permissionGrants.${i}.projectId`}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error?.message)}
- errorText={error?.message}
- className="mb-0 w-full"
- >
+ render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => (
+ <Field className="min-w-0" data-invalid={Boolean(error)}>
<FilterableSelect
isLoading={isProjectsPending && Boolean(connectionId)}
isDisabled={!connectionId}
@@ -143,49 +149,53 @@ export const DbtServiceTokenRotationParametersFields = () => {
typeof option.id === "undefined" ? option.id : option.id.toString()
}
value={selectableProjects?.find((p) => p.id === value) ?? undefined}
+ onBlur={onBlur}
onChange={(option) => {
const v = (option as SingleValue<TDbtProject>)?.id;
onChange(v ? Number(v) : undefined);
}}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
+ <IconButton
+ type="button"
+ aria-label="Delete grant"
+ className="self-start"
+ variant="outline"
+ onClick={() => {
+ const roles = getValues("parameters.permissionGrants");
+ if (roles && roles.length > 1) {
+ permissionGrantsFields.remove(i);
+ } else {
+ setValue("parameters.permissionGrants", [
+ { permissionSet: DbtPermissionsSet.AccountAdmin, projectId: undefined }
+ ]);
+ }
+ }}
+ >
+ <TrashIcon />
+ </IconButton>
</div>
-
- <IconButton
- ariaLabel="delete key"
- className="bottom-0.5 h-9"
- variant="outline_bg"
- onClick={() => {
- const roles = getValues("parameters.permissionGrants");
- if (roles && roles?.length > 1) {
- permissionGrantsFields.remove(i);
- } else {
- setValue("parameters.permissionGrants", [
- { permissionSet: DbtPermissionsSet.AccountAdmin, projectId: undefined }
- ]);
- }
- }}
+ ))}
+ <div>
+ <Button
+ type="button"
+ size="xs"
+ variant="outline"
+ onClick={() =>
+ permissionGrantsFields.append({
+ permissionSet: DbtPermissionsSet.AccountAdmin,
+ projectId: undefined
+ })
+ }
>
- <FontAwesomeIcon icon={faTrash} />
- </IconButton>
+ <PlusIcon />
+ Add grant
+ </Button>
</div>
- ))}
- <div>
- <Button
- leftIcon={<FontAwesomeIcon icon={faPlus} />}
- size="xs"
- variant="outline_bg"
- onClick={() =>
- permissionGrantsFields.append({
- permissionSet: DbtPermissionsSet.AccountAdmin,
- projectId: undefined
- })
- }
- >
- Add grant
- </Button>
</div>
</div>
</>
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/FireworksApiKeyRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/FireworksApiKeyRotationParametersFields.tsx
index 2f9719fe59..d2938a3e9a 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/FireworksApiKeyRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/FireworksApiKeyRotationParametersFields.tsx
@@ -2,7 +2,8 @@ import { Controller, useFormContext, useWatch } from "react-hook-form";
import { SingleValue } from "react-select";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FilterableSelect, FormControl } from "@app/components/v2";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import { Field, FieldError, FilterableSelect } from "@app/components/v3";
import {
TFireworksServiceAccount,
useFireworksConnectionListServiceAccounts
@@ -13,7 +14,7 @@ const getUserId = (name: string) => name.split("/").pop() ?? name;
const formatServiceAccountLabel = (option: TFireworksServiceAccount) => (
<span>
- {option.displayName} <span className="text-mineshaft-400">({getUserId(option.name)})</span>
+ {option.displayName} <span className="text-muted">({getUserId(option.name)})</span>
</span>
);
@@ -35,17 +36,20 @@ export const FireworksApiKeyRotationParametersFields = () => {
<Controller
name="parameters.serviceAccountUserId"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Service Account"
- tooltipText="The Fireworks service account to create the API key for"
- >
+ render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ htmlFor="fireworks-service-account"
+ tooltip="The Fireworks service account to create the API key for"
+ >
+ Service Account
+ </FieldLabelWithTooltip>
<FilterableSelect
+ inputId="fireworks-service-account"
isLoading={isServiceAccountsLoading && Boolean(connectionId)}
isDisabled={!connectionId}
value={serviceAccounts.find((sa) => getUserId(sa.name) === value) ?? null}
+ onBlur={onBlur}
onChange={(option) => {
const selected = option as SingleValue<TFireworksServiceAccount>;
onChange(selected ? getUserId(selected.name) : null);
@@ -55,8 +59,10 @@ export const FireworksApiKeyRotationParametersFields = () => {
getOptionLabel={(option) => `${option.displayName} (${getUserId(option.name)})`}
getOptionValue={(option) => getUserId(option.name)}
formatOptionLabel={formatServiceAccountLabel}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/HpIloRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/HpIloRotationParametersFields.tsx
index 5a14cd29c7..72c46788a4 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/HpIloRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/HpIloRotationParametersFields.tsx
@@ -1,10 +1,23 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input, Select, SelectItem } from "@app/components/v2";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import {
+ Field,
+ FieldError,
+ FieldFeedback,
+ Input,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue
+} from "@app/components/v3";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { HpIloRotationMethod } from "@app/hooks/api/secretRotationsV2/types/hp-ilo-rotation";
+import { PasswordRequirementsFields } from "./shared";
+
// iLO 5 has a maximum password length of 39 characters
const HP_ILO_DEFAULT_PASSWORD_REQUIREMENTS = {
length: 39,
@@ -45,31 +58,30 @@ export const HpIloRotationParametersFields = () => {
control={control}
defaultValue={HpIloRotationMethod.LoginAsRoot}
render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- tooltipText={
- <>
- <span>Determines how the rotation will be performed:</span>
- <ul className="mt-2 ml-4 flex list-disc flex-col gap-2">
- <li>
- <span className="font-medium">Login as Root</span> - The SSH connection
- credentials of the app connection linked will be used to change the target
- user&apos;s password.
- </li>
- <li>
- <span className="font-medium">Login as Target</span> - The target user will
- authenticate with their own credentials and change their own password.
- </li>
- </ul>
- </>
- }
- tooltipClassName="max-w-sm"
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Rotation Method"
- helperText={getRotationMethodHelperText(isUpdate, value)}
- >
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ tooltip={
+ <>
+ <span>Determines how the rotation will be performed:</span>
+ <ul className="mt-2 ml-4 flex list-disc flex-col gap-2">
+ <li>
+ <span className="font-medium">Login as Root</span> - The SSH connection
+ credentials of the app connection linked will be used to change the target
+ user&apos;s password.
+ </li>
+ <li>
+ <span className="font-medium">Login as Target</span> - The target user will
+ authenticate with their own credentials and change their own password.
+ </li>
+ </ul>
+ </>
+ }
+ tooltipClassName="max-w-sm"
+ >
+ Rotation Method
+ </FieldLabelWithTooltip>
<Select
- isDisabled={isUpdate}
+ disabled={isUpdate}
value={value}
onValueChange={(val) => {
setValue("temporaryParameters", {
@@ -77,199 +89,91 @@ export const HpIloRotationParametersFields = () => {
});
onChange(val);
}}
- className="w-full border border-mineshaft-500 capitalize"
- position="popper"
- dropdownContainerClassName="max-w-none"
>
- {Object.values(HpIloRotationMethod).map((method) => {
- return (
+ <SelectTrigger className="w-full capitalize" isError={Boolean(error)}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent position="popper" className="max-w-none">
+ {Object.values(HpIloRotationMethod).map((method) => (
<SelectItem value={method} className="capitalize" key={method}>
{method.replace(/-/g, " ")}
</SelectItem>
- );
- })}
+ ))}
+ </SelectContent>
</Select>
- </FormControl>
+ <FieldFeedback
+ id="hp-ilo-rotation-method-feedback"
+ description={getRotationMethodHelperText(isUpdate, value)}
+ error={error?.message}
+ />
+ </Field>
)}
/>
<div className="flex gap-3">
<Controller
name="parameters.username"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- className="flex-1"
- isError={Boolean(error)}
- errorText={error?.message}
- label="Target Username"
- tooltipText="The HP iLO username of the account to rotate the password for."
- tooltipClassName="max-w-sm"
- helperText={isUpdate ? "Cannot be updated." : undefined}
- >
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field className="flex-1" data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ htmlFor="hp-ilo-target-username"
+ tooltip="The HP iLO username of the account to rotate the password for."
+ tooltipClassName="max-w-sm"
+ >
+ Target Username
+ </FieldLabelWithTooltip>
<Input
- isDisabled={isUpdate}
+ ref={ref}
+ id="hp-ilo-target-username"
+ disabled={isUpdate}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder="ilo_user"
+ isError={Boolean(error)}
+ aria-describedby={
+ isUpdate || error?.message ? "hp-ilo-target-username-feedback" : undefined
+ }
/>
- </FormControl>
+ {(isUpdate || error?.message) && (
+ <FieldFeedback
+ id="hp-ilo-target-username-feedback"
+ description={isUpdate ? "Cannot be updated." : undefined}
+ error={error?.message}
+ />
+ )}
+ </Field>
)}
/>
{!isUpdate && rotationMethod === HpIloRotationMethod.LoginAsTarget && (
<Controller
name="temporaryParameters.password"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- className="flex-1"
- isError={Boolean(error)}
- errorText={error?.message}
- label="Current Password"
- tooltipText="The current password of the target user. Required for initial rotation setup."
- >
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field className="flex-1" data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ htmlFor="hp-ilo-current-password"
+ tooltip="The current password of the target user. Required for initial rotation setup."
+ >
+ Current Password
+ </FieldLabelWithTooltip>
<Input
+ ref={ref}
+ id="hp-ilo-current-password"
value={value}
+ onBlur={onBlur}
onChange={onChange}
type="password"
placeholder="****************"
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
)}
</div>
- <div className="flex flex-col gap-3">
- <div className="w-full border-b border-mineshaft-600">
- <span className="text-sm text-mineshaft-300">Password Requirements</span>
- </div>
- <div className="grid grid-cols-2 gap-x-3 gap-y-1 rounded-sm border border-mineshaft-600 bg-mineshaft-700 px-3 pt-3">
- <Controller
- control={control}
- name="parameters.passwordRequirements.length"
- defaultValue={HP_ILO_DEFAULT_PASSWORD_REQUIREMENTS.length}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Password Length"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="The length of the password to generate"
- >
- <Input
- type="number"
- min={1}
- max={250}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.digits"
- defaultValue={HP_ILO_DEFAULT_PASSWORD_REQUIREMENTS.required.digits}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Digit Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of digits"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.lowercase"
- defaultValue={HP_ILO_DEFAULT_PASSWORD_REQUIREMENTS.required.lowercase}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Lowercase Character Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of lowercase characters"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.uppercase"
- defaultValue={HP_ILO_DEFAULT_PASSWORD_REQUIREMENTS.required.uppercase}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Uppercase Character Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of uppercase characters"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.symbols"
- defaultValue={HP_ILO_DEFAULT_PASSWORD_REQUIREMENTS.required.symbols}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Symbol Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of symbols"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.allowedSymbols"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Allowed Symbols"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Symbols to use in generated password"
- >
- <Input
- placeholder="-_.~!*"
- size="sm"
- {...field}
- onChange={(e) => field.onChange(e.target.value)}
- />
- </FormControl>
- )}
- />
- </div>
- </div>
+ <PasswordRequirementsFields defaultRequirements={HP_ILO_DEFAULT_PASSWORD_REQUIREMENTS} />
</>
);
};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/LdapPasswordRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/LdapPasswordRotationParametersFields.tsx
index 21aac90b40..4b2374377d 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/LdapPasswordRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/LdapPasswordRotationParametersFields.tsx
@@ -1,11 +1,23 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { DEFAULT_PASSWORD_REQUIREMENTS } from "@app/components/secret-rotations-v2/forms/schemas/shared";
-import { FormControl, Input, Select, SelectItem } from "@app/components/v2";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import {
+ Field,
+ FieldError,
+ FieldFeedback,
+ Input,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue
+} from "@app/components/v3";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { LdapPasswordRotationMethod } from "@app/hooks/api/secretRotationsV2/types/ldap-password-rotation";
+import { PasswordRequirementsFields } from "./shared";
+
export const LdapPasswordRotationParametersFields = () => {
const { control, watch, setValue } = useFormContext<
TSecretRotationV2Form & {
@@ -23,37 +35,29 @@ export const LdapPasswordRotationParametersFields = () => {
control={control}
defaultValue={LdapPasswordRotationMethod.ConnectionPrincipal}
render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- tooltipText={
- <>
- <span>Determines how the rotation will be performed:</span>
- <ul className="mt-2 ml-4 flex list-disc flex-col gap-2">
- <li>
- <span className="font-medium">Connection Principal</span> - The Connection
- principal will rotate the target principal&#39;s password.
- </li>
- <li>
- <span className="font-medium">Target Principal</span> - The target principal
- will rotate their own password.
- </li>
- </ul>
- </>
- }
- tooltipClassName="max-w-sm"
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Rotation Method"
- helperText={
- // eslint-disable-next-line no-nested-ternary
- isUpdate
- ? "Cannot be updated."
- : value === LdapPasswordRotationMethod.ConnectionPrincipal
- ? "The connection principal will rotate the target principal's password"
- : "The target principal will rotate their own password"
- }
- >
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ tooltip={
+ <>
+ <span>Determines how the rotation will be performed:</span>
+ <ul className="mt-2 ml-4 flex list-disc flex-col gap-2">
+ <li>
+ <span className="font-medium">Connection Principal</span> - The Connection
+ principal will rotate the target principal&#39;s password.
+ </li>
+ <li>
+ <span className="font-medium">Target Principal</span> - The target principal
+ will rotate their own password.
+ </li>
+ </ul>
+ </>
+ }
+ tooltipClassName="max-w-sm"
+ >
+ Rotation Method
+ </FieldLabelWithTooltip>
<Select
- isDisabled={isUpdate}
+ disabled={isUpdate}
value={value}
onValueChange={(val) => {
setValue(
@@ -66,199 +70,98 @@ export const LdapPasswordRotationParametersFields = () => {
);
onChange(val);
}}
- className="w-full border border-mineshaft-500 capitalize"
- position="popper"
- dropdownContainerClassName="max-w-none"
>
- {Object.values(LdapPasswordRotationMethod).map((method) => {
- return (
+ <SelectTrigger className="w-full capitalize" isError={Boolean(error)}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent position="popper" className="max-w-none">
+ {Object.values(LdapPasswordRotationMethod).map((method) => (
<SelectItem value={method} className="capitalize" key={method}>
{method.replace("-", " ")}
</SelectItem>
- );
- })}
+ ))}
+ </SelectContent>
</Select>
- </FormControl>
+ <FieldFeedback
+ id="ldap-rotation-method-feedback"
+ description={
+ <>
+ {isUpdate && "Cannot be updated."}
+ {!isUpdate &&
+ value === LdapPasswordRotationMethod.ConnectionPrincipal &&
+ "The connection principal will rotate the target principal's password"}
+ {!isUpdate &&
+ value !== LdapPasswordRotationMethod.ConnectionPrincipal &&
+ "The target principal will rotate their own password"}
+ </>
+ }
+ error={error?.message}
+ />
+ </Field>
)}
/>
<div className="flex gap-3">
<Controller
name="parameters.dn"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- className="flex-1"
- isError={Boolean(error)}
- errorText={error?.message}
- label="Target Principal's DN/UPN"
- tooltipText="The DN/UPN of the principal that you want to perform password rotation on."
- tooltipClassName="max-w-sm"
- helperText={isUpdate ? "Cannot be updated." : undefined}
- >
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field className="flex-1" data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ htmlFor="ldap-target-dn"
+ tooltip="The DN/UPN of the principal that you want to perform password rotation on."
+ tooltipClassName="max-w-sm"
+ >
+ Target Principal&apos;s DN/UPN
+ </FieldLabelWithTooltip>
<Input
- isDisabled={isUpdate}
+ ref={ref}
+ id="ldap-target-dn"
+ disabled={isUpdate}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder="CN=John,OU=Users,DC=example,DC=com"
+ isError={Boolean(error)}
+ aria-describedby={
+ isUpdate || error?.message ? "ldap-target-dn-feedback" : undefined
+ }
/>
- </FormControl>
+ {(isUpdate || error?.message) && (
+ <FieldFeedback
+ id="ldap-target-dn-feedback"
+ description={isUpdate ? "Cannot be updated." : undefined}
+ error={error?.message}
+ />
+ )}
+ </Field>
)}
/>
{rotationMethod === LdapPasswordRotationMethod.TargetPrincipal && !isUpdate && (
<Controller
name="temporaryParameters.password"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- className="flex-1"
- isError={Boolean(error)}
- errorText={error?.message}
- label="Target Principal's Password"
- >
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field className="flex-1" data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip htmlFor="ldap-target-password">
+ Target Principal&apos;s Password
+ </FieldLabelWithTooltip>
<Input
+ ref={ref}
+ id="ldap-target-password"
value={value}
+ onBlur={onBlur}
onChange={onChange}
type="password"
placeholder="****************"
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
)}
</div>
- <div className="flex flex-col gap-3">
- <div className="w-full border-b border-mineshaft-600">
- <span className="text-sm text-mineshaft-300">Password Requirements</span>
- </div>
- <div className="grid grid-cols-2 gap-x-3 gap-y-1 rounded-sm border border-mineshaft-600 bg-mineshaft-700 px-3 pt-3">
- <Controller
- control={control}
- name="parameters.passwordRequirements.length"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.length}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Password Length"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="The length of the password to generate"
- >
- <Input
- type="number"
- min={1}
- max={250}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.digits"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.digits}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Digit Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of digits"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.lowercase"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.lowercase}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Lowercase Character Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of lowercase characters"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.uppercase"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.uppercase}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Uppercase Character Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of uppercase characters"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.symbols"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.symbols}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Symbol Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of symbols"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.allowedSymbols"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.allowedSymbols}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Allowed Symbols"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Symbols to use in generated password"
- >
- <Input
- placeholder="-_.~!*"
- size="sm"
- {...field}
- onChange={(e) => field.onChange(e.target.value)}
- />
- </FormControl>
- )}
- />
- </div>
- </div>
+ <PasswordRequirementsFields />
</>
);
};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/LiteLLMApiKeyRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/LiteLLMApiKeyRotationParametersFields.tsx
index aec08cf9d0..a5c0db62b8 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/LiteLLMApiKeyRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/LiteLLMApiKeyRotationParametersFields.tsx
@@ -3,16 +3,18 @@ import { Controller, useFormContext } from "react-hook-form";
import { MultiValue, SingleValue } from "react-select";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
import {
+ Field,
+ FieldError,
FilterableSelect,
- FormControl,
Input,
- Tab,
- TabList,
- TabPanel,
Tabs,
+ TabsContent,
+ TabsList,
+ TabsTrigger,
TextArea
-} from "@app/components/v2";
+} from "@app/components/v3";
import { useDebounce } from "@app/hooks";
import {
useListLiteLLMConnectionModels,
@@ -131,50 +133,58 @@ export const LiteLLMApiKeyRotationParametersFields = () => {
return (
<Tabs defaultValue={ParameterTab.General}>
- <TabList className="border-b border-mineshaft-500">
- <Tab value={ParameterTab.General}>General</Tab>
- <Tab value={ParameterTab.Advanced}>Advanced</Tab>
- </TabList>
- <TabPanel value={ParameterTab.General}>
+ <TabsList variant="project" className="w-full justify-start">
+ <TabsTrigger value={ParameterTab.General}>General</TabsTrigger>
+ <TabsTrigger value={ParameterTab.Advanced}>Advanced</TabsTrigger>
+ </TabsList>
+ <TabsContent value={ParameterTab.General} className="space-y-4">
<Controller
name="parameters.name"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Key Name"
- tooltipText="A descriptive name for the generated key. Infisical appends a timestamp so each rotated key stays unique and records its creation time."
- >
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ htmlFor="litellm-key-name"
+ tooltip="A descriptive name for the generated key. Infisical appends a timestamp so each rotated key stays unique and records its creation time."
+ >
+ Key Name
+ </FieldLabelWithTooltip>
<Input
+ ref={ref}
+ id="litellm-key-name"
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder="my-rotated-key"
maxLength={LITELLM_API_KEY_NAME_MAX_LENGTH}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
<Controller
name="parameters.userId"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => {
+ render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => {
const selectedValue = resolveSelectedOption(users, selectedUser, value);
return (
- <FormControl
- isOptional
- isError={Boolean(error)}
- errorText={error?.message}
- label="User"
- tooltipText="Associate the generated key with a LiteLLM user. Search by email."
- >
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ htmlFor="litellm-user"
+ tooltip="Associate the generated key with a LiteLLM user. Search by email."
+ >
+ User <span className="font-normal text-muted">(optional)</span>
+ </FieldLabelWithTooltip>
<FilterableSelect
+ inputId="litellm-user"
isClearable
isLoading={
(userSearch !== debouncedUserSearch || isUsersFetching) && Boolean(connectionId)
}
isDisabled={!connectionId}
value={selectedValue}
+ onBlur={onBlur}
onChange={(option) => {
const newValue = (option as SingleValue<TLiteLLMUser>) ?? null;
setSelectedUser(newValue);
@@ -188,31 +198,35 @@ export const LiteLLMApiKeyRotationParametersFields = () => {
placeholder="Search for a user..."
getOptionLabel={(option) => option.name}
getOptionValue={(option) => option.id}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
);
}}
/>
<Controller
name="parameters.teamId"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => {
+ render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => {
const selectedValue = resolveSelectedOption(teams, selectedTeam, value);
return (
- <FormControl
- isOptional
- isError={Boolean(error)}
- errorText={error?.message}
- label="Team"
- tooltipText="Associate the generated key with a LiteLLM team. Search by team alias."
- >
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ htmlFor="litellm-team"
+ tooltip="Associate the generated key with a LiteLLM team. Search by team alias."
+ >
+ Team <span className="font-normal text-muted">(optional)</span>
+ </FieldLabelWithTooltip>
<FilterableSelect
+ inputId="litellm-team"
isClearable
isLoading={
(teamSearch !== debouncedTeamSearch || isTeamsFetching) && Boolean(connectionId)
}
isDisabled={!connectionId}
value={selectedValue}
+ onBlur={onBlur}
onChange={(option) => {
const newValue = (option as SingleValue<TLiteLLMTeam>) ?? null;
setSelectedTeam(newValue);
@@ -226,27 +240,31 @@ export const LiteLLMApiKeyRotationParametersFields = () => {
placeholder="Search for a team..."
getOptionLabel={(option) => option.name}
getOptionValue={(option) => option.id}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
);
}}
/>
<Controller
name="parameters.models"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isOptional
- isError={Boolean(error)}
- errorText={error?.message}
- label="Models"
- tooltipText="Restrict the generated key to specific models. Leave empty to allow all models."
- >
+ render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ htmlFor="litellm-models"
+ tooltip="Restrict the generated key to specific models. Leave empty to allow all models."
+ >
+ Models <span className="font-normal text-muted">(optional)</span>
+ </FieldLabelWithTooltip>
<FilterableSelect
+ inputId="litellm-models"
isMulti
isLoading={isModelsPending && Boolean(connectionId)}
isDisabled={!connectionId}
value={models?.filter((model) => (value ?? []).includes(model.id)) ?? []}
+ onBlur={onBlur}
onChange={(option) => {
onChange((option as MultiValue<TLiteLLMModel>).map((model) => model.id));
}}
@@ -254,35 +272,36 @@ export const LiteLLMApiKeyRotationParametersFields = () => {
placeholder="Select models..."
getOptionLabel={(option) => option.name}
getOptionValue={(option) => option.id}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
- </TabPanel>
- <TabPanel value={ParameterTab.Advanced}>
+ </TabsContent>
+ <TabsContent value={ParameterTab.Advanced} className="space-y-4">
<Controller
name="parameters.additionalOptions"
control={control}
defaultValue={DEFAULT_LITELLM_OPTIONS}
render={({ field, fieldState: { error } }) => (
- <FormControl
- isOptional
- isError={Boolean(error)}
- errorText={error?.message}
- label="Additional Key Options (JSON)"
- tooltipText="Common fields: max_budget (number), tpm_limit / rpm_limit (numbers), metadata (object). user_id, team_id and models are set on the general tab; key_alias, auto_rotate, rotation_interval, duration, send_invite_email and key_type are managed by Infisical and cannot be set here."
- >
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip tooltip="Common fields: max_budget (number), tpm_limit / rpm_limit (numbers), metadata (object). user_id, team_id and models are set on the general tab; key_alias, auto_rotate, rotation_interval, duration, send_invite_email and key_type are managed by Infisical and cannot be set here.">
+ Additional Key Options (JSON){" "}
+ <span className="font-normal text-muted">(optional)</span>
+ </FieldLabelWithTooltip>
<TextArea
{...field}
- reSize="none"
+ className="resize-none font-mono text-sm"
rows={10}
placeholder={DEFAULT_LITELLM_OPTIONS}
- className="border-mineshaft-600 bg-mineshaft-900 font-mono text-sm"
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
- </TabPanel>
+ </TabsContent>
</Tabs>
);
};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/MongoRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/MongoRotationParametersFields.tsx
index 3f6598eeb6..d8f0044f8f 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/MongoRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/MongoRotationParametersFields.tsx
@@ -1,10 +1,12 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
-import { NoticeBannerV2 } from "@app/components/v2/NoticeBannerV2/NoticeBannerV2";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
+import { CreateUserStatementAlert } from "./shared";
+
export const MongoRotationParametersFields = () => {
const { control, watch } = useFormContext<
TSecretRotationV2Form & {
@@ -18,49 +20,48 @@ export const MongoRotationParametersFields = () => {
return (
<>
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Database Username 1"
- >
- <Input value={value} onChange={onChange} placeholder="infisical_user_1" />
- </FormControl>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip htmlFor="mongodb-username-1">
+ Database Username 1
+ </FieldLabelWithTooltip>
+ <Input
+ ref={ref}
+ id="mongodb-username-1"
+ value={value}
+ onBlur={onBlur}
+ onChange={onChange}
+ placeholder="infisical_user_1"
+ isError={Boolean(error)}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="parameters.username1"
/>
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Database Username 2"
- >
- <Input value={value} onChange={onChange} placeholder="infisical_user_2" />
- </FormControl>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip htmlFor="mongodb-username-2">
+ Database Username 2
+ </FieldLabelWithTooltip>
+ <Input
+ ref={ref}
+ id="mongodb-username-2"
+ value={value}
+ onBlur={onBlur}
+ onChange={onChange}
+ placeholder="infisical_user_2"
+ isError={Boolean(error)}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="parameters.username2"
/>
- <NoticeBannerV2 title="Example Create User Statement">
- <p className="mb-3 text-sm text-mineshaft-300">
- Infisical requires two database users to be created for rotation.
- </p>
- <p className="mb-3 text-sm text-mineshaft-300">
- These users are intended to be solely managed by Infisical. Altering their login after
- rotation may cause unexpected failure.
- </p>
- <p className="mb-3 text-sm text-mineshaft-300">
- Below is an example statement for creating the required users. You may need to modify it
- to suit your needs.
- </p>
- <p className="mb-3 text-sm">
- <pre className="max-h-40 overflow-y-auto rounded-sm border border-mineshaft-700 bg-mineshaft-800 p-2 whitespace-pre-wrap text-mineshaft-300">
- {rotationOption!.template.createUserStatement}
- </pre>
- </p>
- </NoticeBannerV2>
+ <CreateUserStatementAlert statement={rotationOption!.template.createUserStatement} />
</>
);
};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/OktaClientSecretRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/OktaClientSecretRotationParametersFields.tsx
index bb306615da..306539a45f 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/OktaClientSecretRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/OktaClientSecretRotationParametersFields.tsx
@@ -2,7 +2,8 @@ import { Controller, useFormContext } from "react-hook-form";
import { SingleValue } from "react-select";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FilterableSelect, FormControl } from "@app/components/v2";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import { Field, FieldError, FilterableSelect } from "@app/components/v3";
import { useOktaConnectionListApps } from "@app/hooks/api/appConnections/okta";
import { TOktaApp } from "@app/hooks/api/appConnections/okta/types";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
@@ -24,17 +25,17 @@ export const OktaClientSecretRotationParametersFields = () => {
<Controller
name="parameters.clientId"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="OpenID Connect Application"
- >
+ render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip htmlFor="okta-application">
+ OpenID Connect Application
+ </FieldLabelWithTooltip>
<FilterableSelect
- menuPlacement="top"
+ inputId="okta-application"
isLoading={isAppsPending && Boolean(connectionId)}
isDisabled={!connectionId}
value={apps?.find((app) => app.id === value) ?? null}
+ onBlur={onBlur}
onChange={(option) => {
onChange((option as SingleValue<TOktaApp>)?.id ?? null);
setValue("parameters.clientId", (option as SingleValue<TOktaApp>)?.id ?? "");
@@ -43,8 +44,10 @@ export const OktaClientSecretRotationParametersFields = () => {
placeholder="Select an application..."
getOptionLabel={(option) => option.label}
getOptionValue={(option) => option.id}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/OpenAIServiceAccountRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/OpenAIServiceAccountRotationParametersFields.tsx
index 966c0333fa..1ccb6f2361 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/OpenAIServiceAccountRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/OpenAIServiceAccountRotationParametersFields.tsx
@@ -3,7 +3,8 @@ import { SingleValue } from "react-select";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
import { OPENAI_SERVICE_ACCOUNT_NAME_MAX_LENGTH } from "@app/components/secret-rotations-v2/forms/schemas/openai-service-account-rotation-schema";
-import { FilterableSelect, FormControl, Input } from "@app/components/v2";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import { Field, FieldError, FilterableSelect, Input } from "@app/components/v3";
import { useListOpenAIConnectionProjects } from "@app/hooks/api/appConnections/openai";
import { TOpenAIProject } from "@app/hooks/api/appConnections/openai/types";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
@@ -29,18 +30,20 @@ export const OpenAIServiceAccountRotationParametersFields = () => {
<Controller
name="parameters.projectId"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Project"
- tooltipText="The OpenAI project to create service accounts in. This cannot be changed after the rotation is created."
- >
+ render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ htmlFor="openai-project"
+ tooltip="The OpenAI project to create service accounts in. This cannot be changed after the rotation is created."
+ >
+ Project
+ </FieldLabelWithTooltip>
<FilterableSelect
- menuPlacement="top"
+ inputId="openai-project"
isLoading={isProjectsPending && Boolean(connectionId)}
isDisabled={!connectionId}
value={projects?.find((project) => project.id === value) ?? null}
+ onBlur={onBlur}
onChange={(option) => {
onChange((option as SingleValue<TOpenAIProject>)?.id ?? "");
}}
@@ -48,27 +51,35 @@ export const OpenAIServiceAccountRotationParametersFields = () => {
placeholder="Select a project..."
getOptionLabel={(option) => option.name}
getOptionValue={(option) => option.id}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
<Controller
name="parameters.name"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Service Account Name"
- tooltipText="A descriptive name for the generated service account. This will be saved in the OpenAI dashboard for reference with a suffix of the timestamp of the service account creation."
- >
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ htmlFor="openai-service-account-name"
+ tooltip="A descriptive name for the generated service account. This will be saved in the OpenAI dashboard for reference with a suffix of the timestamp of the service account creation."
+ >
+ Service Account Name
+ </FieldLabelWithTooltip>
<Input
+ ref={ref}
+ id="openai-service-account-name"
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder="OpenAI Service Account Name"
maxLength={OPENAI_SERVICE_ACCOUNT_NAME_MAX_LENGTH}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
</>
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/OpenRouterApiKeyRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/OpenRouterApiKeyRotationParametersFields.tsx
index a9298edb26..10b227709a 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/OpenRouterApiKeyRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/OpenRouterApiKeyRotationParametersFields.tsx
@@ -1,7 +1,21 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input, Select, SelectItem, Switch } from "@app/components/v2";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import {
+ Field,
+ FieldContent,
+ FieldError,
+ FieldFeedback,
+ Input,
+ Label,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+ Switch
+} from "@app/components/v3";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { OpenRouterLimitReset } from "@app/hooks/api/secretRotationsV2/types/open-router-api-key-rotation";
@@ -31,94 +45,108 @@ export const OpenRouterApiKeyRotationParametersFields = () => {
<Controller
name="parameters.name"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Key Name"
- tooltipText="A descriptive name for the generated API key"
- >
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ htmlFor="openrouter-key-name"
+ tooltip="A descriptive name for the generated API key"
+ >
+ Key Name
+ </FieldLabelWithTooltip>
<Input
+ ref={ref}
+ id="openrouter-key-name"
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder="My Rotated API Key"
maxLength={OPEN_ROUTER_API_KEY_NAME_MAX_LENGTH}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
<Controller
name="parameters.limit"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Credit Limit (USD)"
- isOptional
- tooltipText="Optional spending limit in USD for the generated API key"
- >
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ htmlFor="openrouter-credit-limit"
+ tooltip="Optional spending limit in USD for the generated API key"
+ >
+ Credit Limit (USD) <span className="font-normal text-muted">(optional)</span>
+ </FieldLabelWithTooltip>
<Input
+ ref={ref}
+ id="openrouter-credit-limit"
type="number"
value={value ?? ""}
+ onBlur={onBlur}
onChange={(e) => {
const val = e.target.value;
onChange(val === "" ? null : Number(val));
}}
placeholder="Leave blank for unlimited"
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
<Controller
name="parameters.limitReset"
control={control}
render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Reset Limit Every"
- isOptional
- tooltipText="How often the spending limit resets (daily, weekly, or monthly). Resets happen at midnight UTC."
- >
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip tooltip="How often the spending limit resets (daily, weekly, or monthly). Resets happen at midnight UTC.">
+ Reset Limit Every <span className="font-normal text-muted">(optional)</span>
+ </FieldLabelWithTooltip>
<Select
+ disabled={!limit}
value={value ?? NO_RESET_VALUE}
onValueChange={(val) => onChange(val === NO_RESET_VALUE ? null : val)}
- className="w-full"
- isDisabled={!limit}
>
- {LIMIT_RESET_OPTIONS.map((option) => (
- <SelectItem key={option.value} value={option.value}>
- {option.label}
- </SelectItem>
- ))}
+ <SelectTrigger className="w-full" isError={Boolean(error)}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent position="popper">
+ {LIMIT_RESET_OPTIONS.map((option) => (
+ <SelectItem key={option.value} value={option.value}>
+ {option.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
</Select>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
<Controller
name="parameters.includeByokInLimit"
control={control}
render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- helperText={
- (value ?? false)
- ? "BYOK (Bring Your Own Key) usage will count toward this key's spending limit."
- : "Only OpenRouter credits count toward the limit. BYOK usage is tracked separately."
- }
- isError={Boolean(error)}
- errorText={error?.message}
- >
+ <Field orientation="horizontal" data-invalid={Boolean(error)}>
<Switch
- className="bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"
id="include-byok-in-limit"
- thumbClassName="bg-mineshaft-800"
- onCheckedChange={(checked) => onChange(checked)}
- isChecked={value ?? false}
- >
- <span className="whitespace-nowrap">Include BYOK</span>
- </Switch>
- </FormControl>
+ checked={value ?? false}
+ onCheckedChange={onChange}
+ variant="project"
+ />
+ <FieldContent>
+ <Label htmlFor="include-byok-in-limit">Include BYOK</Label>
+ <FieldFeedback
+ id="include-byok-in-limit-feedback"
+ description={
+ (value ?? false)
+ ? "BYOK (Bring Your Own Key) usage will count toward this key's spending limit."
+ : "Only OpenRouter credits count toward the limit. BYOK usage is tracked separately."
+ }
+ error={error?.message}
+ />
+ </FieldContent>
+ </Field>
)}
/>
</>
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/RedisCredentialsRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/RedisCredentialsRotationParametersFields.tsx
index b65467e5d5..7759ffa90a 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/RedisCredentialsRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/RedisCredentialsRotationParametersFields.tsx
@@ -1,10 +1,11 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
-import { DEFAULT_PASSWORD_REQUIREMENTS } from "../schemas/shared";
+import { PasswordRequirementsFields } from "./shared";
export const RedisCredentialsRotationParametersFields = () => {
const { control } = useFormContext<
@@ -20,179 +21,57 @@ export const RedisCredentialsRotationParametersFields = () => {
control={control}
name="parameters.permissionScope"
defaultValue=""
- render={({ field, fieldState: { error } }) => (
- <FormControl
- tooltipClassName="max-w-160 w-full"
- tooltipText={
- <div className="flex flex-col gap-4">
- <p>
- This is the access control permissions that will be set for the issued Redis
- users. The format must be a valid Redis ACL pattern.
- </p>
- <p>
- The default value is{" "}
- <code className="rounded-sm bg-mineshaft-700 px-1 py-0.5 font-mono font-medium text-bunker-300">
- ~* +@all
- </code>
- . You can modify it to suit your needs.
- </p>
- <p>
- For more information, please refer to the{" "}
- <a
- className="font-medium text-primary-500 underline hover:text-primary-600"
- href="https://redis.io/docs/latest/operate/oss_and_stack/management/security/acl/"
- target="_blank"
- rel="noopener noreferrer"
- >
- Redis ACL documentation
- </a>
- .
- </p>
- </div>
- }
- label="Permission Scope"
- isError={Boolean(error)}
- errorText={error?.message}
- >
- <Input {...field} placeholder="~* +@read @write" />
- </FormControl>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ htmlFor="redis-permission-scope"
+ tooltipClassName="max-w-160 w-full"
+ tooltip={
+ <div className="flex flex-col gap-4">
+ <p>
+ This is the access control permissions that will be set for the issued Redis
+ users. The format must be a valid Redis ACL pattern.
+ </p>
+ <p>
+ The default value is{" "}
+ <code className="rounded-sm bg-container px-1 py-0.5 font-mono font-medium text-foreground">
+ ~* +@all
+ </code>
+ . You can modify it to suit your needs.
+ </p>
+ <p>
+ For more information, please refer to the{" "}
+ <a
+ className="font-medium underline"
+ href="https://redis.io/docs/latest/operate/oss_and_stack/management/security/acl/"
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ Redis ACL documentation
+ </a>
+ .
+ </p>
+ </div>
+ }
+ >
+ Permission Scope
+ </FieldLabelWithTooltip>
+ <Input
+ ref={ref}
+ id="redis-permission-scope"
+ value={value}
+ onBlur={onBlur}
+ onChange={onChange}
+ placeholder="~* +@read @write"
+ isError={Boolean(error)}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
</div>
- <div className="flex flex-col gap-3">
- <div className="w-full border-b border-mineshaft-600">
- <span className="text-sm text-mineshaft-300">Password Requirements</span>
- </div>
- <div className="grid grid-cols-2 gap-x-3 gap-y-1 rounded-sm border border-mineshaft-600 bg-mineshaft-700 px-3 pt-3">
- <Controller
- control={control}
- name="parameters.passwordRequirements.length"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.length}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Password Length"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="The length of the password to generate"
- >
- <Input
- type="number"
- min={1}
- max={250}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.digits"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.digits}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Digit Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of digits"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.lowercase"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.lowercase}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Lowercase Character Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of lowercase characters"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.uppercase"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.uppercase}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Uppercase Character Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of uppercase characters"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.symbols"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.symbols}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Symbol Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of symbols"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.allowedSymbols"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.allowedSymbols}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Allowed Symbols"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Symbols to use in generated password"
- >
- <Input
- placeholder="-_.~!*"
- size="sm"
- {...field}
- onChange={(e) => field.onChange(e.target.value)}
- />
- </FormControl>
- )}
- />
- </div>
- </div>
+ <PasswordRequirementsFields />
</>
);
};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SalesforceOauthCredentialsRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SalesforceOauthCredentialsRotationParametersFields.tsx
index bff5451d84..71685cc993 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SalesforceOauthCredentialsRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SalesforceOauthCredentialsRotationParametersFields.tsx
@@ -1,10 +1,17 @@
import { Controller, useFormContext } from "react-hook-form";
import { SingleValue } from "react-select";
-import { faCircleInfo } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { InfoIcon } from "lucide-react";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FilterableSelect, FormControl, Tooltip } from "@app/components/v2";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import {
+ Field,
+ FieldFeedback,
+ FilterableSelect,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import { useSalesforceConnectionListOauthApps } from "@app/hooks/api/appConnections/salesforce";
import { TSalesforceOauthApp } from "@app/hooks/api/appConnections/salesforce/types";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
@@ -27,33 +34,17 @@ export const SalesforceOauthCredentialsRotationParametersFields = () => {
<Controller
name="parameters.appId"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="External Client App"
- helperText={
- <Tooltip
- className="max-w-md"
- content={
- <>
- Ensure that your Salesforce External Client App has OAuth client credentials
- enabled and is reachable by the connection.
- </>
- }
- >
- <div>
- <span>Don&#39;t see the app you&#39;re looking for?</span>{" "}
- <FontAwesomeIcon icon={faCircleInfo} className="text-mineshaft-400" />
- </div>
- </Tooltip>
- }
- >
+ render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip htmlFor="salesforce-external-client-app">
+ External Client App
+ </FieldLabelWithTooltip>
<FilterableSelect
- menuPlacement="top"
+ inputId="salesforce-external-client-app"
isLoading={isAppsPending && Boolean(connectionId)}
isDisabled={!connectionId}
value={apps?.find((app) => app.identifier === value) ?? null}
+ onBlur={onBlur}
onChange={(option) => {
const selected = option as SingleValue<TSalesforceOauthApp>;
onChange(selected?.identifier ?? "");
@@ -66,8 +57,28 @@ export const SalesforceOauthCredentialsRotationParametersFields = () => {
placeholder="Select an external client app..."
getOptionLabel={(option) => option.developerName}
getOptionValue={(option) => option.identifier}
+ isError={Boolean(error)}
+ aria-describedby="salesforce-external-client-app-feedback"
+ />
+ <FieldFeedback
+ id="salesforce-external-client-app-feedback"
+ description={
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <button type="button" className="inline-flex items-center gap-1 text-left">
+ <span>Don&#39;t see the app you&#39;re looking for?</span>
+ <InfoIcon className="size-3 shrink-0 text-muted" />
+ </button>
+ </TooltipTrigger>
+ <TooltipContent className="max-w-md">
+ Ensure that your Salesforce External Client App has OAuth client credentials
+ enabled and is reachable by the connection.
+ </TooltipContent>
+ </Tooltip>
+ }
+ error={error?.message}
/>
- </FormControl>
+ </Field>
)}
/>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx
index a004260763..86787cbb08 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx
@@ -69,11 +69,8 @@ export const SecretRotationV2ParametersFields = () => {
const Component = COMPONENT_MAP[rotationType];
return (
- <>
- <p className="mb-4 text-sm text-bunker-300">
- Configure the required parameters for this Secret Rotation.
- </p>
+ <div className="space-y-4">
<Component />
- </>
+ </div>
);
};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SnowflakeUserKeyPairRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SnowflakeUserKeyPairRotationParametersFields.tsx
index 63a8efbef4..cd29f693e6 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SnowflakeUserKeyPairRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SnowflakeUserKeyPairRotationParametersFields.tsx
@@ -1,11 +1,23 @@
import { Controller, useFormContext } from "react-hook-form";
import { SingleValue } from "react-select";
-import { faCircleInfo } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { InfoIcon } from "lucide-react";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Select, SelectItem, Tooltip } from "@app/components/v2";
-import { CreatableSelect } from "@app/components/v2/CreatableSelect";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import {
+ CreatableSelect,
+ Field,
+ FieldError,
+ FieldFeedback,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import { useSnowflakeConnectionListUsers } from "@app/hooks/api/appConnections/snowflake";
import { TSnowflakeUser } from "@app/hooks/api/appConnections/snowflake/types";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
@@ -34,40 +46,15 @@ export const SnowflakeUserKeyPairRotationParametersFields = () => {
<Controller
name="parameters.username"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="User"
- helperText={
- isUpdate ? (
- "Cannot be updated."
- ) : (
- <Tooltip
- className="max-w-md"
- content={
- <>
- Select an existing Snowflake user, or type a new username to create it. New
- users are created as key-pair-only SERVICE users. Ensure your connection&#39;s
- role has the privileges to list users, alter the user&#39;s RSA public key,
- and (for new users) create users. If the keys are rotated the user will
- continue to exist.
- </>
- }
- >
- <div>
- <span>Don&#39;t see the user you&#39;re looking for?</span>{" "}
- <FontAwesomeIcon icon={faCircleInfo} className="text-mineshaft-400" />
- </div>
- </Tooltip>
- )
- }
- >
+ render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip htmlFor="snowflake-user">User</FieldLabelWithTooltip>
<CreatableSelect<TUserOption>
- menuPlacement="top"
+ inputId="snowflake-user"
isLoading={isUsersPending && Boolean(connectionId) && !isUpdate}
isDisabled={!connectionId || isUpdate}
value={users?.find((user) => user.name === value) ?? (value ? { name: value } : null)}
+ onBlur={onBlur}
onChange={(option) => {
const selectedUser = option as SingleValue<TUserOption>;
onChange(selectedUser?.name ?? null);
@@ -83,8 +70,35 @@ export const SnowflakeUserKeyPairRotationParametersFields = () => {
getOptionLabel={(option) => option.label ?? option.name}
getOptionValue={(option) => option.name}
isClearable
+ isError={Boolean(error)}
+ aria-describedby="snowflake-user-feedback"
+ />
+ <FieldFeedback
+ id="snowflake-user-feedback"
+ description={
+ isUpdate ? (
+ "Cannot be updated."
+ ) : (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <button type="button" className="inline-flex items-center gap-1 text-left">
+ <span>Don&#39;t see the user you&#39;re looking for?</span>
+ <InfoIcon className="size-3 shrink-0 text-muted" />
+ </button>
+ </TooltipTrigger>
+ <TooltipContent className="max-w-md">
+ Select an existing Snowflake user, or type a new username to create it. New
+ users are created as key-pair-only SERVICE users. Ensure your connection&#39;s
+ role has the privileges to list users, alter the user&#39;s RSA public key,
+ and (for new users) create users. If the keys are rotated the user will
+ continue to exist.
+ </TooltipContent>
+ </Tooltip>
+ )
+ }
+ error={error?.message}
/>
- </FormControl>
+ </Field>
)}
/>
<Controller
@@ -92,27 +106,27 @@ export const SnowflakeUserKeyPairRotationParametersFields = () => {
control={control}
defaultValue={2048}
render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="RSA Modulus Length"
- tooltipText="The size in bits of the generated RSA key pairs. 2048-bit keys are faster to generate and use; 4096-bit keys provide a larger security margin."
- tooltipClassName="max-w-sm"
- >
- <Select
- value={String(value)}
- onValueChange={(val) => onChange(Number(val))}
- className="w-full border border-mineshaft-500"
- position="popper"
- dropdownContainerClassName="max-w-none"
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ tooltip="The size in bits of the generated RSA key pairs. 2048-bit keys are faster to generate and use; 4096-bit keys provide a larger security margin."
+ tooltipClassName="max-w-sm"
>
- {RSA_MODULUS_LENGTHS.map((length) => (
- <SelectItem value={String(length)} key={length}>
- {length}-bit
- </SelectItem>
- ))}
+ RSA Modulus Length
+ </FieldLabelWithTooltip>
+ <Select value={String(value)} onValueChange={(val) => onChange(Number(val))}>
+ <SelectTrigger className="w-full" isError={Boolean(error)}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent position="popper">
+ {RSA_MODULUS_LENGTHS.map((length) => (
+ <SelectItem value={String(length)} key={length}>
+ {length}-bit
+ </SelectItem>
+ ))}
+ </SelectContent>
</Select>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
</>
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SupabaseApiKeyRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SupabaseApiKeyRotationParametersFields.tsx
index 67fbcdd275..8ce01d0b3b 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SupabaseApiKeyRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SupabaseApiKeyRotationParametersFields.tsx
@@ -2,7 +2,8 @@ import { Controller, useFormContext, useWatch } from "react-hook-form";
import { SingleValue } from "react-select";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FilterableSelect, FormControl } from "@app/components/v2";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import { Field, FieldError, FilterableSelect } from "@app/components/v3";
import {
TSupabaseProject,
useSupabaseConnectionListProjects
@@ -17,7 +18,7 @@ const KEY_TYPE_OPTIONS = [
const formatProjectOptionLabel = (option: TSupabaseProject) => (
<span>
- {option.name} <span className="text-mineshaft-400">(id: {option.id})</span>
+ {option.name} <span className="text-muted">(id: {option.id})</span>
</span>
);
@@ -42,17 +43,20 @@ export const SupabaseApiKeyRotationParametersFields = () => {
<Controller
name="parameters.projectRef"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Project"
- tooltipText="The Supabase project to rotate the API key for"
- >
+ render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ htmlFor="supabase-project"
+ tooltip="The Supabase project to rotate the API key for"
+ >
+ Project
+ </FieldLabelWithTooltip>
<FilterableSelect
+ inputId="supabase-project"
isLoading={isProjectsLoading && Boolean(connectionId)}
isDisabled={!connectionId}
value={projects.find((p) => p.id === value) ?? null}
+ onBlur={onBlur}
onChange={(option) => {
const v = option as SingleValue<TSupabaseProject>;
onChange(v?.id ?? null);
@@ -62,22 +66,27 @@ export const SupabaseApiKeyRotationParametersFields = () => {
getOptionLabel={(option) => `${option.name} (id: ${option.id})`}
getOptionValue={(option) => option.id}
formatOptionLabel={formatProjectOptionLabel}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
<Controller
name="parameters.keyType"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Key Type"
- tooltipText="Publishable keys are safe to use in browsers and client-side code. Secret keys grant privileged access to the project API and should never be exposed publicly."
- >
+ render={({ field: { value, onChange, onBlur }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ htmlFor="supabase-key-type"
+ tooltip="Publishable keys are safe to use in browsers and client-side code. Secret keys grant privileged access to the project API and should never be exposed publicly."
+ >
+ Key Type
+ </FieldLabelWithTooltip>
<FilterableSelect
+ inputId="supabase-key-type"
value={KEY_TYPE_OPTIONS.find((o) => o.value === value) ?? null}
+ onBlur={onBlur}
onChange={(option) =>
onChange(
(option as SingleValue<{ label: string; value: SupabaseApiKeyType }>)?.value ??
@@ -88,8 +97,10 @@ export const SupabaseApiKeyRotationParametersFields = () => {
getOptionLabel={(option) => option.label}
getOptionValue={(option) => option.value}
placeholder="Select a key type..."
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
</>
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/UnixLinuxLocalAccountRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/UnixLinuxLocalAccountRotationParametersFields.tsx
index af53a4afef..15746699ba 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/UnixLinuxLocalAccountRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/UnixLinuxLocalAccountRotationParametersFields.tsx
@@ -1,11 +1,25 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { DEFAULT_PASSWORD_REQUIREMENTS } from "@app/components/secret-rotations-v2/forms/schemas/shared";
-import { Checkbox, FormControl, Input, Select, SelectItem } from "@app/components/v2";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import {
+ Checkbox,
+ Field,
+ FieldContent,
+ FieldError,
+ FieldFeedback,
+ Input,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue
+} from "@app/components/v3";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { UnixLinuxLocalAccountRotationMethod } from "@app/hooks/api/secretRotationsV2/types/unix-linux-local-account-rotation";
+import { PasswordRequirementsFields } from "./shared";
+
export const UnixLinuxLocalAccountRotationParametersFields = () => {
const { control, watch, setValue } = useFormContext<
TSecretRotationV2Form & {
@@ -27,38 +41,30 @@ export const UnixLinuxLocalAccountRotationParametersFields = () => {
control={control}
defaultValue={UnixLinuxLocalAccountRotationMethod.LoginAsTarget}
render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- tooltipText={
- <>
- <span>Determines how the rotation will be performed:</span>
- <ul className="mt-2 ml-4 flex list-disc flex-col gap-2">
- <li>
- <span className="font-medium">Login as Root</span> - The SSH connection
- credentials of the app connection linked will be used to change the target
- user&#39;s password.
- </li>
- <li>
- <span className="font-medium">Login as Target</span> - The target user will
- authenticate with their own credentials and change their own password.
- </li>
- </ul>
- </>
- }
- tooltipClassName="max-w-sm"
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Rotation Method"
- helperText={
- // eslint-disable-next-line no-nested-ternary
- isUpdate
- ? "Cannot be updated."
- : value === UnixLinuxLocalAccountRotationMethod.LoginAsRoot
- ? "The SSH connection credentials will change the target user's password"
- : "The target user will change their own password"
- }
- >
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ tooltip={
+ <>
+ <span>Determines how the rotation will be performed:</span>
+ <ul className="mt-2 ml-4 flex list-disc flex-col gap-2">
+ <li>
+ <span className="font-medium">Login as Root</span> - The SSH connection
+ credentials of the app connection linked will be used to change the target
+ user&#39;s password.
+ </li>
+ <li>
+ <span className="font-medium">Login as Target</span> - The target user will
+ authenticate with their own credentials and change their own password.
+ </li>
+ </ul>
+ </>
+ }
+ tooltipClassName="max-w-sm"
+ >
+ Rotation Method
+ </FieldLabelWithTooltip>
<Select
- isDisabled={isUpdate}
+ disabled={isUpdate}
value={value}
onValueChange={(val) => {
setValue("temporaryParameters", {
@@ -66,19 +72,34 @@ export const UnixLinuxLocalAccountRotationParametersFields = () => {
});
onChange(val);
}}
- className="w-full border border-mineshaft-500 capitalize"
- position="popper"
- dropdownContainerClassName="max-w-none"
>
- {Object.values(UnixLinuxLocalAccountRotationMethod).map((method) => {
- return (
+ <SelectTrigger className="w-full capitalize" isError={Boolean(error)}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent position="popper" className="max-w-none">
+ {Object.values(UnixLinuxLocalAccountRotationMethod).map((method) => (
<SelectItem value={method} className="capitalize" key={method}>
{method.replace(/-/g, " ")}
</SelectItem>
- );
- })}
+ ))}
+ </SelectContent>
</Select>
- </FormControl>
+ <FieldFeedback
+ id="unix-linux-rotation-method-feedback"
+ description={
+ <>
+ {isUpdate && "Cannot be updated."}
+ {!isUpdate &&
+ value === UnixLinuxLocalAccountRotationMethod.LoginAsRoot &&
+ "The SSH connection credentials will change the target user's password"}
+ {!isUpdate &&
+ value !== UnixLinuxLocalAccountRotationMethod.LoginAsRoot &&
+ "The target user will change their own password"}
+ </>
+ }
+ error={error?.message}
+ />
+ </Field>
)}
/>
{rotationMethod === UnixLinuxLocalAccountRotationMethod.LoginAsRoot && (
@@ -87,20 +108,23 @@ export const UnixLinuxLocalAccountRotationParametersFields = () => {
control={control}
defaultValue
render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="When enabled, uses 'sudo passwd' to change the password. When disabled, uses 'passwd' directly. Enable this if the SSH connection user requires sudo privileges to change other users' passwords. If sudo prompts for a password, the app connection password will be provided automatically."
- tooltipClassName="max-w-sm"
- >
+ <Field orientation="horizontal" data-invalid={Boolean(error)}>
<Checkbox
id="useSudo"
isChecked={value}
onCheckedChange={(checked) => onChange(checked)}
- >
- Use sudo to change password
- </Checkbox>
- </FormControl>
+ />
+ <FieldContent>
+ <FieldLabelWithTooltip
+ htmlFor="useSudo"
+ tooltip="When enabled, uses 'sudo passwd' to change the password. When disabled, uses 'passwd' directly. Enable this if the SSH connection user requires sudo privileges to change other users' passwords. If sudo prompts for a password, the app connection password will be provided automatically."
+ tooltipClassName="max-w-sm"
+ >
+ Use sudo to change password
+ </FieldLabelWithTooltip>
+ </FieldContent>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
)}
@@ -108,181 +132,67 @@ export const UnixLinuxLocalAccountRotationParametersFields = () => {
<Controller
name="parameters.username"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- className="flex-1"
- isError={Boolean(error)}
- errorText={error?.message}
- label="Target Username"
- tooltipText="The Unix/Linux username of the account to rotate the password for."
- tooltipClassName="max-w-sm"
- helperText={isUpdate ? "Cannot be updated." : undefined}
- >
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field className="flex-1" data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ htmlFor="unix-linux-target-username"
+ tooltip="The Unix/Linux username of the account to rotate the password for."
+ tooltipClassName="max-w-sm"
+ >
+ Target Username
+ </FieldLabelWithTooltip>
<Input
- isDisabled={isUpdate}
+ ref={ref}
+ id="unix-linux-target-username"
+ disabled={isUpdate}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder="appuser"
+ isError={Boolean(error)}
+ aria-describedby={
+ isUpdate || error?.message ? "unix-linux-target-username-feedback" : undefined
+ }
/>
- </FormControl>
+ {(isUpdate || error?.message) && (
+ <FieldFeedback
+ id="unix-linux-target-username-feedback"
+ description={isUpdate ? "Cannot be updated." : undefined}
+ error={error?.message}
+ />
+ )}
+ </Field>
)}
/>
{!isUpdate && rotationMethod === UnixLinuxLocalAccountRotationMethod.LoginAsTarget && (
<Controller
name="temporaryParameters.password"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- className="flex-1"
- isError={Boolean(error)}
- errorText={error?.message}
- label="Current Password"
- tooltipText="The current password of the target user. Required for initial rotation setup."
- >
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field className="flex-1" data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ htmlFor="unix-linux-current-password"
+ tooltip="The current password of the target user. Required for initial rotation setup."
+ >
+ Current Password
+ </FieldLabelWithTooltip>
<Input
+ ref={ref}
+ id="unix-linux-current-password"
value={value}
+ onBlur={onBlur}
onChange={onChange}
type="password"
placeholder="****************"
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
)}
</div>
- <div className="flex flex-col gap-3">
- <div className="w-full border-b border-mineshaft-600">
- <span className="text-sm text-mineshaft-300">Password Requirements</span>
- </div>
- <div className="grid grid-cols-2 gap-x-3 gap-y-1 rounded-sm border border-mineshaft-600 bg-mineshaft-700 px-3 pt-3">
- <Controller
- control={control}
- name="parameters.passwordRequirements.length"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.length}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Password Length"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="The length of the password to generate"
- >
- <Input
- type="number"
- min={1}
- max={250}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.digits"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.digits}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Digit Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of digits"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.lowercase"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.lowercase}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Lowercase Character Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of lowercase characters"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.uppercase"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.uppercase}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Uppercase Character Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of uppercase characters"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.symbols"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.symbols}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Symbol Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of symbols"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.allowedSymbols"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.allowedSymbols}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Allowed Symbols"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Symbols to use in generated password"
- >
- <Input
- placeholder="-_.~!*"
- size="sm"
- {...field}
- onChange={(e) => field.onChange(e.target.value)}
- />
- </FormControl>
- )}
- />
- </div>
- </div>
+ <PasswordRequirementsFields />
</>
);
};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/WindowsLocalAccountRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/WindowsLocalAccountRotationParametersFields.tsx
index 882e349be4..217a9bd741 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/WindowsLocalAccountRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/WindowsLocalAccountRotationParametersFields.tsx
@@ -1,11 +1,23 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { DEFAULT_PASSWORD_REQUIREMENTS } from "@app/components/secret-rotations-v2/forms/schemas/shared";
-import { FormControl, Input, Select, SelectItem } from "@app/components/v2";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import {
+ Field,
+ FieldError,
+ FieldFeedback,
+ Input,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue
+} from "@app/components/v3";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { WindowsLocalAccountRotationMethod } from "@app/hooks/api/secretRotationsV2/types/windows-local-account-rotation";
+import { PasswordRequirementsFields } from "./shared";
+
export const WindowsLocalAccountRotationParametersFields = () => {
const { control, watch, setValue } = useFormContext<
TSecretRotationV2Form & {
@@ -27,38 +39,30 @@ export const WindowsLocalAccountRotationParametersFields = () => {
control={control}
defaultValue={WindowsLocalAccountRotationMethod.LoginAsTarget}
render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- tooltipText={
- <>
- <span>Determines how the rotation will be performed:</span>
- <ul className="mt-2 ml-4 flex list-disc flex-col gap-2">
- <li>
- <span className="font-medium">Login as Root</span> - The SMB connection
- credentials of the app connection linked will be used to change the target
- user&#39;s password.
- </li>
- <li>
- <span className="font-medium">Login as Target</span> - The target user will
- authenticate with their own credentials and change their own password.
- </li>
- </ul>
- </>
- }
- tooltipClassName="max-w-sm"
- errorText={error?.message}
- isError={Boolean(error?.message)}
- label="Rotation Method"
- helperText={
- // eslint-disable-next-line no-nested-ternary
- isUpdate
- ? "Cannot be updated."
- : value === WindowsLocalAccountRotationMethod.LoginAsRoot
- ? "The SMB connection credentials will change the target user's password"
- : "The target user will change their own password"
- }
- >
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ tooltip={
+ <>
+ <span>Determines how the rotation will be performed:</span>
+ <ul className="mt-2 ml-4 flex list-disc flex-col gap-2">
+ <li>
+ <span className="font-medium">Login as Root</span> - The SMB connection
+ credentials of the app connection linked will be used to change the target
+ user&#39;s password.
+ </li>
+ <li>
+ <span className="font-medium">Login as Target</span> - The target user will
+ authenticate with their own credentials and change their own password.
+ </li>
+ </ul>
+ </>
+ }
+ tooltipClassName="max-w-sm"
+ >
+ Rotation Method
+ </FieldLabelWithTooltip>
<Select
- isDisabled={isUpdate}
+ disabled={isUpdate}
value={value}
onValueChange={(val) => {
setValue("temporaryParameters", {
@@ -66,200 +70,101 @@ export const WindowsLocalAccountRotationParametersFields = () => {
});
onChange(val);
}}
- className="w-full border border-mineshaft-500 capitalize"
- position="popper"
- dropdownContainerClassName="max-w-none"
>
- {Object.values(WindowsLocalAccountRotationMethod).map((method) => {
- return (
+ <SelectTrigger className="w-full capitalize" isError={Boolean(error)}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent position="popper" className="max-w-none">
+ {Object.values(WindowsLocalAccountRotationMethod).map((method) => (
<SelectItem value={method} className="capitalize" key={method}>
{method.replace(/-/g, " ")}
</SelectItem>
- );
- })}
+ ))}
+ </SelectContent>
</Select>
- </FormControl>
+ <FieldFeedback
+ id="windows-rotation-method-feedback"
+ description={
+ <>
+ {isUpdate && "Cannot be updated."}
+ {!isUpdate &&
+ value === WindowsLocalAccountRotationMethod.LoginAsRoot &&
+ "The SMB connection credentials will change the target user's password"}
+ {!isUpdate &&
+ value !== WindowsLocalAccountRotationMethod.LoginAsRoot &&
+ "The target user will change their own password"}
+ </>
+ }
+ error={error?.message}
+ />
+ </Field>
)}
/>
<div className="flex gap-3">
<Controller
name="parameters.username"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- className="flex-1"
- isError={Boolean(error)}
- errorText={error?.message}
- label="Target Username"
- tooltipText="The Windows username of the account to rotate the password for."
- tooltipClassName="max-w-sm"
- helperText={isUpdate ? "Cannot be updated." : undefined}
- >
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field className="flex-1" data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ htmlFor="windows-target-username"
+ tooltip="The Windows username of the account to rotate the password for."
+ tooltipClassName="max-w-sm"
+ >
+ Target Username
+ </FieldLabelWithTooltip>
<Input
- isDisabled={isUpdate}
+ ref={ref}
+ id="windows-target-username"
+ disabled={isUpdate}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder="appuser"
+ isError={Boolean(error)}
+ aria-describedby={
+ isUpdate || error?.message ? "windows-target-username-feedback" : undefined
+ }
/>
- </FormControl>
+ {(isUpdate || error?.message) && (
+ <FieldFeedback
+ id="windows-target-username-feedback"
+ description={isUpdate ? "Cannot be updated." : undefined}
+ error={error?.message}
+ />
+ )}
+ </Field>
)}
/>
{!isUpdate && rotationMethod === WindowsLocalAccountRotationMethod.LoginAsTarget && (
<Controller
name="temporaryParameters.password"
control={control}
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- className="flex-1"
- isError={Boolean(error)}
- errorText={error?.message}
- label="Current Password"
- tooltipText="The current password of the target user. Required for initial rotation setup."
- >
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field className="flex-1" data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip
+ htmlFor="windows-current-password"
+ tooltip="The current password of the target user. Required for initial rotation setup."
+ >
+ Current Password
+ </FieldLabelWithTooltip>
<Input
+ ref={ref}
+ id="windows-current-password"
value={value}
+ onBlur={onBlur}
onChange={onChange}
type="password"
placeholder="****************"
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
)}
</div>
- <div className="flex flex-col gap-3">
- <div className="w-full border-b border-mineshaft-600">
- <span className="text-sm text-mineshaft-300">Password Requirements</span>
- </div>
- <div className="grid grid-cols-2 gap-x-3 gap-y-1 rounded-sm border border-mineshaft-600 bg-mineshaft-700 px-3 pt-3">
- <Controller
- control={control}
- name="parameters.passwordRequirements.length"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.length}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Password Length"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="The length of the password to generate"
- >
- <Input
- type="number"
- min={1}
- max={250}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.digits"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.digits}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Digit Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of digits"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.lowercase"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.lowercase}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Lowercase Character Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of lowercase characters"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.uppercase"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.uppercase}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Uppercase Character Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of uppercase characters"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.symbols"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.symbols}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Symbol Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of symbols"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.allowedSymbols"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.allowedSymbols}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Allowed Symbols"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Symbols to use in generated password"
- >
- <Input
- placeholder="-_.~!*"
- size="sm"
- {...field}
- onChange={(e) => field.onChange(e.target.value)}
- />
- </FormControl>
- )}
- />
- </div>
- </div>
+ <PasswordRequirementsFields />
</>
);
};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/CloudflareIpListInput.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/CloudflareIpListInput.tsx
index 448a2b8b46..9208214f9b 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/CloudflareIpListInput.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/CloudflareIpListInput.tsx
@@ -1,7 +1,8 @@
import { useState } from "react";
import { Control, Controller, FieldPath, FieldValues } from "react-hook-form";
-import { FormControl, TextArea } from "@app/components/v2";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import { Field, FieldError, TextArea } from "@app/components/v3";
/**
* Textarea-backed editor for a list of IPs/CIDRs. The raw text lives in local state so partially
@@ -18,7 +19,6 @@ const CloudflareIpListInput = ({
return (
<TextArea
- reSize="none"
rows={4}
value={rawValue}
onChange={(e) => {
@@ -31,7 +31,7 @@ const CloudflareIpListInput = ({
);
}}
placeholder={"199.27.128.0/21\n2400:cb00::/32"}
- className="border-mineshaft-600 bg-mineshaft-900 font-mono text-sm"
+ className="resize-none bg-container font-mono text-sm"
/>
);
};
@@ -52,15 +52,13 @@ export const CloudflareIpListField = <T extends FieldValues>({
control={control}
name={name}
render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isOptional
- isError={Boolean(error)}
- errorText={error?.message}
- label={label}
- tooltipText={tooltipText}
- >
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip tooltip={tooltipText}>
+ {label} <span className="font-normal text-muted">(optional)</span>
+ </FieldLabelWithTooltip>
<CloudflareIpListInput value={value} onChange={onChange} />
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/CreateUserStatementAlert.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/CreateUserStatementAlert.tsx
new file mode 100644
index 0000000000..80992a1d80
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/CreateUserStatementAlert.tsx
@@ -0,0 +1,63 @@
+import { ClipboardCheckIcon, CopyIcon, InfoIcon } from "lucide-react";
+
+import {
+ Alert,
+ AlertDescription,
+ AlertTitle,
+ IconButton,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
+import { useTimedReset } from "@app/hooks";
+
+type Props = {
+ statement: string;
+};
+
+export const CreateUserStatementAlert = ({ statement }: Props) => {
+ const [, isCopied, setCopyState] = useTimedReset({ initialState: false });
+
+ const handleCopy = () => {
+ navigator.clipboard.writeText(statement);
+ setCopyState(true);
+ };
+
+ return (
+ <Alert variant="info">
+ <InfoIcon />
+ <AlertTitle>Example Create User Statement</AlertTitle>
+ <AlertDescription className="gap-3">
+ <p>Infisical requires two database users to be created for rotation.</p>
+ <p>
+ These users are intended to be solely managed by Infisical. Altering their login after
+ rotation may cause unexpected failure.
+ </p>
+ <p>
+ Below is an example statement for creating the required users. You may need to modify it
+ to suit your needs.
+ </p>
+ <div className="relative w-full">
+ <pre className="max-h-48 overflow-auto rounded-md border border-border bg-background p-3 pr-10 font-mono text-sm break-words whitespace-pre-wrap text-foreground">
+ {statement}
+ </pre>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <IconButton
+ type="button"
+ variant="ghost"
+ size="xs"
+ className="absolute top-2 right-2 text-muted hover:text-foreground"
+ aria-label={isCopied ? "Copied" : "Copy statement"}
+ onClick={handleCopy}
+ >
+ {isCopied ? <ClipboardCheckIcon /> : <CopyIcon />}
+ </IconButton>
+ </TooltipTrigger>
+ <TooltipContent>{isCopied ? "Copied" : "Copy statement"}</TooltipContent>
+ </Tooltip>
+ </div>
+ </AlertDescription>
+ </Alert>
+ );
+};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/PasswordRequirementsFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/PasswordRequirementsFields.tsx
new file mode 100644
index 0000000000..f0318f2a90
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/PasswordRequirementsFields.tsx
@@ -0,0 +1,142 @@
+import { Controller, useFormContext } from "react-hook-form";
+
+import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import { Field, FieldError, FieldLegend, FieldSet, Input } from "@app/components/v3";
+
+import { DEFAULT_PASSWORD_REQUIREMENTS, TPasswordRequirements } from "../../schemas/shared";
+
+type Props = {
+ defaultRequirements?: Omit<TPasswordRequirements, "allowedSymbols"> & {
+ allowedSymbols?: string;
+ };
+};
+
+export const PasswordRequirementsFields = ({
+ defaultRequirements = DEFAULT_PASSWORD_REQUIREMENTS
+}: Props) => {
+ const { control } = useFormContext<TSecretRotationV2Form>();
+
+ return (
+ <FieldSet className="gap-3">
+ <FieldLegend variant="label">Password Requirements</FieldLegend>
+ <div className="grid grid-cols-2 gap-x-3 gap-y-4">
+ <Controller
+ control={control}
+ name="parameters.passwordRequirements.length"
+ defaultValue={defaultRequirements.length}
+ render={({ field, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip tooltip="The length of the password to generate">
+ Password Length
+ </FieldLabelWithTooltip>
+ <Input
+ type="number"
+ min={1}
+ max={250}
+ {...field}
+ isError={Boolean(error)}
+ onChange={(event) => field.onChange(Number(event.target.value))}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="parameters.passwordRequirements.required.digits"
+ defaultValue={defaultRequirements.required.digits}
+ render={({ field, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip tooltip="Minimum number of digits">
+ Digit Count
+ </FieldLabelWithTooltip>
+ <Input
+ type="number"
+ min={0}
+ {...field}
+ isError={Boolean(error)}
+ onChange={(event) => field.onChange(Number(event.target.value))}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="parameters.passwordRequirements.required.lowercase"
+ defaultValue={defaultRequirements.required.lowercase}
+ render={({ field, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip tooltip="Minimum number of lowercase characters">
+ Lowercase Character Count
+ </FieldLabelWithTooltip>
+ <Input
+ type="number"
+ min={0}
+ {...field}
+ isError={Boolean(error)}
+ onChange={(event) => field.onChange(Number(event.target.value))}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="parameters.passwordRequirements.required.uppercase"
+ defaultValue={defaultRequirements.required.uppercase}
+ render={({ field, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip tooltip="Minimum number of uppercase characters">
+ Uppercase Character Count
+ </FieldLabelWithTooltip>
+ <Input
+ type="number"
+ min={0}
+ {...field}
+ isError={Boolean(error)}
+ onChange={(event) => field.onChange(Number(event.target.value))}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="parameters.passwordRequirements.required.symbols"
+ defaultValue={defaultRequirements.required.symbols}
+ render={({ field, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip tooltip="Minimum number of symbols">
+ Symbol Count
+ </FieldLabelWithTooltip>
+ <Input
+ type="number"
+ min={0}
+ {...field}
+ isError={Boolean(error)}
+ onChange={(event) => field.onChange(Number(event.target.value))}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="parameters.passwordRequirements.allowedSymbols"
+ defaultValue={defaultRequirements.allowedSymbols}
+ render={({ field, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip tooltip="Symbols to use in generated password">
+ Allowed Symbols
+ </FieldLabelWithTooltip>
+ <Input placeholder="-_.~!*" {...field} isError={Boolean(error)} />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ </div>
+ </FieldSet>
+ );
+};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/SqlCredentialsRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/SqlCredentialsRotationParametersFields.tsx
index 4474de14c1..d90926fe32 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/SqlCredentialsRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/SqlCredentialsRotationParametersFields.tsx
@@ -1,12 +1,19 @@
import { Controller, useFormContext } from "react-hook-form";
-import { ClipboardCheckIcon, CopyIcon } from "lucide-react";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
import { ValidationRuleOverrideNotice } from "@app/components/secret-validation/ValidationRuleOverrideNotice";
-import { FormControl, Input, Tab, TabList, TabPanel, Tabs, TextArea } from "@app/components/v2";
-import { NoticeBannerV2 } from "@app/components/v2/NoticeBannerV2/NoticeBannerV2";
-import { IconButton, Tooltip, TooltipContent, TooltipTrigger } from "@app/components/v3";
-import { useTimedReset } from "@app/hooks";
+import {
+ Field,
+ FieldError,
+ FieldFeedback,
+ Input,
+ Tabs,
+ TabsContent,
+ TabsList,
+ TabsTrigger,
+ TextArea
+} from "@app/components/v3";
import { AppConnection } from "@app/hooks/api/appConnections/enums";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import {
@@ -15,6 +22,8 @@ import {
} from "@app/hooks/api/secretValidationRules";
import { DEFAULT_PASSWORD_REQUIREMENTS } from "../../schemas/shared";
+import { CreateUserStatementAlert } from "./CreateUserStatementAlert";
+import { PasswordRequirementsFields } from "./PasswordRequirementsFields";
enum ParameterTab {
Statement = "statement",
@@ -33,273 +42,113 @@ export const SqlCredentialsRotationParametersFields = () => {
const type = watch("type");
const { rotationOption } = useSecretRotationV2Option(type);
- const [, isCopied, setCopyState] = useTimedReset({ initialState: false });
const environmentSlug = watch("environment")?.slug;
const secretPath = watch("secretPath");
- const handleCopy = () => {
- navigator.clipboard.writeText(rotationOption!.template.createUserStatement);
- setCopyState(true);
- };
-
return (
<Tabs defaultValue={ParameterTab.Statement}>
- <TabList className="border-b border-mineshaft-500">
- <Tab value={ParameterTab.Statement}>General</Tab>
- <Tab value={ParameterTab.Advanced}>Advanced</Tab>
- </TabList>
- <TabPanel value={ParameterTab.Statement}>
+ <TabsList variant="project" className="w-full justify-start">
+ <TabsTrigger value={ParameterTab.Statement}>General</TabsTrigger>
+ <TabsTrigger value={ParameterTab.Advanced}>Advanced</TabsTrigger>
+ </TabsList>
+ <TabsContent value={ParameterTab.Statement} className="space-y-4">
<div className="flex items-start gap-x-2">
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Database Username 1"
- className="flex-1"
- >
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field className="flex-1" data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip htmlFor="sql-username-1">
+ Database Username 1
+ </FieldLabelWithTooltip>
<Input
+ ref={ref}
+ id="sql-username-1"
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={
rotationOption.connection === AppConnection.OracleDB
? "INFISICAL_USER_1"
: "infisical_user_1"
}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="parameters.username1"
/>
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Database Username 2"
- className="flex-1"
- >
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field className="flex-1" data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip htmlFor="sql-username-2">
+ Database Username 2
+ </FieldLabelWithTooltip>
<Input
+ ref={ref}
+ id="sql-username-2"
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={
rotationOption.connection === AppConnection.OracleDB
? "INFISICAL_USER_2"
: "infisical_user_2"
}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="parameters.username2"
/>
</div>
- <NoticeBannerV2 title="Example Create User Statement">
- <p className="mb-3 text-sm text-mineshaft-300">
- Infisical requires two database users to be created for rotation.
- </p>
- <p className="mb-3 text-sm text-mineshaft-300">
- These users are intended to be solely managed by Infisical. Altering their login after
- rotation may cause unexpected failure.
- </p>
- <p className="mb-3 text-sm text-mineshaft-300">
- Below is an example statement for creating the required users. You may need to modify it
- to suit your needs.
- </p>
- <div className="relative mb-3">
- <pre className="max-h-[10vh] overflow-auto rounded-sm border border-mineshaft-700 bg-mineshaft-800 p-2 pr-9 text-sm break-words whitespace-pre-wrap text-mineshaft-300">
- {rotationOption!.template.createUserStatement}
- </pre>
- <Tooltip>
- <TooltipTrigger asChild>
- <IconButton
- variant="ghost"
- size="xs"
- className="absolute top-1.5 right-1.5 text-mineshaft-300 hover:text-mineshaft-100"
- onClick={handleCopy}
- >
- {isCopied ? (
- <ClipboardCheckIcon className="size-3.5" />
- ) : (
- <CopyIcon className="size-3.5" />
- )}
- </IconButton>
- </TooltipTrigger>
- <TooltipContent>{isCopied ? "Copied!" : "Copy"}</TooltipContent>
- </Tooltip>
- </div>
- </NoticeBannerV2>
- </TabPanel>
- <TabPanel value={ParameterTab.Advanced}>
+ <CreateUserStatementAlert statement={rotationOption!.template.createUserStatement} />
+ </TabsContent>
+ <TabsContent value={ParameterTab.Advanced} className="space-y-4">
<Controller
control={control}
name="parameters.rotationStatement"
defaultValue={rotationOption?.template?.rotationStatement}
render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Rotation Statement"
- isError={Boolean(error?.message)}
- errorText={error?.message}
- helperText="username, password and database are dynamically provisioned"
- >
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip>Rotation Statement</FieldLabelWithTooltip>
<TextArea
{...field}
- reSize="none"
+ className="resize-none text-sm"
rows={3}
- className="border-mineshaft-600 bg-mineshaft-900 text-sm"
+ isError={Boolean(error)}
+ aria-describedby="sql-rotation-statement-feedback"
/>
- </FormControl>
+ <FieldFeedback
+ id="sql-rotation-statement-feedback"
+ description="username, password and database are dynamically provisioned"
+ error={error?.message}
+ />
+ </Field>
)}
/>
- <div className="flex flex-col gap-3">
- {type === SecretRotation.PostgresCredentials && (
- <ValidationRuleOverrideNotice
- type={SecretValidationRuleType.SecretRotations}
- provider={SecretRotationRuleProvider.PostgresCredentials}
- environmentSlug={environmentSlug}
- secretPath={secretPath}
- />
- )}
- <div className="w-full border-b border-mineshaft-600">
- <span className="text-sm text-mineshaft-300">Password Requirements</span>
- </div>
- <div className="grid grid-cols-2 gap-x-3 gap-y-1 rounded-sm border border-mineshaft-600 bg-mineshaft-700 px-3 pt-3">
- <Controller
- control={control}
- name="parameters.passwordRequirements.length"
- defaultValue={
- // for oracle 48 would throw error
- type === SecretRotation.OracleDBCredentials
- ? 30
- : DEFAULT_PASSWORD_REQUIREMENTS.length
- }
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Password Length"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="The length of the password to generate"
- >
- <Input
- type="number"
- min={1}
- max={250}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.digits"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.digits}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Digit Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of digits"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.lowercase"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.lowercase}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Lowercase Character Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of lowercase characters"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.uppercase"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.uppercase}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Uppercase Character Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of uppercase characters"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.symbols"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.symbols}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Symbol Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of symbols"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.allowedSymbols"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.allowedSymbols}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Allowed Symbols"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Symbols to use in generated password"
- >
- <Input
- placeholder="-_.~!*"
- size="sm"
- {...field}
- onChange={(e) => field.onChange(e.target.value)}
- />
- </FormControl>
- )}
- />
- </div>
- </div>
- </TabPanel>
+ {type === SecretRotation.PostgresCredentials && (
+ <ValidationRuleOverrideNotice
+ type={SecretValidationRuleType.SecretRotations}
+ provider={SecretRotationRuleProvider.PostgresCredentials}
+ environmentSlug={environmentSlug}
+ secretPath={secretPath}
+ />
+ )}
+ <PasswordRequirementsFields
+ defaultRequirements={{
+ ...DEFAULT_PASSWORD_REQUIREMENTS,
+ // Oracle limits generated passwords to 30 characters.
+ length:
+ type === SecretRotation.OracleDBCredentials
+ ? 30
+ : DEFAULT_PASSWORD_REQUIREMENTS.length
+ }}
+ />
+ </TabsContent>
</Tabs>
);
};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/index.ts b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/index.ts
index e99df7e026..bce65dffc8 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/index.ts
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/index.ts
@@ -1,2 +1,4 @@
export * from "./CloudflareIpListInput";
+export * from "./CreateUserStatementAlert";
+export * from "./PasswordRequirementsFields";
export * from "./SqlCredentialsRotationParametersFields";
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/Auth0ClientSecretRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/Auth0ClientSecretRotationReviewFields.tsx
index 4bc09448b7..ebde998a60 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/Auth0ClientSecretRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/Auth0ClientSecretRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { SecretRotationReviewSection } from "./shared";
@@ -18,11 +18,11 @@ export const Auth0ClientSecretRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="Client ID">{parameters.clientId}</GenericFieldLabel>
+ <ReviewField label="Client ID">{parameters.clientId}</ReviewField>
</SecretRotationReviewSection>
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="Client ID">{clientId}</GenericFieldLabel>
- <GenericFieldLabel label="Client Secret">{clientSecret}</GenericFieldLabel>
+ <ReviewField label="Client ID">{clientId}</ReviewField>
+ <ReviewField label="Client Secret">{clientSecret}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/AwsIamUserSecretRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/AwsIamUserSecretRotationReviewFields.tsx
index d84c0753fd..821fc18f3c 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/AwsIamUserSecretRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/AwsIamUserSecretRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { SecretRotationReviewSection } from "./shared";
@@ -18,12 +18,12 @@ export const AwsIamUserSecretRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="Region">{parameters.region}</GenericFieldLabel>
- <GenericFieldLabel label="User Name">{parameters.userName}</GenericFieldLabel>
+ <ReviewField label="Region">{parameters.region}</ReviewField>
+ <ReviewField label="User Name">{parameters.userName}</ReviewField>
</SecretRotationReviewSection>
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="Secret Access Key ID">{accessKeyId}</GenericFieldLabel>
- <GenericFieldLabel label="Secret Access Key">{secretAccessKey}</GenericFieldLabel>
+ <ReviewField label="Secret Access Key ID">{accessKeyId}</ReviewField>
+ <ReviewField label="Secret Access Key">{secretAccessKey}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/AzureClientSecretRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/AzureClientSecretRotationReviewFields.tsx
index 9770d14a43..652f245167 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/AzureClientSecretRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/AzureClientSecretRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { SecretRotationReviewSection } from "./shared";
@@ -18,12 +18,12 @@ export const AzureClientSecretRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="App Name">{parameters.appName}</GenericFieldLabel>
- <GenericFieldLabel label="App ID">{parameters.objectId}</GenericFieldLabel>
+ <ReviewField label="App Name">{parameters.appName}</ReviewField>
+ <ReviewField label="App ID">{parameters.objectId}</ReviewField>
</SecretRotationReviewSection>
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="Client ID">{clientId}</GenericFieldLabel>
- <GenericFieldLabel label="Client Secret">{clientSecret}</GenericFieldLabel>
+ <ReviewField label="Client ID">{clientId}</ReviewField>
+ <ReviewField label="Client Secret">{clientSecret}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/CloudflareApiTokenRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/CloudflareApiTokenRotationReviewFields.tsx
index 2a019324c8..bea03cdb53 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/CloudflareApiTokenRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/CloudflareApiTokenRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { z } from "zod";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { Badge } from "@app/components/v3";
import {
useCloudflareConnectionListPermissionGroups,
@@ -53,34 +53,30 @@ export const CloudflareApiTokenRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="Token Name">{parameters.name}</GenericFieldLabel>
+ <ReviewField label="Token Name">{parameters.name}</ReviewField>
<div className="grid grid-cols-2 gap-2">
{parameters.policies.map((policy, i) => (
- <GenericFieldLabel key={`policy-${i + 1}`} label={`Policy ${i + 1}`}>
+ <ReviewField key={`policy-${i + 1}`} label={`Policy ${i + 1}`}>
<div className="flex flex-wrap items-center gap-2">
<span>{CLOUDFLARE_POLICY_EFFECT_MAP[policy.effect]}</span>
<Badge variant="neutral">{getScopeLabel(policy.scope, policy.zoneIds)}</Badge>
- <span className="text-mineshaft-300">
+ <span className="text-muted">
{getPermissionGroupLabel(policy.permissionGroupId)}
</span>
</div>
- </GenericFieldLabel>
+ </ReviewField>
))}
</div>
{Boolean(parameters.allowedIps?.length) && (
- <GenericFieldLabel label="Allowed IPs">
- {parameters.allowedIps?.join(", ")}
- </GenericFieldLabel>
+ <ReviewField label="Allowed IPs">{parameters.allowedIps?.join(", ")}</ReviewField>
)}
{Boolean(parameters.disallowedIps?.length) && (
- <GenericFieldLabel label="Disallowed IPs">
- {parameters.disallowedIps?.join(", ")}
- </GenericFieldLabel>
+ <ReviewField label="Disallowed IPs">{parameters.disallowedIps?.join(", ")}</ReviewField>
)}
</SecretRotationReviewSection>
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="Token ID">{tokenId}</GenericFieldLabel>
- <GenericFieldLabel label="API Token">{apiToken}</GenericFieldLabel>
+ <ReviewField label="Token ID">{tokenId}</ReviewField>
+ <ReviewField label="API Token">{apiToken}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/CloudflareR2AccessKeyRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/CloudflareR2AccessKeyRotationReviewFields.tsx
index 90fd1b283f..6654e9ef45 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/CloudflareR2AccessKeyRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/CloudflareR2AccessKeyRotationReviewFields.tsx
@@ -1,6 +1,6 @@
import { useFormContext } from "react-hook-form";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { Badge } from "@app/components/v3";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
@@ -24,8 +24,8 @@ export const CloudflareR2AccessKeyRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="Token Name">{parameters.name}</GenericFieldLabel>
- <GenericFieldLabel label="Buckets">
+ <ReviewField label="Token Name">{parameters.name}</ReviewField>
+ <ReviewField label="Buckets">
<div className="flex flex-wrap items-center gap-2">
{parameters.buckets.map((bucket) => (
<Badge key={r2BucketKey(bucket)} variant="neutral">
@@ -33,24 +33,20 @@ export const CloudflareR2AccessKeyRotationReviewFields = () => {
</Badge>
))}
</div>
- </GenericFieldLabel>
- <GenericFieldLabel label="Access Level">
+ </ReviewField>
+ <ReviewField label="Access Level">
{CLOUDFLARE_R2_ACCESS_LEVEL_MAP[parameters.accessLevel]}
- </GenericFieldLabel>
+ </ReviewField>
{Boolean(parameters.allowedIps?.length) && (
- <GenericFieldLabel label="Allowed IPs">
- {parameters.allowedIps?.join(", ")}
- </GenericFieldLabel>
+ <ReviewField label="Allowed IPs">{parameters.allowedIps?.join(", ")}</ReviewField>
)}
{Boolean(parameters.disallowedIps?.length) && (
- <GenericFieldLabel label="Disallowed IPs">
- {parameters.disallowedIps?.join(", ")}
- </GenericFieldLabel>
+ <ReviewField label="Disallowed IPs">{parameters.disallowedIps?.join(", ")}</ReviewField>
)}
</SecretRotationReviewSection>
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="Access Key ID">{accessKeyId}</GenericFieldLabel>
- <GenericFieldLabel label="Secret Access Key">{secretAccessKey}</GenericFieldLabel>
+ <ReviewField label="Access Key ID">{accessKeyId}</ReviewField>
+ <ReviewField label="Secret Access Key">{secretAccessKey}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/ConvexAccessKeyRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/ConvexAccessKeyRotationReviewFields.tsx
index fa42790583..7fbbac6168 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/ConvexAccessKeyRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/ConvexAccessKeyRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { SecretRotationReviewSection } from "./shared";
@@ -18,10 +18,10 @@ export const ConvexAccessKeyRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="Name Prefix">{parameters.namePrefix}</GenericFieldLabel>
+ <ReviewField label="Name Prefix">{parameters.namePrefix}</ReviewField>
</SecretRotationReviewSection>
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="Access Key">{accessKey}</GenericFieldLabel>
+ <ReviewField label="Access Key">{accessKey}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatabricksServiceAccountSecretRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatabricksServiceAccountSecretRotationReviewFields.tsx
index e3f5f88400..ab8615e36e 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatabricksServiceAccountSecretRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatabricksServiceAccountSecretRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { SecretRotationReviewSection } from "./shared";
@@ -18,16 +18,14 @@ export const DatabricksServicePrincipalSecretRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="Service Principal">
+ <ReviewField label="Service Principal">
{parameters.servicePrincipalName || parameters.servicePrincipalId}
- </GenericFieldLabel>
- {parameters.clientId && (
- <GenericFieldLabel label="Client ID">{parameters.clientId}</GenericFieldLabel>
- )}
+ </ReviewField>
+ {parameters.clientId && <ReviewField label="Client ID">{parameters.clientId}</ReviewField>}
</SecretRotationReviewSection>
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="Client ID">{clientId}</GenericFieldLabel>
- <GenericFieldLabel label="Client Secret">{clientSecret}</GenericFieldLabel>
+ <ReviewField label="Client ID">{clientId}</ReviewField>
+ <ReviewField label="Client Secret">{clientSecret}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatabricksServicePrincipalSecretRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatabricksServicePrincipalSecretRotationReviewFields.tsx
index e3f5f88400..ab8615e36e 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatabricksServicePrincipalSecretRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatabricksServicePrincipalSecretRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { SecretRotationReviewSection } from "./shared";
@@ -18,16 +18,14 @@ export const DatabricksServicePrincipalSecretRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="Service Principal">
+ <ReviewField label="Service Principal">
{parameters.servicePrincipalName || parameters.servicePrincipalId}
- </GenericFieldLabel>
- {parameters.clientId && (
- <GenericFieldLabel label="Client ID">{parameters.clientId}</GenericFieldLabel>
- )}
+ </ReviewField>
+ {parameters.clientId && <ReviewField label="Client ID">{parameters.clientId}</ReviewField>}
</SecretRotationReviewSection>
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="Client ID">{clientId}</GenericFieldLabel>
- <GenericFieldLabel label="Client Secret">{clientSecret}</GenericFieldLabel>
+ <ReviewField label="Client ID">{clientId}</ReviewField>
+ <ReviewField label="Client Secret">{clientSecret}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatadogApiKeyRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatadogApiKeyRotationReviewFields.tsx
index 8bf7fe0c88..98830b5946 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatadogApiKeyRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatadogApiKeyRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { SecretRotationReviewSection } from "./shared";
@@ -18,11 +18,11 @@ export const DatadogApiKeyRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="Key Name">{name}</GenericFieldLabel>
+ <ReviewField label="Key Name">{name}</ReviewField>
</SecretRotationReviewSection>
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="API Key ID">{apiKeyId}</GenericFieldLabel>
- <GenericFieldLabel label="API Key">{apiKey}</GenericFieldLabel>
+ <ReviewField label="API Key ID">{apiKeyId}</ReviewField>
+ <ReviewField label="API Key">{apiKey}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatadogApplicationKeySecretRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatadogApplicationKeySecretRotationReviewFields.tsx
index c1540a553d..32873cb9a8 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatadogApplicationKeySecretRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatadogApplicationKeySecretRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { SecretRotationReviewSection } from "./shared";
@@ -21,13 +21,11 @@ export const DatadogApplicationKeySecretRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="Service Account ID">
- {parameters.serviceAccountId}
- </GenericFieldLabel>
+ <ReviewField label="Service Account ID">{parameters.serviceAccountId}</ReviewField>
</SecretRotationReviewSection>
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="Application Key ID">{applicationKeyId}</GenericFieldLabel>
- <GenericFieldLabel label="Application Key">{applicationKey}</GenericFieldLabel>
+ <ReviewField label="Application Key ID">{applicationKeyId}</ReviewField>
+ <ReviewField label="Application Key">{applicationKey}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DbtServiceTokenRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DbtServiceTokenRotationReviewFields.tsx
index 0d3bbcd7bb..e967895d38 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DbtServiceTokenRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DbtServiceTokenRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { Badge } from "@app/components/v3";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
@@ -22,19 +22,19 @@ export const DbtServiceTokenRotationReviewFields = () => {
<SecretRotationReviewSection label="Parameters">
<div className="grid grid-cols-2 gap-2">
{parameters.permissionGrants.map((grant, i) => (
- <GenericFieldLabel key={`grant-${i + 1}`} label={`Permission Grant ${i + 1}`}>
+ <ReviewField key={`grant-${i + 1}`} label={`Permission Grant ${i + 1}`}>
<div className="flex items-center gap-2">
<span>{DBT_PERMISSION_SET_MAP[grant.permissionSet].label}</span>
<Badge variant={grant.projectId ? "neutral" : "info"}>
{grant.projectId ? `Project: ${grant.projectId}` : "All Projects"}
</Badge>
</div>
- </GenericFieldLabel>
+ </ReviewField>
))}
</div>
</SecretRotationReviewSection>
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="Service Token">{serviceToken}</GenericFieldLabel>
+ <ReviewField label="Service Token">{serviceToken}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/FireworksApiKeyRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/FireworksApiKeyRotationReviewFields.tsx
index ec0eec66f8..5e683f2c19 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/FireworksApiKeyRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/FireworksApiKeyRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { SecretRotationReviewSection } from "./shared";
@@ -18,12 +18,10 @@ export const FireworksApiKeyRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="Service Account">
- {parameters.serviceAccountUserId}
- </GenericFieldLabel>
+ <ReviewField label="Service Account">{parameters.serviceAccountUserId}</ReviewField>
</SecretRotationReviewSection>
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="API Key">{apiKey}</GenericFieldLabel>
+ <ReviewField label="API Key">{apiKey}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/HpIloRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/HpIloRotationReviewFields.tsx
index 529b04e6f2..6e6645e2e8 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/HpIloRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/HpIloRotationReviewFields.tsx
@@ -1,8 +1,11 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+import { SecretRotationReviewSection } from "./shared";
+
export const HpIloRotationReviewFields = () => {
const { watch } = useFormContext<
TSecretRotationV2Form & {
@@ -14,46 +17,20 @@ export const HpIloRotationReviewFields = () => {
const secretsMapping = watch("secretsMapping");
return (
- <div className="flex flex-col gap-4">
- <div>
- <h3 className="mb-2 text-sm font-semibold text-mineshaft-200">Parameters</h3>
- <div className="rounded-md border border-mineshaft-600 bg-mineshaft-800 p-3">
- <div className="grid grid-cols-2 gap-3">
- <div>
- <p className="text-xs text-mineshaft-400">Username</p>
- <p className="text-sm text-mineshaft-100">{parameters.username}</p>
- </div>
- <div>
- <p className="text-xs text-mineshaft-400">Rotation Method</p>
- <p className="text-sm text-mineshaft-100 capitalize">
- {parameters.rotationMethod?.replace(/-/g, " ") || "Login as target"}
- </p>
- </div>
- <div>
- <p className="text-xs text-mineshaft-400">Password Length</p>
- <p className="text-sm text-mineshaft-100">
- {parameters.passwordRequirements?.length || 32} characters
- </p>
- </div>
- </div>
- </div>
- </div>
-
- <div>
- <h3 className="mb-2 text-sm font-semibold text-mineshaft-200">Secrets Mapping</h3>
- <div className="rounded-md border border-mineshaft-600 bg-mineshaft-800 p-3">
- <div className="grid grid-cols-2 gap-3">
- <div>
- <p className="text-xs text-mineshaft-400">Username Key</p>
- <p className="text-sm text-mineshaft-100">{secretsMapping.username}</p>
- </div>
- <div>
- <p className="text-xs text-mineshaft-400">Password Key</p>
- <p className="text-sm text-mineshaft-100">{secretsMapping.password}</p>
- </div>
- </div>
- </div>
- </div>
- </div>
+ <>
+ <SecretRotationReviewSection label="Parameters">
+ <ReviewField label="Username">{parameters.username}</ReviewField>
+ <ReviewField label="Rotation Method">
+ {parameters.rotationMethod?.replace(/-/g, " ") || "Login as target"}
+ </ReviewField>
+ <ReviewField label="Password Length">
+ {parameters.passwordRequirements?.length || 32} characters
+ </ReviewField>
+ </SecretRotationReviewSection>
+ <SecretRotationReviewSection label="Secrets Mapping">
+ <ReviewField label="Username Key">{secretsMapping.username}</ReviewField>
+ <ReviewField label="Password Key">{secretsMapping.password}</ReviewField>
+ </SecretRotationReviewSection>
+ </>
);
};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/LdapPasswordRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/LdapPasswordRotationReviewFields.tsx
index 586bc87b18..a3d5bf72d0 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/LdapPasswordRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/LdapPasswordRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { SecretRotationReviewSection } from "./shared";
@@ -20,31 +20,25 @@ export const LdapPasswordRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="DN/UPN">{parameters.dn}</GenericFieldLabel>
+ <ReviewField label="DN/UPN">{parameters.dn}</ReviewField>
</SecretRotationReviewSection>
{passwordRequirements && (
<SecretRotationReviewSection label="Password Requirements">
- <GenericFieldLabel label="Length">{passwordRequirements.length}</GenericFieldLabel>
- <GenericFieldLabel label="Minimum Digits">
- {passwordRequirements.required.digits}
- </GenericFieldLabel>
- <GenericFieldLabel label="Minimum Lowercase Characters">
+ <ReviewField label="Length">{passwordRequirements.length}</ReviewField>
+ <ReviewField label="Minimum Digits">{passwordRequirements.required.digits}</ReviewField>
+ <ReviewField label="Minimum Lowercase Characters">
{passwordRequirements.required.lowercase}
- </GenericFieldLabel>
- <GenericFieldLabel label="Minimum Uppercase Characters">
+ </ReviewField>
+ <ReviewField label="Minimum Uppercase Characters">
{passwordRequirements.required.uppercase}
- </GenericFieldLabel>
- <GenericFieldLabel label="Minimum Symbols">
- {passwordRequirements.required.symbols}
- </GenericFieldLabel>
- <GenericFieldLabel label="Allowed Symbols">
- {passwordRequirements.allowedSymbols}
- </GenericFieldLabel>
+ </ReviewField>
+ <ReviewField label="Minimum Symbols">{passwordRequirements.required.symbols}</ReviewField>
+ <ReviewField label="Allowed Symbols">{passwordRequirements.allowedSymbols}</ReviewField>
</SecretRotationReviewSection>
)}
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="DN/UPN">{dn}</GenericFieldLabel>
- <GenericFieldLabel label="Password">{password}</GenericFieldLabel>
+ <ReviewField label="DN/UPN">{dn}</ReviewField>
+ <ReviewField label="Password">{password}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/LiteLLMApiKeyRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/LiteLLMApiKeyRotationReviewFields.tsx
index 17ca18fb5b..46609b6e60 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/LiteLLMApiKeyRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/LiteLLMApiKeyRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { SecretRotationReviewSection } from "./shared";
@@ -21,22 +21,22 @@ export const LiteLLMApiKeyRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="Key Name">{name}</GenericFieldLabel>
- {userId && <GenericFieldLabel label="User">{userId}</GenericFieldLabel>}
- {teamId && <GenericFieldLabel label="Team">{teamId}</GenericFieldLabel>}
+ <ReviewField label="Key Name">{name}</ReviewField>
+ {userId && <ReviewField label="User">{userId}</ReviewField>}
+ {teamId && <ReviewField label="Team">{teamId}</ReviewField>}
{models && models.length > 0 && (
- <GenericFieldLabel label="Models">{models.join(", ")}</GenericFieldLabel>
+ <ReviewField label="Models">{models.join(", ")}</ReviewField>
)}
- <GenericFieldLabel label="Additional Options" className="w-full">
+ <ReviewField label="Additional Options" className="w-full">
{additionalOptions ? (
- <span className="mt-1 block max-h-40 overflow-auto rounded-sm border border-mineshaft-600 bg-mineshaft-900 p-2 font-mono text-xs break-words whitespace-pre-wrap text-mineshaft-200">
+ <span className="mt-1 block max-h-40 overflow-auto rounded-sm border border-border bg-container p-2 font-mono text-xs break-words whitespace-pre-wrap text-foreground">
{additionalOptions}
</span>
) : undefined}
- </GenericFieldLabel>
+ </ReviewField>
</SecretRotationReviewSection>
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="API Key">{apiKey}</GenericFieldLabel>
+ <ReviewField label="API Key">{apiKey}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/OktaClientSecretRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/OktaClientSecretRotationReviewFields.tsx
index a9fc4068ec..767cc906c3 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/OktaClientSecretRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/OktaClientSecretRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { SecretRotationReviewSection } from "./shared";
@@ -18,11 +18,11 @@ export const OktaClientSecretRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="App ID">{parameters.clientId}</GenericFieldLabel>
+ <ReviewField label="App ID">{parameters.clientId}</ReviewField>
</SecretRotationReviewSection>
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="Client ID">{clientId}</GenericFieldLabel>
- <GenericFieldLabel label="Client Secret">{clientSecret}</GenericFieldLabel>
+ <ReviewField label="Client ID">{clientId}</ReviewField>
+ <ReviewField label="Client Secret">{clientSecret}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/OpenAIServiceAccountRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/OpenAIServiceAccountRotationReviewFields.tsx
index 1eacbd6465..69b1db7db0 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/OpenAIServiceAccountRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/OpenAIServiceAccountRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { SecretRotationReviewSection } from "./shared";
@@ -18,11 +18,11 @@ export const OpenAIServiceAccountRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="Project ID">{parameters.projectId}</GenericFieldLabel>
- <GenericFieldLabel label="Service Account Name">{parameters.name}</GenericFieldLabel>
+ <ReviewField label="Project ID">{parameters.projectId}</ReviewField>
+ <ReviewField label="Service Account Name">{parameters.name}</ReviewField>
</SecretRotationReviewSection>
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="API Key">{apiKey}</GenericFieldLabel>
+ <ReviewField label="API Key">{apiKey}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/OpenRouterApiKeyRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/OpenRouterApiKeyRotationReviewFields.tsx
index 03143902e7..99ed4f7c19 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/OpenRouterApiKeyRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/OpenRouterApiKeyRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { SecretRotationReviewSection } from "./shared";
@@ -24,23 +24,23 @@ export const OpenRouterApiKeyRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="Key Name">{parameters.name}</GenericFieldLabel>
+ <ReviewField label="Key Name">{parameters.name}</ReviewField>
{parameters.limit != null && (
- <GenericFieldLabel label="Credit Limit">${parameters.limit} USD</GenericFieldLabel>
+ <ReviewField label="Credit Limit">${parameters.limit} USD</ReviewField>
)}
{parameters.limitReset && (
- <GenericFieldLabel label="Reset Limit">
+ <ReviewField label="Reset Limit">
{LIMIT_RESET_LABELS[parameters.limitReset] || parameters.limitReset}
- </GenericFieldLabel>
+ </ReviewField>
)}
{parameters.includeByokInLimit != null && (
- <GenericFieldLabel label="Include BYOK in limit">
+ <ReviewField label="Include BYOK in limit">
{parameters.includeByokInLimit ? "Yes" : "No"}
- </GenericFieldLabel>
+ </ReviewField>
)}
</SecretRotationReviewSection>
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="API Key">{apiKey}</GenericFieldLabel>
+ <ReviewField label="API Key">{apiKey}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/RedisCredentialsRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/RedisCredentialsRotationReviewFields.tsx
index 871faf8b61..c1d46c459c 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/RedisCredentialsRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/RedisCredentialsRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { SecretRotationReviewSection } from "./shared";
@@ -19,31 +19,25 @@ export const RedisCredentialsRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="Permission Scope">{permissionScope}</GenericFieldLabel>
+ <ReviewField label="Permission Scope">{permissionScope}</ReviewField>
</SecretRotationReviewSection>
{passwordRequirements && (
<SecretRotationReviewSection label="Password Requirements">
- <GenericFieldLabel label="Length">{passwordRequirements.length}</GenericFieldLabel>
- <GenericFieldLabel label="Minimum Digits">
- {passwordRequirements.required.digits}
- </GenericFieldLabel>
- <GenericFieldLabel label="Minimum Lowercase Characters">
+ <ReviewField label="Length">{passwordRequirements.length}</ReviewField>
+ <ReviewField label="Minimum Digits">{passwordRequirements.required.digits}</ReviewField>
+ <ReviewField label="Minimum Lowercase Characters">
{passwordRequirements.required.lowercase}
- </GenericFieldLabel>
- <GenericFieldLabel label="Minimum Uppercase Characters">
+ </ReviewField>
+ <ReviewField label="Minimum Uppercase Characters">
{passwordRequirements.required.uppercase}
- </GenericFieldLabel>
- <GenericFieldLabel label="Minimum Symbols">
- {passwordRequirements.required.symbols}
- </GenericFieldLabel>
- <GenericFieldLabel label="Allowed Symbols">
- {passwordRequirements.allowedSymbols}
- </GenericFieldLabel>
+ </ReviewField>
+ <ReviewField label="Minimum Symbols">{passwordRequirements.required.symbols}</ReviewField>
+ <ReviewField label="Allowed Symbols">{passwordRequirements.allowedSymbols}</ReviewField>
</SecretRotationReviewSection>
)}
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="Username">{username}</GenericFieldLabel>
- <GenericFieldLabel label="Password">{password}</GenericFieldLabel>
+ <ReviewField label="Username">{username}</ReviewField>
+ <ReviewField label="Password">{password}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SalesforceOauthCredentialsRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SalesforceOauthCredentialsRotationReviewFields.tsx
index 2bd86b352b..f596068e5f 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SalesforceOauthCredentialsRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SalesforceOauthCredentialsRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { SecretRotationReviewSection } from "./shared";
@@ -18,11 +18,11 @@ export const SalesforceOauthCredentialsRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="External Client App">{parameters.appName}</GenericFieldLabel>
+ <ReviewField label="External Client App">{parameters.appName}</ReviewField>
</SecretRotationReviewSection>
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="Consumer Key">{consumerKey}</GenericFieldLabel>
- <GenericFieldLabel label="Consumer Secret">{consumerSecret}</GenericFieldLabel>
+ <ReviewField label="Consumer Key">{consumerKey}</ReviewField>
+ <ReviewField label="Consumer Secret">{consumerSecret}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx
index cf563f880c..51717dc53e 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx
@@ -2,7 +2,8 @@ import { useFormContext } from "react-hook-form";
import { format } from "date-fns";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
+import { DetailGroup, DetailGroupHeader } from "@app/components/v3";
import { getRotateAtLocal } from "@app/helpers/secretRotationsV2";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
@@ -81,32 +82,28 @@ export const SecretRotationV2ReviewFields = () => {
return (
<div className="mb-4 flex flex-col gap-6">
- <div className="flex flex-col gap-3">
- <div className="w-full border-b border-mineshaft-600">
- <span className="text-sm text-mineshaft-300">Configuration</span>
- </div>
+ <DetailGroup>
+ <DetailGroupHeader className="border-b border-border pb-1">Configuration</DetailGroupHeader>
<div className="flex flex-wrap gap-x-8 gap-y-2">
- <GenericFieldLabel label="Connection">{connection.name}</GenericFieldLabel>
- <GenericFieldLabel label="Environment">{environment.name}</GenericFieldLabel>
- <GenericFieldLabel label="Secret Path">{secretPath}</GenericFieldLabel>
- <GenericFieldLabel label="Rotation Interval">
+ <ReviewField label="Connection">{connection.name}</ReviewField>
+ <ReviewField label="Environment">{environment.name}</ReviewField>
+ <ReviewField label="Secret Path">{secretPath}</ReviewField>
+ <ReviewField label="Rotation Interval">
{rotationInterval} Day{rotationInterval > 1 ? "s" : ""}
- </GenericFieldLabel>
- <GenericFieldLabel label="Rotate At">
+ </ReviewField>
+ <ReviewField label="Rotate At">
{format(getRotateAtLocal(rotateAtUtc), "h:mm aa")}
- </GenericFieldLabel>
+ </ReviewField>
</div>
- </div>
+ </DetailGroup>
<Component />
- <div className="flex flex-col gap-3">
- <div className="w-full border-b border-mineshaft-600">
- <span className="text-sm text-mineshaft-300">Details</span>
- </div>
+ <DetailGroup>
+ <DetailGroupHeader className="border-b border-border pb-1">Details</DetailGroupHeader>
<div className="flex flex-wrap gap-x-8 gap-y-2">
- <GenericFieldLabel label="Name">{name}</GenericFieldLabel>
- <GenericFieldLabel label="Description">{description}</GenericFieldLabel>
+ <ReviewField label="Name">{name}</ReviewField>
+ <ReviewField label="Description">{description}</ReviewField>
</div>
- </div>
+ </DetailGroup>
</div>
);
};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SnowflakeUserKeyPairRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SnowflakeUserKeyPairRotationReviewFields.tsx
index ce29504b37..c287ce5abd 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SnowflakeUserKeyPairRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SnowflakeUserKeyPairRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { SecretRotationReviewSection } from "./shared";
@@ -21,12 +21,12 @@ export const SnowflakeUserKeyPairRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="User">{username}</GenericFieldLabel>
- <GenericFieldLabel label="RSA Modulus Length">{`${modulusLength}-bit`}</GenericFieldLabel>
+ <ReviewField label="User">{username}</ReviewField>
+ <ReviewField label="RSA Modulus Length">{`${modulusLength}-bit`}</ReviewField>
</SecretRotationReviewSection>
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="Private Key">{privateKey}</GenericFieldLabel>
- <GenericFieldLabel label="Public Key">{publicKey}</GenericFieldLabel>
+ <ReviewField label="Private Key">{privateKey}</ReviewField>
+ <ReviewField label="Public Key">{publicKey}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SupabaseApiKeyRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SupabaseApiKeyRotationReviewFields.tsx
index f89bcaaf2c..2f5ad27773 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SupabaseApiKeyRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SupabaseApiKeyRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { SupabaseApiKeyType } from "@app/hooks/api/secretRotationsV2/types/supabase-api-key-rotation";
@@ -24,13 +24,13 @@ export const SupabaseApiKeyRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="Project Reference">{parameters.projectRef}</GenericFieldLabel>
- <GenericFieldLabel label="Key Type">
+ <ReviewField label="Project Reference">{parameters.projectRef}</ReviewField>
+ <ReviewField label="Key Type">
{KEY_TYPE_LABELS[parameters.keyType] || parameters.keyType}
- </GenericFieldLabel>
+ </ReviewField>
</SecretRotationReviewSection>
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="API Key">{apiKey}</GenericFieldLabel>
+ <ReviewField label="API Key">{apiKey}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/UnixLinuxLocalAccountRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/UnixLinuxLocalAccountRotationReviewFields.tsx
index 516ee4b668..eefbcdef0b 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/UnixLinuxLocalAccountRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/UnixLinuxLocalAccountRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { SecretRotationReviewSection } from "./shared";
@@ -20,32 +20,26 @@ export const UnixLinuxLocalAccountRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="Username">{parameters.username}</GenericFieldLabel>
- <GenericFieldLabel label="Use Sudo">{parameters.useSudo ? "Yes" : "No"}</GenericFieldLabel>
+ <ReviewField label="Username">{parameters.username}</ReviewField>
+ <ReviewField label="Use Sudo">{parameters.useSudo ? "Yes" : "No"}</ReviewField>
</SecretRotationReviewSection>
{passwordRequirements && (
<SecretRotationReviewSection label="Password Requirements">
- <GenericFieldLabel label="Length">{passwordRequirements.length}</GenericFieldLabel>
- <GenericFieldLabel label="Minimum Digits">
- {passwordRequirements.required.digits}
- </GenericFieldLabel>
- <GenericFieldLabel label="Minimum Lowercase Characters">
+ <ReviewField label="Length">{passwordRequirements.length}</ReviewField>
+ <ReviewField label="Minimum Digits">{passwordRequirements.required.digits}</ReviewField>
+ <ReviewField label="Minimum Lowercase Characters">
{passwordRequirements.required.lowercase}
- </GenericFieldLabel>
- <GenericFieldLabel label="Minimum Uppercase Characters">
+ </ReviewField>
+ <ReviewField label="Minimum Uppercase Characters">
{passwordRequirements.required.uppercase}
- </GenericFieldLabel>
- <GenericFieldLabel label="Minimum Symbols">
- {passwordRequirements.required.symbols}
- </GenericFieldLabel>
- <GenericFieldLabel label="Allowed Symbols">
- {passwordRequirements.allowedSymbols}
- </GenericFieldLabel>
+ </ReviewField>
+ <ReviewField label="Minimum Symbols">{passwordRequirements.required.symbols}</ReviewField>
+ <ReviewField label="Allowed Symbols">{passwordRequirements.allowedSymbols}</ReviewField>
</SecretRotationReviewSection>
)}
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="Username">{username}</GenericFieldLabel>
- <GenericFieldLabel label="Password">{password}</GenericFieldLabel>
+ <ReviewField label="Username">{username}</ReviewField>
+ <ReviewField label="Password">{password}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/WindowsLocalAccountRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/WindowsLocalAccountRotationReviewFields.tsx
index f9fad05b4e..f638573545 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/WindowsLocalAccountRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/WindowsLocalAccountRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { SecretRotationReviewSection } from "./shared";
@@ -20,31 +20,25 @@ export const WindowsLocalAccountRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="Username">{parameters.username}</GenericFieldLabel>
+ <ReviewField label="Username">{parameters.username}</ReviewField>
</SecretRotationReviewSection>
{passwordRequirements && (
<SecretRotationReviewSection label="Password Requirements">
- <GenericFieldLabel label="Length">{passwordRequirements.length}</GenericFieldLabel>
- <GenericFieldLabel label="Minimum Digits">
- {passwordRequirements.required.digits}
- </GenericFieldLabel>
- <GenericFieldLabel label="Minimum Lowercase Characters">
+ <ReviewField label="Length">{passwordRequirements.length}</ReviewField>
+ <ReviewField label="Minimum Digits">{passwordRequirements.required.digits}</ReviewField>
+ <ReviewField label="Minimum Lowercase Characters">
{passwordRequirements.required.lowercase}
- </GenericFieldLabel>
- <GenericFieldLabel label="Minimum Uppercase Characters">
+ </ReviewField>
+ <ReviewField label="Minimum Uppercase Characters">
{passwordRequirements.required.uppercase}
- </GenericFieldLabel>
- <GenericFieldLabel label="Minimum Symbols">
- {passwordRequirements.required.symbols}
- </GenericFieldLabel>
- <GenericFieldLabel label="Allowed Symbols">
- {passwordRequirements.allowedSymbols}
- </GenericFieldLabel>
+ </ReviewField>
+ <ReviewField label="Minimum Symbols">{passwordRequirements.required.symbols}</ReviewField>
+ <ReviewField label="Allowed Symbols">{passwordRequirements.allowedSymbols}</ReviewField>
</SecretRotationReviewSection>
)}
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="Username">{username}</GenericFieldLabel>
- <GenericFieldLabel label="Password">{password}</GenericFieldLabel>
+ <ReviewField label="Username">{username}</ReviewField>
+ <ReviewField label="Password">{password}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/shared/SecretRotationReviewSection.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/shared/SecretRotationReviewSection.tsx
index fdff4af5cd..79ac4378e2 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/shared/SecretRotationReviewSection.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/shared/SecretRotationReviewSection.tsx
@@ -1,5 +1,7 @@
import { ReactNode } from "react";
+import { DetailGroup, DetailGroupHeader } from "@app/components/v3";
+
type Props = {
label: "Parameters" | "Secrets Mapping" | "Password Requirements";
children: ReactNode;
@@ -7,11 +9,9 @@ type Props = {
export const SecretRotationReviewSection = ({ label, children }: Props) => {
return (
- <div className="flex flex-col gap-3">
- <div className="w-full border-b border-mineshaft-600">
- <span className="text-sm text-mineshaft-300">{label}</span>
- </div>
+ <DetailGroup>
+ <DetailGroupHeader className="border-b border-border pb-1">{label}</DetailGroupHeader>
<div className="flex flex-wrap gap-x-8 gap-y-2">{children}</div>
- </div>
+ </DetailGroup>
);
};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/shared/SqlCredentialsRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/shared/SqlCredentialsRotationReviewFields.tsx
index d610553556..4910d133ad 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/shared/SqlCredentialsRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/shared/SqlCredentialsRotationReviewFields.tsx
@@ -1,7 +1,7 @@
import { useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { GenericFieldLabel } from "@app/components/v2";
+import { ReviewField } from "@app/components/secret-rotations-v2/forms/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { SecretRotationReviewSection } from "./SecretRotationReviewSection";
@@ -21,12 +21,12 @@ export const SqlCredentialsRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <GenericFieldLabel label="Database Username 1">{username1}</GenericFieldLabel>
- <GenericFieldLabel label="Database Username 2">{username2}</GenericFieldLabel>
+ <ReviewField label="Database Username 1">{username1}</ReviewField>
+ <ReviewField label="Database Username 2">{username2}</ReviewField>
</SecretRotationReviewSection>
<SecretRotationReviewSection label="Secrets Mapping">
- <GenericFieldLabel label="Username">{username}</GenericFieldLabel>
- <GenericFieldLabel label="Password">{password}</GenericFieldLabel>
+ <ReviewField label="Username">{username}</ReviewField>
+ <ReviewField label="Password">{password}</ReviewField>
</SecretRotationReviewSection>
</>
);
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/Auth0ClientSecretRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/Auth0ClientSecretRotationSecretsMappingFields.tsx
index afe30d7606..0f4607da97 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/Auth0ClientSecretRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/Auth0ClientSecretRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./shared";
@@ -20,14 +20,18 @@ export const Auth0ClientSecretRotationSecretsMappingFields = () => {
name: "Client ID",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.clientId}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.clientId"
@@ -38,14 +42,18 @@ export const Auth0ClientSecretRotationSecretsMappingFields = () => {
name: "Client Secret",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.clientSecret}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.clientSecret"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/AwsIamUserSecretRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/AwsIamUserSecretRotationSecretsMappingFields.tsx
index 2c64321224..bca584e29a 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/AwsIamUserSecretRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/AwsIamUserSecretRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./shared";
@@ -20,14 +20,18 @@ export const AwsIamUserSecretRotationSecretsMappingFields = () => {
name: "Access Key ID",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.accessKeyId}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.accessKeyId"
@@ -38,14 +42,18 @@ export const AwsIamUserSecretRotationSecretsMappingFields = () => {
name: "Secret Access Key",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.secretAccessKey}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.secretAccessKey"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/AzureClientSecretRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/AzureClientSecretRotationSecretsMappingFields.tsx
index 77a34d0831..3bc6e8fe60 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/AzureClientSecretRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/AzureClientSecretRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./shared";
@@ -20,14 +20,18 @@ export const AzureClientSecretRotationSecretsMappingFields = () => {
name: "Client ID",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.clientId}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.clientId"
@@ -38,14 +42,18 @@ export const AzureClientSecretRotationSecretsMappingFields = () => {
name: "Client Secret",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.clientSecret}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.clientSecret"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/CloudflareApiTokenRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/CloudflareApiTokenRotationSecretsMappingFields.tsx
index 50c36e4bb3..d6904eeb74 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/CloudflareApiTokenRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/CloudflareApiTokenRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./shared";
@@ -20,14 +20,18 @@ export const CloudflareApiTokenRotationSecretsMappingFields = () => {
name: "Token ID",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.tokenId}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.tokenId"
@@ -38,14 +42,18 @@ export const CloudflareApiTokenRotationSecretsMappingFields = () => {
name: "API Token",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.apiToken}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.apiToken"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/CloudflareR2AccessKeyRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/CloudflareR2AccessKeyRotationSecretsMappingFields.tsx
index 0481c33f07..a491361748 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/CloudflareR2AccessKeyRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/CloudflareR2AccessKeyRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./shared";
@@ -20,14 +20,18 @@ export const CloudflareR2AccessKeyRotationSecretsMappingFields = () => {
name: "Access Key ID",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.accessKeyId}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.accessKeyId"
@@ -38,14 +42,18 @@ export const CloudflareR2AccessKeyRotationSecretsMappingFields = () => {
name: "Secret Access Key",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.secretAccessKey}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.secretAccessKey"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/ConvexAccessKeyRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/ConvexAccessKeyRotationSecretsMappingFields.tsx
index a249d6a444..0aa3cf90c2 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/ConvexAccessKeyRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/ConvexAccessKeyRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./shared";
@@ -20,14 +20,18 @@ export const ConvexAccessKeyRotationSecretsMappingFields = () => {
name: "Access Key",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.accessKey}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.accessKey"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatabricksServiceAccountSecretRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatabricksServiceAccountSecretRotationSecretsMappingFields.tsx
index 21c4d48ba1..adfbc7521c 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatabricksServiceAccountSecretRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatabricksServiceAccountSecretRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./shared";
@@ -22,14 +22,18 @@ export const DatabricksServicePrincipalSecretRotationSecretsMappingFields = () =
name: "Client ID",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.clientId}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.clientId"
@@ -40,14 +44,18 @@ export const DatabricksServicePrincipalSecretRotationSecretsMappingFields = () =
name: "Client Secret",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.clientSecret}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.clientSecret"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatabricksServicePrincipalSecretRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatabricksServicePrincipalSecretRotationSecretsMappingFields.tsx
index 21c4d48ba1..adfbc7521c 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatabricksServicePrincipalSecretRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatabricksServicePrincipalSecretRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./shared";
@@ -22,14 +22,18 @@ export const DatabricksServicePrincipalSecretRotationSecretsMappingFields = () =
name: "Client ID",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.clientId}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.clientId"
@@ -40,14 +44,18 @@ export const DatabricksServicePrincipalSecretRotationSecretsMappingFields = () =
name: "Client Secret",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.clientSecret}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.clientSecret"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatadogApiKeyRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatadogApiKeyRotationSecretsMappingFields.tsx
index b228454c51..352ca4e694 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatadogApiKeyRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatadogApiKeyRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./shared";
@@ -20,14 +20,18 @@ export const DatadogApiKeyRotationSecretsMappingFields = () => {
name: "API Key ID",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.apiKeyId}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.apiKeyId"
@@ -38,14 +42,18 @@ export const DatadogApiKeyRotationSecretsMappingFields = () => {
name: "API Key",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.apiKey}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.apiKey"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatadogApplicationKeySecretRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatadogApplicationKeySecretRotationSecretsMappingFields.tsx
index 611309b587..ba0f72d330 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatadogApplicationKeySecretRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatadogApplicationKeySecretRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./shared";
@@ -20,14 +20,18 @@ export const DatadogApplicationKeySecretRotationSecretsMappingFields = () => {
name: "Application Key ID",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.applicationKeyId}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.applicationKeyId"
@@ -38,14 +42,18 @@ export const DatadogApplicationKeySecretRotationSecretsMappingFields = () => {
name: "Application Key",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.applicationKey}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.applicationKey"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DbtServiceTokenRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DbtServiceTokenRotationSecretsMappingFields.tsx
index 816bbcdc6c..5118c04703 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DbtServiceTokenRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DbtServiceTokenRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./shared";
@@ -20,14 +20,18 @@ export const DbtServiceTokenRotationSecretsMappingFields = () => {
name: "Service Token",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.serviceToken}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.serviceToken"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/FireworksApiKeyRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/FireworksApiKeyRotationSecretsMappingFields.tsx
index 8d1742b86d..bf960c6aa3 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/FireworksApiKeyRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/FireworksApiKeyRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./shared";
@@ -20,14 +20,18 @@ export const FireworksApiKeyRotationSecretsMappingFields = () => {
name: "API Key",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.apiKey}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.apiKey"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/HpIloRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/HpIloRotationSecretsMappingFields.tsx
index 780c2c9075..1a0a649083 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/HpIloRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/HpIloRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldFeedback, FieldLabel, Input } from "@app/components/v3";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
export const HpIloRotationSecretsMappingFields = () => {
@@ -16,29 +16,47 @@ export const HpIloRotationSecretsMappingFields = () => {
<Controller
name="secretsMapping.username"
control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Username"
- isError={Boolean(error)}
- errorText={error?.message}
- helperText="The secret key where the iLO username will be stored"
- >
- <Input {...field} placeholder="ILO_USERNAME" />
- </FormControl>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabel>Username</FieldLabel>
+ <Input
+ ref={ref}
+ value={value}
+ onBlur={onBlur}
+ onChange={onChange}
+ placeholder="ILO_USERNAME"
+ isError={Boolean(error)}
+ aria-describedby="hp-ilo-secrets-mapping-username-feedback"
+ />
+ <FieldFeedback
+ id="hp-ilo-secrets-mapping-username-feedback"
+ description="The secret key where the iLO username will be stored"
+ error={error?.message}
+ />
+ </Field>
)}
/>
<Controller
name="secretsMapping.password"
control={control}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Password"
- isError={Boolean(error)}
- errorText={error?.message}
- helperText="The secret key where the rotated iLO password will be stored"
- >
- <Input {...field} placeholder="ILO_PASSWORD" />
- </FormControl>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabel>Password</FieldLabel>
+ <Input
+ ref={ref}
+ value={value}
+ onBlur={onBlur}
+ onChange={onChange}
+ placeholder="ILO_PASSWORD"
+ isError={Boolean(error)}
+ aria-describedby="hp-ilo-secrets-mapping-password-feedback"
+ />
+ <FieldFeedback
+ id="hp-ilo-secrets-mapping-password-feedback"
+ description="The secret key where the rotated iLO password will be stored"
+ error={error?.message}
+ />
+ </Field>
)}
/>
</>
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/LdapPasswordRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/LdapPasswordRotationSecretsMappingFields.tsx
index 0c5c906625..8711c7cf28 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/LdapPasswordRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/LdapPasswordRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./shared";
@@ -20,14 +20,18 @@ export const LdapPasswordRotationSecretsMappingFields = () => {
name: "DN/UPN",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.dn}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.dn"
@@ -38,14 +42,18 @@ export const LdapPasswordRotationSecretsMappingFields = () => {
name: "Password",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.password}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.password"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/LiteLLMApiKeyRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/LiteLLMApiKeyRotationSecretsMappingFields.tsx
index fcacb73d66..84b9dc6d7a 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/LiteLLMApiKeyRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/LiteLLMApiKeyRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./shared";
@@ -20,14 +20,18 @@ export const LiteLLMApiKeyRotationSecretsMappingFields = () => {
name: "API Key",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.apiKey}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.apiKey"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/OktaClientSecretRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/OktaClientSecretRotationSecretsMappingFields.tsx
index 72adc863d6..9af401056f 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/OktaClientSecretRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/OktaClientSecretRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./shared";
@@ -20,14 +20,18 @@ export const OktaClientSecretRotationSecretsMappingFields = () => {
name: "Client ID",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.clientId}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.clientId"
@@ -38,14 +42,18 @@ export const OktaClientSecretRotationSecretsMappingFields = () => {
name: "Client Secret",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.clientSecret}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.clientSecret"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/OpenAIServiceAccountRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/OpenAIServiceAccountRotationSecretsMappingFields.tsx
index e81917df2e..f486df38e7 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/OpenAIServiceAccountRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/OpenAIServiceAccountRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./shared";
@@ -20,14 +20,18 @@ export const OpenAIServiceAccountRotationSecretsMappingFields = () => {
name: "API Key",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.apiKey}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.apiKey"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/OpenRouterApiKeyRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/OpenRouterApiKeyRotationSecretsMappingFields.tsx
index 5589161347..ee1ac21983 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/OpenRouterApiKeyRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/OpenRouterApiKeyRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./shared";
@@ -20,14 +20,18 @@ export const OpenRouterApiKeyRotationSecretsMappingFields = () => {
name: "API Key",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.apiKey}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.apiKey"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/RedisCredentialsRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/RedisCredentialsRotationSecretsMappingFields.tsx
index 2ffac6a62d..278e9243f8 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/RedisCredentialsRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/RedisCredentialsRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./shared";
@@ -20,14 +20,18 @@ export const RedisCredentialsRotationSecretsMappingFields = () => {
name: "Username",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.username}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.username"
@@ -38,14 +42,18 @@ export const RedisCredentialsRotationSecretsMappingFields = () => {
name: "Password",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.password}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.password"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SalesforceOauthCredentialsRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SalesforceOauthCredentialsRotationSecretsMappingFields.tsx
index 14d1bf1eb0..8188700994 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SalesforceOauthCredentialsRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SalesforceOauthCredentialsRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./shared";
@@ -20,14 +20,18 @@ export const SalesforceOauthCredentialsRotationSecretsMappingFields = () => {
name: "Consumer Key",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.consumerKey}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.consumerKey"
@@ -38,14 +42,18 @@ export const SalesforceOauthCredentialsRotationSecretsMappingFields = () => {
name: "Consumer Secret",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.consumerSecret}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.consumerSecret"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx
index 26e9b9b677..622863b045 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx
@@ -70,11 +70,8 @@ export const SecretRotationV2SecretsMappingFields = () => {
const Component = COMPONENT_MAP[rotationType];
return (
- <>
- <p className="mb-4 text-sm text-bunker-300">
- Map the rotated credentials to secrets in your Infisical project.
- </p>
+ <div className="space-y-4">
<Component />
- </>
+ </div>
);
};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SnowflakeUserKeyPairRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SnowflakeUserKeyPairRotationSecretsMappingFields.tsx
index 9f3809f5fd..767f4903f9 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SnowflakeUserKeyPairRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SnowflakeUserKeyPairRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./shared";
@@ -20,14 +20,18 @@ export const SnowflakeUserKeyPairRotationSecretsMappingFields = () => {
name: "Private Key",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.privateKey}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.privateKey"
@@ -38,14 +42,18 @@ export const SnowflakeUserKeyPairRotationSecretsMappingFields = () => {
name: "Public Key",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.publicKey}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.publicKey"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SupabaseApiKeyRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SupabaseApiKeyRotationSecretsMappingFields.tsx
index 3da2c8e224..e1c6c5c3cf 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SupabaseApiKeyRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SupabaseApiKeyRotationSecretsMappingFields.tsx
@@ -2,7 +2,7 @@ import { useEffect, useRef } from "react";
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { SupabaseApiKeyType } from "@app/hooks/api/secretRotationsV2/types/supabase-api-key-rotation";
@@ -35,14 +35,18 @@ export const SupabaseApiKeyRotationSecretsMappingFields = () => {
name: "API Key",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={keyType ? DEFAULT_SECRET_NAME[keyType] : "SUPABASE_API_KEY"}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.apiKey"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/UnixLinuxLocalAccountRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/UnixLinuxLocalAccountRotationSecretsMappingFields.tsx
index 4dac2d8c90..3879e686ca 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/UnixLinuxLocalAccountRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/UnixLinuxLocalAccountRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./shared";
@@ -20,14 +20,18 @@ export const UnixLinuxLocalAccountRotationSecretsMappingFields = () => {
name: "Username",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.username}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.username"
@@ -38,14 +42,18 @@ export const UnixLinuxLocalAccountRotationSecretsMappingFields = () => {
name: "Password",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.password}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.password"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/WindowsLocalAccountRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/WindowsLocalAccountRotationSecretsMappingFields.tsx
index 5f287cec7e..27f00f684a 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/WindowsLocalAccountRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/WindowsLocalAccountRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./shared";
@@ -20,14 +20,18 @@ export const WindowsLocalAccountRotationSecretsMappingFields = () => {
name: "Username",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.username}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.username"
@@ -38,14 +42,18 @@ export const WindowsLocalAccountRotationSecretsMappingFields = () => {
name: "Password",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.password}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.password"
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/shared/SecretsMappingTable.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/shared/SecretsMappingTable.tsx
index b5fafe11b1..5c96e25da3 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/shared/SecretsMappingTable.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/shared/SecretsMappingTable.tsx
@@ -1,9 +1,7 @@
import { ReactNode } from "react";
-import { faArrowRight } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { KeyIcon } from "lucide-react";
+import { ArrowRightIcon, KeyIcon } from "lucide-react";
-import { FormLabel } from "@app/components/v2";
+import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
import { Badge } from "@app/components/v3";
type Props = {
@@ -16,16 +14,14 @@ export const SecretsMappingTable = ({ items }: Props) => {
<table className="w-full table-auto">
<thead>
<tr className="text-left">
- <th className="whitespace-nowrap">
- <FormLabel label="Rotated Credentials" />
+ <th className="pb-2 whitespace-nowrap">
+ <FieldLabelWithTooltip>Rotated Credentials</FieldLabelWithTooltip>
</th>
<th />
- <th>
- <FormLabel
- tooltipClassName="max-w-sm"
- tooltipText="The name of the secret that the active credentials will be mapped to."
- label="Secret Name"
- />
+ <th className="pb-2">
+ <FieldLabelWithTooltip tooltip="The name of the secret that the active credentials will be mapped to.">
+ Secret Name
+ </FieldLabelWithTooltip>
</th>
</tr>
</thead>
@@ -34,16 +30,15 @@ export const SecretsMappingTable = ({ items }: Props) => {
<tr key={name}>
<td className="whitespace-nowrap">
<div className="mb-4 flex h-full items-start justify-center">
- {/* TODO(scott): probably shouldn't be a badge */}
- <Badge variant="neutral" className="h-[36px] w-full justify-center text-xs">
+ <Badge variant="neutral" className="h-9 w-full justify-center text-xs">
<KeyIcon />
{name}
</Badge>
</div>
</td>
- <td className="pr-5 pl-5 whitespace-nowrap">
+ <td className="px-5 whitespace-nowrap">
<div className="mb-4 flex items-center justify-center">
- <FontAwesomeIcon className="text-mineshaft-400" icon={faArrowRight} />
+ <ArrowRightIcon className="size-4 text-muted" />
</div>
</td>
<td className="w-full">{input}</td>
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/shared/SqlCredentialsRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/shared/SqlCredentialsRotationSecretsMappingFields.tsx
index 67721de72a..f1c9ff7355 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/shared/SqlCredentialsRotationSecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/shared/SqlCredentialsRotationSecretsMappingFields.tsx
@@ -1,7 +1,7 @@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
-import { FormControl, Input } from "@app/components/v2";
+import { Field, FieldError, Input } from "@app/components/v3";
import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
import { SecretsMappingTable } from "./SecretsMappingTable";
@@ -22,14 +22,18 @@ export const SqlCredentialsRotationSecretsMappingFields = () => {
name: "Username",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.username}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.username"
@@ -40,14 +44,18 @@ export const SqlCredentialsRotationSecretsMappingFields = () => {
name: "Password",
input: (
<Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (
+ <Field data-invalid={Boolean(error)}>
<Input
+ ref={ref}
value={value}
+ onBlur={onBlur}
onChange={onChange}
placeholder={rotationOption?.template.secretsMapping.password}
+ isError={Boolean(error)}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
control={control}
name="secretsMapping.password"
diff --git a/frontend/src/components/secret-rotations-v2/forms/shared/FieldLabelWithTooltip.tsx b/frontend/src/components/secret-rotations-v2/forms/shared/FieldLabelWithTooltip.tsx
new file mode 100644
index 0000000000..14a84e030c
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/shared/FieldLabelWithTooltip.tsx
@@ -0,0 +1,35 @@
+import { ReactNode } from "react";
+import { HelpCircleIcon } from "lucide-react";
+
+import { FieldLabel, Tooltip, TooltipContent, TooltipTrigger } from "@app/components/v3";
+
+type Props = {
+ htmlFor?: string;
+ children: ReactNode;
+ tooltip?: ReactNode;
+ tooltipClassName?: string;
+};
+
+export const FieldLabelWithTooltip = ({ htmlFor, children, tooltip, tooltipClassName }: Props) => {
+ if (!tooltip) {
+ return <FieldLabel htmlFor={htmlFor}>{children}</FieldLabel>;
+ }
+
+ return (
+ <div className="flex items-center gap-1.5">
+ <FieldLabel htmlFor={htmlFor}>{children}</FieldLabel>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <button
+ type="button"
+ aria-label="More information"
+ className="rounded-sm text-muted outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ <HelpCircleIcon className="size-3.5" />
+ </button>
+ </TooltipTrigger>
+ <TooltipContent className={tooltipClassName ?? "max-w-sm"}>{tooltip}</TooltipContent>
+ </Tooltip>
+ </div>
+ );
+};
diff --git a/frontend/src/components/secret-rotations-v2/forms/shared/ReviewField.tsx b/frontend/src/components/secret-rotations-v2/forms/shared/ReviewField.tsx
new file mode 100644
index 0000000000..5f34e2d769
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/shared/ReviewField.tsx
@@ -0,0 +1,40 @@
+import { ReactNode } from "react";
+import { LucideIcon } from "lucide-react";
+
+import { Detail, DetailLabel, DetailValue } from "@app/components/v3";
+import { cn } from "@app/components/v3/utils";
+
+type Props = {
+ label: string;
+ children?: ReactNode;
+ className?: string;
+ labelClassName?: string;
+ truncate?: boolean;
+ icon?: LucideIcon;
+};
+
+export const ReviewField = ({
+ label,
+ children,
+ className,
+ labelClassName,
+ truncate,
+ icon: Icon
+}: Props) => {
+ const hasValue =
+ children !== null && children !== undefined && children !== "" && children !== false;
+
+ return (
+ <Detail className={cn("min-w-0", className)}>
+ <DetailLabel className={cn("flex items-center gap-1.5", labelClassName)}>
+ {Icon ? <Icon className="size-3.5 text-muted" /> : null}
+ {label}
+ </DetailLabel>
+ {hasValue ? (
+ <DetailValue className={truncate ? "truncate" : undefined}>{children}</DetailValue>
+ ) : (
+ <DetailValue className="text-muted italic">None</DetailValue>
+ )}
+ </Detail>
+ );
+};
diff --git a/frontend/src/components/secret-rotations-v2/forms/shared/index.ts b/frontend/src/components/secret-rotations-v2/forms/shared/index.ts
new file mode 100644
index 0000000000..8ce39cff50
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/shared/index.ts
@@ -0,0 +1,2 @@
+export { FieldLabelWithTooltip } from "./FieldLabelWithTooltip";
+export { ReviewField } from "./ReviewField";
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/shared/AwsRegionSelect.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/shared/AwsRegionSelect.tsx
index 1ae23f5401..369ac2bc9e 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/shared/AwsRegionSelect.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/shared/AwsRegionSelect.tsx
@@ -12,7 +12,7 @@ const Option = ({ isSelected, children, ...props }: OptionProps<(typeof AWS_REGI
<Badge variant="neutral" className="mr-auto ml-1">
{props.data.slug}
</Badge>
- {isSelected && <CheckIcon className="ml-2 size-4 text-primary" />}
+ {isSelected && <CheckIcon className="ml-2 size-4" />}
</div>
</components.Option>
);
diff --git a/frontend/src/components/v3/generic/AlertDialog/AlertDialog.stories.tsx b/frontend/src/components/v3/generic/AlertDialog/AlertDialog.stories.tsx
index 696ad83bee..2a13d6ffd3 100644
--- a/frontend/src/components/v3/generic/AlertDialog/AlertDialog.stories.tsx
+++ b/frontend/src/components/v3/generic/AlertDialog/AlertDialog.stories.tsx
@@ -19,6 +19,7 @@ import {
AlertDialogTitle,
AlertDialogTrigger
} from "./AlertDialog";
+import { DiscardChangesAlertDialog } from "./DiscardChangesAlertDialog";
/**
* AlertDialogs are modal confirmation dialogs for irreversible or high-consequence actions —
@@ -152,6 +153,38 @@ export const WithMedia: Story = {
)
};
+const DiscardChangesStory = () => {
+ const [open, setOpen] = useState(false);
+
+ return (
+ <>
+ <Button variant="outline" onClick={() => setOpen(true)}>
+ Close Editor
+ </Button>
+ <DiscardChangesAlertDialog
+ open={open}
+ onOpenChange={setOpen}
+ onDiscard={() => setOpen(false)}
+ title="Discard Changes?"
+ description="Your unsaved changes to this configuration will be lost."
+ />
+ </>
+ );
+};
+
+export const DiscardChanges: Story = {
+ name: "Example: Discard Changes",
+ parameters: {
+ docs: {
+ description: {
+ story:
+ "Use `DiscardChangesAlertDialog` when dismissing an editor or setup flow would remove unsaved form changes. The owning feature remains responsible for dirty state and reset behavior."
+ }
+ }
+ },
+ render: () => <DiscardChangesStory />
+};
+
export const SmallSize: Story = {
name: "Example: Small Size",
parameters: {
diff --git a/frontend/src/components/v3/generic/AlertDialog/DiscardChangesAlertDialog.tsx b/frontend/src/components/v3/generic/AlertDialog/DiscardChangesAlertDialog.tsx
new file mode 100644
index 0000000000..0713b1d901
--- /dev/null
+++ b/frontend/src/components/v3/generic/AlertDialog/DiscardChangesAlertDialog.tsx
@@ -0,0 +1,47 @@
+import { AlertTriangleIcon } from "lucide-react";
+
+import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogMedia,
+ AlertDialogTitle
+} from "./AlertDialog";
+
+type Props = {
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+ onDiscard: () => void;
+ title: string;
+ description: string;
+};
+
+export const DiscardChangesAlertDialog = ({
+ open,
+ onOpenChange,
+ onDiscard,
+ title,
+ description
+}: Props) => (
+ <AlertDialog open={open} onOpenChange={onOpenChange}>
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogMedia>
+ <AlertTriangleIcon />
+ </AlertDialogMedia>
+ <AlertDialogTitle>{title}</AlertDialogTitle>
+ <AlertDialogDescription>{description}</AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel>Keep Editing</AlertDialogCancel>
+ <AlertDialogAction variant="danger" onClick={onDiscard}>
+ Discard
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+);
diff --git a/frontend/src/components/v3/generic/AlertDialog/index.ts b/frontend/src/components/v3/generic/AlertDialog/index.ts
index ba87679af2..b6826a3461 100644
--- a/frontend/src/components/v3/generic/AlertDialog/index.ts
+++ b/frontend/src/components/v3/generic/AlertDialog/index.ts
@@ -1 +1,2 @@
export * from "./AlertDialog";
+export * from "./DiscardChangesAlertDialog";
diff --git a/frontend/src/hooks/index.ts b/frontend/src/hooks/index.ts
index 63b091d9ab..6f7fca075f 100644
--- a/frontend/src/hooks/index.ts
+++ b/frontend/src/hooks/index.ts
@@ -3,6 +3,7 @@ export {
useCanUseProjectAppConnectionImport
} from "./useCanUseAppConnectionImport";
export { useDebounce } from "./useDebounce";
+export { useDiscardChangesGuard } from "./useDiscardChangesGuard";
export * from "./useGetProjectTypeFromRoute";
export { useLastLogin } from "./useLastLogin";
export { useLocalStorageState } from "./useLocalStorageState";
diff --git a/frontend/src/hooks/useDiscardChangesGuard.ts b/frontend/src/hooks/useDiscardChangesGuard.ts
new file mode 100644
index 0000000000..2a449c83e7
--- /dev/null
+++ b/frontend/src/hooks/useDiscardChangesGuard.ts
@@ -0,0 +1,31 @@
+import { useCallback, useState } from "react";
+
+type Props = {
+ isDirty: boolean;
+ onDiscard: () => void;
+};
+
+export const useDiscardChangesGuard = ({ isDirty, onDiscard }: Props) => {
+ const [isDiscardDialogOpen, setIsDiscardDialogOpen] = useState(false);
+
+ const requestDiscard = useCallback(() => {
+ if (isDirty) {
+ setIsDiscardDialogOpen(true);
+ return;
+ }
+
+ onDiscard();
+ }, [isDirty, onDiscard]);
+
+ const confirmDiscard = useCallback(() => {
+ setIsDiscardDialogOpen(false);
+ onDiscard();
+ }, [onDiscard]);
+
+ return {
+ confirmDiscard,
+ isDiscardDialogOpen,
+ requestDiscard,
+ setIsDiscardDialogOpen
+ };
+};