Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
refactor(frontend): migrate migration modal components to v3 design system
Igor Correa8d81e3146ffa
diff --git a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/EnvKeyPlatformModal.tsx b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/EnvKeyPlatformModal.tsxindex 2c15cfb8a8..289aaeafc9 100644--- a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/EnvKeyPlatformModal.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/EnvKeyPlatformModal.tsx@@ -4,7 +4,14 @@ import { zodResolver } from "@hookform/resolvers/zod";import { z } from "zod";import { createNotification } from "@app/components/notifications";-import { Button, FormControl, Input } from "@app/components/v2";+import {+ Button,+ Field,+ FieldContent,+ FieldError,+ FieldLabel,+ UnstableInput+} from "@app/components/v3";import { useImportEnvKey } from "@app/hooks/api/migration/mutations";import { GenericDropzone } from "./GenericDropzone";@@ -76,19 +83,18 @@ export const EnvKeyPlatformModal = ({ onClose }: Props) => {};return (- <form onSubmit={handleSubmit(onSubmit)} autoComplete="off">+ <form onSubmit={handleSubmit(onSubmit)} autoComplete="off" className="space-y-4"><Controllercontrol={control}name="encryptionKey"render={({ field, fieldState: { error } }) => (- <FormControl- label="Encryption key"- isRequired- errorText={error?.message}- isError={Boolean(error)}- >- <Input type="password" placeholder="" {...field} />- </FormControl>+ <Field>+ <FieldLabel>Encryption key</FieldLabel>+ <FieldContent>+ <UnstableInput type="password" placeholder="" {...field} isError={Boolean(error)} />+ </FieldContent>+ <FieldError>{error?.message}</FieldError>+ </Field>)}/><GenericDropzone@@ -97,15 +103,16 @@ export const EnvKeyPlatformModal = ({ onClose }: Props) => {onData={onImportFileDrop}isSmaller/>- <div className="mt-6 flex items-center space-x-4">+ <div className="flex items-center gap-2 pt-2"><Buttontype="submit"- isLoading={isLoading}+ variant="project"+ isPending={isLoading || isSubmitting}isDisabled={!isDirty || isSubmitting || isLoading || !isValid}>Import data</Button>- <Button variant="outline_bg" onClick={onClose}>+ <Button type="button" variant="outline" onClick={onClose}>Cancel</Button></div>diff --git a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/GenericDropzone.tsx b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/GenericDropzone.tsxindex c564572a41..b6f9b47bda 100644--- a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/GenericDropzone.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/GenericDropzone.tsx@@ -82,7 +82,7 @@ export const GenericDropzone = forwardRef<HTMLInputElement, Props>(onDragOver={handleDrag}onDrop={handleDrop}className={twMerge(- "relative mx-0.5 mt-4 mb-4 flex cursor-pointer items-center justify-center rounded-md bg-mineshaft-900 px-2 py-4 text-sm text-mineshaft-200 opacity-60 outline-2 outline-chicago-600 duration-200 outline-dashed hover:opacity-100",+ "relative mx-0.5 mt-4 mb-4 flex cursor-pointer items-center justify-center rounded-md border border-dashed border-border bg-container/40 px-2 py-4 text-sm text-muted opacity-80 outline-none duration-200 hover:border-accent/30 hover:opacity-100",isDragActive && "opacity-100",!isSmaller && "mx-auto w-full max-w-3xl flex-col space-y-4 py-20")}diff --git a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/InPlatformMigrationSection.tsx b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/InPlatformMigrationSection.tsxindex 51820db116..fd1cd00173 100644--- a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/InPlatformMigrationSection.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/InPlatformMigrationSection.tsx@@ -3,7 +3,6 @@ import { Download, Edit, MoreVertical, Plus, Trash2 } from "lucide-react";import { Link } from "@tanstack/react-router";import { createNotification } from "@app/components/notifications";-import { DeleteActionModal } from "@app/components/v2";import {Button,EmptyMedia,@@ -45,6 +44,7 @@ import {import { DopplerConfigModal } from "./DopplerConfigModal";import { DopplerImportModal } from "./DopplerImportModal";+import { MigrationConfigDeleteDialog } from "./MigrationConfigDeleteDialog";import { SelectInPlatformMigrationProviderModal } from "./SelectInPlatformMigrationProviderModal";import { VaultNamespaceConfigModal } from "./VaultNamespaceConfigModal";@@ -141,12 +141,7 @@ export const InPlatformMigrationSection = () => {return (<div><div className="mb-4 flex flex-wrap items-center justify-between gap-2">- <div>- <h3 className="text-lg font-medium text-mineshaft-100">Configured platforms</h3>- <p className="text-sm text-gray-400">- Link HashiCorp Vault namespaces or Doppler to enable migration actions across Infisical.- </p>- </div>+ <h3 className="text-lg font-medium text-mineshaft-100">Configurations</h3><Buttonvariant="project"type="button"@@ -218,11 +213,17 @@ export const InPlatformMigrationSection = () => {<UnstableTableRow key={`${row.kind}-${row.config.id}`}><UnstableTableCell><div className="flex items-center gap-2">- <img- src={`/images/integrations/${imageFileName}`}- alt=""- className="size-8 rounded-md bg-bunker-500 p-1"- />+ <div className="flex size-8 shrink-0 items-center justify-center rounded-md bg-bunker-500 p-1">+ <img+ src={`/images/integrations/${imageFileName}`}+ alt=""+ className={+ row.kind === "doppler"+ ? "max-h-5 max-w-5 object-contain"+ : "max-h-full max-w-full object-contain"+ }+ />+ </div><span className="text-sm text-mineshaft-200">{name}</span></div></UnstableTableCell>@@ -342,7 +343,7 @@ export const InPlatformMigrationSection = () => {/>)}- <DeleteActionModal+ <MigrationConfigDeleteDialogisOpen={vaultDeleteOpen}title={`Delete namespace configuration for "${vaultToDelete?.namespace}"?`}onChange={(open) => {@@ -353,7 +354,7 @@ export const InPlatformMigrationSection = () => {onDeleteApproved={handleVaultDeleteConfirm}/>- <DeleteActionModal+ <MigrationConfigDeleteDialogisOpen={dopplerDeleteOpen}title="Delete Doppler configuration?"onChange={(open) => {diff --git a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/MigrationConfigDeleteDialog.tsx b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/MigrationConfigDeleteDialog.tsxnew file mode 100644index 0000000000..98b03bd654--- /dev/null+++ b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/MigrationConfigDeleteDialog.tsx@@ -0,0 +1,104 @@+import { useEffect, useState } from "react";++import {+ Button,+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+ Field,+ FieldContent,+ FieldLabel,+ UnstableInput+} from "@app/components/v3";+import { useToggle } from "@app/hooks";++type Props = {+ isOpen?: boolean;+ onChange?: (isOpen: boolean) => void;+ deleteKey: string;+ title: string;+ subTitle?: string;+ onDeleteApproved: () => Promise<void>;+ buttonText?: string;+ isDisabled?: boolean;+};++export const MigrationConfigDeleteDialog = ({+ isOpen,+ onChange,+ deleteKey,+ title,+ subTitle = "This action is irreversible.",+ onDeleteApproved,+ buttonText = "Delete",+ isDisabled+}: Props) => {+ const [inputData, setInputData] = useState("");+ const [isLoading, setIsLoading] = useToggle();++ useEffect(() => {+ setInputData("");+ }, [isOpen]);++ const onDelete = async () => {+ setIsLoading.on();+ try {+ await onDeleteApproved();+ } finally {+ setIsLoading.off();+ }+ };++ return (+ <Dialog+ open={Boolean(isOpen)}+ onOpenChange={(open) => {+ if (!open) setInputData("");+ onChange?.(open);+ }}+ >+ <DialogContent className="max-w-md">+ <DialogHeader>+ <DialogTitle>{title}</DialogTitle>+ <DialogDescription>{subTitle}</DialogDescription>+ </DialogHeader>+ <form+ onSubmit={(evt) => {+ evt.preventDefault();+ if (deleteKey === inputData) void onDelete();+ }}+ >+ <Field>+ <FieldLabel className="text-sm break-words">+ Type <span className="font-bold">{deleteKey}</span> to perform this action+ </FieldLabel>+ <FieldContent>+ <UnstableInput+ value={inputData}+ onChange={(e) => setInputData(e.target.value)}+ placeholder={`Type ${deleteKey} here`}+ aria-invalid={inputData.length > 0 && deleteKey !== inputData}+ />+ </FieldContent>+ </Field>+ </form>+ <DialogFooter>+ <Button variant="outline" onClick={() => onChange?.(false)}>+ Cancel+ </Button>+ <Button+ variant="danger"+ isPending={isLoading}+ isDisabled={deleteKey !== inputData || isLoading || isDisabled}+ onClick={() => void onDelete()}+ >+ {buttonText}+ </Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>+ );+};diff --git a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/SelectImportFromPlatformModal.tsx b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/SelectImportFromPlatformModal.tsxindex c7c22e0a7c..5de0ecacbb 100644--- a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/SelectImportFromPlatformModal.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/SelectImportFromPlatformModal.tsx@@ -1,7 +1,13 @@import { useState } from "react";import { AnimatePresence, motion } from "framer-motion";-import { Modal, ModalContent } from "@app/components/v2";+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogHeader,+ DialogTitle+} from "@app/components/v3";import { EnvKeyPlatformModal } from "./EnvKeyPlatformModal";import { VaultPlatformModal } from "./VaultPlatformModal";@@ -37,20 +43,27 @@ export const SelectImportFromPlatformModal = ({ isOpen, onToggle }: Props) => {null);- const handleFormReset = (state: boolean = false) => {- onToggle(state);- setWizardStep(WizardSteps.SelectPlatform);- setSelectedPlatform(null);+ const handleOpenChange = (open: boolean) => {+ if (!open) {+ setWizardStep(WizardSteps.SelectPlatform);+ setSelectedPlatform(null);+ }+ onToggle(open);};+ const title = selectedPlatform+ ? `Import from ${selectedPlatform.title}`+ : "Import from external source";+return (- <Modal isOpen={isOpen} onOpenChange={(state) => handleFormReset(state)}>- <ModalContent- title={- selectedPlatform ? `Import from ${selectedPlatform.title}` : "Import from external source"- }- className="my-4"- >+ <Dialog open={Boolean(isOpen)} onOpenChange={handleOpenChange}>+ <DialogContent className="max-w-lg" showCloseButton>+ <DialogHeader>+ <DialogTitle>{title}</DialogTitle>+ {wizardStep === WizardSteps.SelectPlatform && (+ <DialogDescription>Select a platform to import from</DialogDescription>+ )}+ </DialogHeader><AnimatePresence mode="wait">{wizardStep === WizardSteps.SelectPlatform && (<motion.div@@ -60,14 +73,11 @@ export const SelectImportFromPlatformModal = ({ isOpen, onToggle }: Props) => {animate={{ opacity: 1, translateX: 0 }}exit={{ opacity: 0, translateX: -30 }}>- <div className="mb-4 text-sm text-mineshaft-300">- Select a platform to import from- </div><div className="flex items-center space-x-4">{PLATFORM_LIST.map((platform, idx) => (<divkey={`platform-${idx + 1}`}- className="flex h-28 w-32 cursor-pointer flex-col items-center justify-between rounded-sm border border-mineshaft-500 bg-mineshaft-700 p-6 py-5 transition-all hover:border-primary/70 hover:bg-primary/10 hover:text-white"+ className="flex h-28 w-32 cursor-pointer flex-col items-center justify-between rounded-sm border border-border bg-container p-6 py-5 transition-all hover:border-accent/40 hover:bg-foreground/5"role="button"tabIndex={0}onClick={() => {@@ -86,7 +96,9 @@ export const SelectImportFromPlatformModal = ({ isOpen, onToggle }: Props) => {alt={`${platform.title} logo`}style={{ width: platform.size }}/>- <div className="text-center text-sm whitespace-pre-wrap">{platform.title}</div>+ <div className="text-center text-sm whitespace-pre-wrap text-foreground">+ {platform.title}+ </div></div>))}</div>@@ -102,7 +114,7 @@ export const SelectImportFromPlatformModal = ({ isOpen, onToggle }: Props) => {animate={{ opacity: 1, translateX: 0 }}exit={{ opacity: 0, translateX: -30 }}>- <EnvKeyPlatformModal onClose={() => handleFormReset(false)} />+ <EnvKeyPlatformModal onClose={() => handleOpenChange(false)} /></motion.div>)}{selectedPlatform?.platform === "vault" && (@@ -113,13 +125,13 @@ export const SelectImportFromPlatformModal = ({ isOpen, onToggle }: Props) => {animate={{ opacity: 1, translateX: 0 }}exit={{ opacity: 0, translateX: -30 }}>- <VaultPlatformModal onClose={() => handleFormReset(false)} />+ <VaultPlatformModal onClose={() => handleOpenChange(false)} /></motion.div>)}</>)}</AnimatePresence>- </ModalContent>- </Modal>+ </DialogContent>+ </Dialog>);};diff --git a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/SelectInPlatformMigrationProviderModal.tsx b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/SelectInPlatformMigrationProviderModal.tsxindex 6fb4cf12f1..0b0e626a58 100644--- a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/SelectInPlatformMigrationProviderModal.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/SelectInPlatformMigrationProviderModal.tsx@@ -1,6 +1,12 @@import { Link } from "@tanstack/react-router";-import { Modal, ModalContent } from "@app/components/v2";+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogHeader,+ DialogTitle+} from "@app/components/v3";import { useOrganization } from "@app/context";import {getInPlatformMigrationProviderMeta,@@ -23,20 +29,25 @@ export const SelectInPlatformMigrationProviderModal = ({const { currentOrg } = useOrganization();return (- <Modal isOpen={isOpen} onOpenChange={onOpenChange}>- <ModalContent title="Add migration configuration" className="max-w-lg">- <p className="mb-4 text-sm text-mineshaft-300">- Select a platform to link to in-platform migration. Credentials are managed in{" "}- <Link- to="/organizations/$orgId/app-connections"- params={{ orgId: currentOrg.id }}- className="text-primary underline hover:text-primary-300"- onClick={() => onOpenChange(false)}- >- App Connections- </Link>- .- </p>+ <Dialog open={isOpen} onOpenChange={onOpenChange}>+ <DialogContent className="max-w-lg overflow-visible" showCloseButton>+ <DialogHeader>+ <DialogTitle>Add migration configuration</DialogTitle>+ <DialogDescription asChild>+ <p>+ Select a platform to link to in-platform migration. Credentials are managed in{" "}+ <Link+ to="/organizations/$orgId/app-connections"+ params={{ orgId: currentOrg.id }}+ className="text-accent underline hover:no-underline"+ onClick={() => onOpenChange(false)}+ >+ App Connections+ </Link>+ .+ </p>+ </DialogDescription>+ </DialogHeader><div className="grid grid-cols-1 gap-2 sm:grid-cols-2">{IN_PLATFORM_MIGRATION_APP_CONNECTIONS.map((app) => {const { name, imageFileName, size } = getInPlatformMigrationProviderMeta(app);@@ -50,25 +61,23 @@ export const SelectInPlatformMigrationProviderModal = ({onSelect(app);onOpenChange(false);}}- className="group flex flex-col items-center rounded-md border border-mineshaft-600 bg-mineshaft-700 p-4 text-left duration-200 hover:bg-mineshaft-600"+ className="group flex flex-col items-center rounded-md border border-border bg-container p-4 text-left duration-200 hover:bg-foreground/5"><imgsrc={`/images/integrations/${imageFileName}`}- style={{ width: `${size}px` }}- className="mt-1"+ style={{ width: size, height: size }}+ className="mt-1 object-contain"alt=""/>- <span className="mt-3 text-center text-sm font-medium text-gray-200 group-hover:text-white">+ <span className="mt-3 text-center text-sm font-medium text-foreground group-hover:text-foreground">{name}</span>- <span className="mt-2 text-center text-xs leading-snug text-mineshaft-400">- {description}- </span>+ <span className="mt-2 text-center text-xs leading-snug text-muted">{description}</span></button>);})}</div>- </ModalContent>- </Modal>+ </DialogContent>+ </Dialog>);};diff --git a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/VaultNamespaceConfigModal.tsx b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/VaultNamespaceConfigModal.tsxindex f08aae204d..934e3355cf 100644--- a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/VaultNamespaceConfigModal.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/VaultNamespaceConfigModal.tsx@@ -1,17 +1,28 @@import { useEffect, useMemo } from "react";import { Controller, useForm } from "react-hook-form";+import { InfoIcon } from "lucide-react";import { zodResolver } from "@hookform/resolvers/zod";import { z } from "zod";import { createNotification } from "@app/components/notifications";import {Button,- FilterableSelect,- FormControl,- Input,- Modal,- ModalContent-} from "@app/components/v2";+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+ Field,+ FieldContent,+ FieldError,+ FieldLabel,+ Tooltip,+ TooltipContent,+ TooltipTrigger,+ UnstableInput+} from "@app/components/v3";+import { FilterableSelect } from "@app/components/v3/generic/ReactSelect";import { AppConnection } from "@app/hooks/api/appConnections/enums";import { useListAppConnections } from "@app/hooks/api/appConnections/queries";import {@@ -63,7 +74,6 @@ export const VaultNamespaceConfigModal = ({ isOpen, onOpenChange, editConfig }:}});- // Reset form when editConfig changes or modal opensuseEffect(() => {if (isOpen) {reset({@@ -103,26 +113,44 @@ export const VaultNamespaceConfigModal = ({ isOpen, onOpenChange, editConfig }:onOpenChange(false);};+ const isPending = isSubmitting || isCreating || isUpdating;+return (- <Modal isOpen={isOpen} onOpenChange={handleClose}>- <ModalContent- title={isEdit ? "Edit Namespace Configuration" : "Add Namespace Configuration"}- subTitle={`Configure a HashiCorp Vault namespace ${isEdit ? "configuration" : "for migration tooling"}`}- bodyClassName="overflow-visible"- >- <form onSubmit={handleSubmit(onFormSubmit)}>+ <Dialog+ open={isOpen}+ onOpenChange={(open) => {+ if (!open) {+ reset();+ onOpenChange(false);+ }+ }}+ >+ <DialogContent className="max-w-lg overflow-visible" showCloseButton>+ <DialogHeader>+ <DialogTitle>+ {isEdit ? "Edit Namespace Configuration" : "Add Namespace Configuration"}+ </DialogTitle>+ <DialogDescription>+ Configure a HashiCorp Vault namespace {isEdit ? "configuration" : "for migration tooling"}+ </DialogDescription>+ </DialogHeader>+ <form onSubmit={handleSubmit(onFormSubmit)} className="space-y-4"><Controllercontrol={control}name="namespace"render={({ field }) => (- <FormControl- label="Namespace"- isError={Boolean(errors.namespace)}- errorText={errors.namespace?.message}- className="mb-4"- >- <Input {...field} placeholder="e.g., admin, dev, prod" autoComplete="off" />- </FormControl>+ <Field>+ <FieldLabel>Namespace</FieldLabel>+ <FieldContent>+ <UnstableInput+ {...field}+ placeholder="e.g., admin, dev, prod"+ autoComplete="off"+ isError={Boolean(errors.namespace)}+ />+ </FieldContent>+ <FieldError>{errors.namespace?.message}</FieldError>+ </Field>)}/>@@ -133,49 +161,54 @@ export const VaultNamespaceConfigModal = ({ isOpen, onOpenChange, editConfig }:const selectedConnection = vaultConnections.find((conn) => conn.id === field.value);return (- <FormControl- label="Vault Connection"- isError={Boolean(errors.connectionId)}- errorText={errors.connectionId?.message}- tooltipText="Select a HashiCorp Vault app connection for this namespace"- >- <FilterableSelect- value={selectedConnection || null}- onChange={(newValue) => {- const singleValue = Array.isArray(newValue) ? newValue[0] : newValue;- if (singleValue && "id" in singleValue) {- field.onChange(singleValue.id);- } else {- field.onChange("");- }- }}- isLoading={isLoadingConnections}- options={vaultConnections}- placeholder="Select connection..."- getOptionLabel={(option) => option.name}- getOptionValue={(option) => option.id}- />- </FormControl>+ <Field>+ <FieldLabel className="inline-flex items-center gap-1">+ Vault Connection+ <Tooltip>+ <TooltipTrigger asChild>+ <span className="inline-flex cursor-default">+ <InfoIcon className="size-3 text-accent" aria-hidden />+ </span>+ </TooltipTrigger>+ <TooltipContent>+ Select a HashiCorp Vault app connection for this namespace+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <FieldContent>+ <FilterableSelect+ value={selectedConnection || null}+ onChange={(newValue) => {+ const singleValue = Array.isArray(newValue) ? newValue[0] : newValue;+ if (singleValue && "id" in singleValue) {+ field.onChange(singleValue.id);+ } else {+ field.onChange("");+ }+ }}+ isLoading={isLoadingConnections}+ options={vaultConnections}+ placeholder="Select connection..."+ getOptionLabel={(option) => option.name}+ getOptionValue={(option) => option.id}+ />+ </FieldContent>+ <FieldError>{errors.connectionId?.message}</FieldError>+ </Field>);}}/>- <div className="mt-8 flex items-center gap-2">- <Button- className="mr-4"- size="sm"- type="submit"- isLoading={isSubmitting || isCreating || isUpdating}- isDisabled={isSubmitting || isCreating || isUpdating}- >- {isEdit ? "Update" : "Create"}- </Button>- <Button colorSchema="secondary" variant="plain" onClick={handleClose}>+ <DialogFooter className="gap-2 sm:gap-2">+ <Button type="button" variant="ghost" onClick={handleClose}>Cancel</Button>- </div>+ <Button type="submit" variant="project" isPending={isPending} isDisabled={isPending}>+ {isEdit ? "Update" : "Create"}+ </Button>+ </DialogFooter></form>- </ModalContent>- </Modal>+ </DialogContent>+ </Dialog>);};diff --git a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/VaultPlatformModal.tsx b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/VaultPlatformModal.tsxindex d793a1e1e7..c6ad945780 100644--- a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/VaultPlatformModal.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/VaultPlatformModal.tsx@@ -1,6 +1,5 @@import { Controller, useForm } from "react-hook-form";-import { faQuestionCircle } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { CircleHelpIcon } from "lucide-react";import { zodResolver } from "@hookform/resolvers/zod";import { useQuery } from "@tanstack/react-query";import { twMerge } from "tailwind-merge";@@ -8,8 +7,25 @@ import { z } from "zod";import { createNotification } from "@app/components/notifications";import { OrgPermissionCan } from "@app/components/permissions";-import { Button, FormControl, Input, Select, SelectItem, Tooltip } from "@app/components/v2";-import { NoticeBannerV2 } from "@app/components/v2/NoticeBannerV2/NoticeBannerV2";+import {+ Button,+ Field,+ FieldContent,+ FieldError,+ FieldLabel,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+ Tooltip,+ TooltipContent,+ TooltipTrigger,+ UnstableAlert,+ UnstableAlertDescription,+ UnstableAlertTitle,+ UnstableInput+} from "@app/components/v3";import {OrgGatewayPermissionActions,OrgPermissionSubjects@@ -30,6 +46,69 @@ enum VaultMappingType {Custom = "custom"}+const GATEWAY_NONE = "__gateway_none__";++type VaultGatewaySelectProps = {+ isAllowed: boolean;+ isGatewayLoading: boolean;+ value: string | undefined;+ onChange: (next: string | undefined) => void;+ hasError: boolean;+ gateways?: { id: string; name: string }[];+};++function VaultGatewaySelect({+ isAllowed,+ isGatewayLoading,+ value,+ onChange,+ hasError,+ gateways+}: VaultGatewaySelectProps) {+ const select = (+ <Select+ value={value ? value : GATEWAY_NONE}+ onValueChange={(v) => {+ onChange(v === GATEWAY_NONE ? undefined : v);+ }}+ disabled={!isAllowed || isGatewayLoading}+ >+ <SelectTrigger+ size="default"+ className="w-full min-w-0 max-w-none"+ aria-invalid={hasError}+ >+ <SelectValue+ placeholder={isGatewayLoading ? "Loading gateways…" : "Internet Gateway"}+ />+ </SelectTrigger>+ <SelectContent position="popper" className="min-w-(--radix-select-trigger-width)">+ <SelectItem value={GATEWAY_NONE}>Internet Gateway</SelectItem>+ {gateways?.map((el) => (+ <SelectItem value={el.id} key={el.id}>+ {el.name}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ );++ if (isAllowed) {+ return select;+ }++ return (+ <Tooltip>+ <TooltipTrigger asChild>+ <span className="block w-full cursor-not-allowed">{select}</span>+ </TooltipTrigger>+ <TooltipContent>+ Restricted access. You don't have permission to attach gateways to resources.+ </TooltipContent>+ </Tooltip>+ );+}+const MAPPING_TYPE_MENU_ITEMS = [{isCustom: false,@@ -57,9 +136,9 @@ const MAPPING_TYPE_MENU_ITEMS = [label: "Namespaces",tooltip: (<div>- When using namespaces for mapping, each namespace within Vault will be created in Infisical- as a project. Each key vault (KV) inside the namespace, will be created as an environment- inside the corresponding project.+ When using namespaces for mapping, each namespace within Vault will be created in Infisical as+ a project. Each key vault (KV) inside the namespace, will be created as an environment inside+ the corresponding project.<div className="mt-4 flex flex-col gap-1 text-sm"><div>Namespace → Project</div><div>Key Vault → Project Environment</div>@@ -128,16 +207,19 @@ export const VaultPlatformModal = ({ onClose }: Props) => {return (<div>- <NoticeBannerV2 title="Vault KV Secret Engine Import" className="mb-4">- <p className="text-sm">- The Vault migration currently supports importing static secrets from Vault- Dedicated/Self-Hosted.- <div className="mt-2 text-xs opacity-80">+ <UnstableAlert variant="info" className="mb-4">+ <UnstableAlertTitle>Vault KV Secret Engine Import</UnstableAlertTitle>+ <UnstableAlertDescription>+ <p>+ The Vault migration currently supports importing static secrets from Vault+ Dedicated/Self-Hosted.+ </p>+ <p className="mt-2 text-xs opacity-80">Currently only KV Secret Engine is supported for Vault migrations.- </div>- </p>- </NoticeBannerV2>- <form onSubmit={handleSubmit(onSubmit)} autoComplete="off">+ </p>+ </UnstableAlertDescription>+ </UnstableAlert>+ <form onSubmit={handleSubmit(onSubmit)} autoComplete="off" className="space-y-4"><div className="w-full flex-1"><OrgPermissionCanI={OrgGatewayPermissionActions.AttachGateways}@@ -149,48 +231,23 @@ export const VaultPlatformModal = ({ onClose }: Props) => {name="gatewayId"defaultValue=""render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error?.message)}- errorText={error?.message}- label="Gateway"- isOptional- >- <Tooltip- isDisabled={isAllowed}- content="Restricted access. You don't have permission to attach gateways to resources."- >- <div>- <Select- isDisabled={!isAllowed}- value={value as string}- onValueChange={(v) => {- if (v !== "") {- onChange(v);- }- }}- className="w-full border border-mineshaft-500"- dropdownContainerClassName="max-w-none"- isLoading={isGatewayLoading}- placeholder="Default: Internet Gateway"- position="popper"- >- <SelectItem- value={undefined as unknown as string}- onClick={() => {- onChange(undefined);- }}- >- Internet Gateway- </SelectItem>- {gateways?.map((el) => (- <SelectItem value={el.id} key={el.id}>- {el.name}- </SelectItem>- ))}- </Select>- </div>- </Tooltip>- </FormControl>+ <Field>+ <FieldLabel className="inline-flex flex-wrap items-baseline gap-1.5">+ Gateway+ <span className="text-xs font-normal text-muted">(optional)</span>+ </FieldLabel>+ <FieldContent>+ <VaultGatewaySelect+ isAllowed={isAllowed}+ isGatewayLoading={isGatewayLoading}+ value={value}+ onChange={onChange}+ hasError={Boolean(error)}+ gateways={gateways}+ />+ </FieldContent>+ <FieldError>{error?.message}</FieldError>+ </Field>)}/>)}@@ -201,41 +258,39 @@ export const VaultPlatformModal = ({ onClose }: Props) => {control={control}name="vaultUrl"render={({ field, fieldState: { error } }) => (- <FormControl- label="Vault URL"- isRequired- errorText={error?.message}- isError={Boolean(error)}- >- <Input placeholder="" {...field} />- </FormControl>+ <Field>+ <FieldLabel>Vault URL</FieldLabel>+ <FieldContent>+ <UnstableInput placeholder="" {...field} isError={Boolean(error)} />+ </FieldContent>+ <FieldError>{error?.message}</FieldError>+ </Field>)}/><Controllercontrol={control}name="vaultNamespace"render={({ field, fieldState: { error } }) => (- <FormControl- label="Vault Namespace"- errorText={error?.message}- isError={Boolean(error)}- >- <Input type="text" placeholder="" {...field} />- </FormControl>+ <Field>+ <FieldLabel>Vault Namespace</FieldLabel>+ <FieldContent>+ <UnstableInput type="text" placeholder="" {...field} isError={Boolean(error)} />+ </FieldContent>+ <FieldError>{error?.message}</FieldError>+ </Field>)}/><Controllercontrol={control}name="vaultAccessToken"render={({ field, fieldState: { error } }) => (- <FormControl- label="Vault Access Token"- isRequired- errorText={error?.message}- isError={Boolean(error)}- >- <Input type="password" placeholder="" {...field} />- </FormControl>+ <Field>+ <FieldLabel>Vault Access Token</FieldLabel>+ <FieldContent>+ <UnstableInput type="password" placeholder="" {...field} isError={Boolean(error)} />+ </FieldContent>+ <FieldError>{error?.message}</FieldError>+ </Field>)}/><Controller@@ -243,71 +298,73 @@ export const VaultPlatformModal = ({ onClose }: Props) => {name="mappingType"defaultValue={VaultMappingType.KeyVault}render={({ field, fieldState: { error } }) => (- <FormControl- label="Project Mapping"- isError={Boolean(error)}- isRequired- errorText={error?.message}- className="flex-1"- >- <div className="mt-2 grid grid-cols-2 gap-4">- {MAPPING_TYPE_MENU_ITEMS.map((el) => (- <div- key={el.value}- className={twMerge(- "flex w-full cursor-pointer flex-col items-center gap-2 rounded-sm border border-mineshaft-600 p-4 opacity-75 transition-all",- field.value === el.value- ? "border-opacity-70 border-primary-700 bg-mineshaft-700 opacity-100"- : "hover:border-primary-800/75 hover:bg-mineshaft-600",- el.isCustom && "col-span-2",- el.isCustom &&- !isCustomMigrationAvailable?.data?.enabled &&- "cursor-not-allowed! border-mineshaft-600! bg-mineshaft-600! opacity-40!"- )}- onClick={() => {- if (el.isCustom && !isCustomMigrationAvailable?.data?.enabled) return;+ <Field>+ <FieldLabel>Project Mapping</FieldLabel>+ <FieldContent>+ <div className="mt-2 grid grid-cols-2 gap-4">+ {MAPPING_TYPE_MENU_ITEMS.map((el) => (+ <div+ key={el.value}+ className={twMerge(+ "flex w-full cursor-pointer flex-col items-center gap-2 rounded-sm border border-border bg-container/50 p-4 opacity-75 transition-all",+ field.value === el.value+ ? "border-project/50 bg-container opacity-100"+ : "hover:border-accent/30 hover:bg-foreground/5",+ el.isCustom && "col-span-2",+ el.isCustom &&+ !isCustomMigrationAvailable?.data?.enabled &&+ "pointer-events-none cursor-not-allowed border-border bg-muted/30 opacity-40"+ )}+ onClick={() => {+ if (el.isCustom && !isCustomMigrationAvailable?.data?.enabled) return;- field.onChange(el.value);- }}- onKeyDown={(e) => {- if (e.key !== "Enter") return;- if (el.isCustom && !isCustomMigrationAvailable?.data?.enabled) return;+ field.onChange(el.value);+ }}+ onKeyDown={(e) => {+ if (e.key !== "Enter") return;+ if (el.isCustom && !isCustomMigrationAvailable?.data?.enabled) return;- field.onChange(el.value);- }}- role="button"- tabIndex={0}- >- <div className="flex items-center gap-1">- <div className="text-center text-sm">{el.label}</div>- {el.tooltip && (- <div className="text-center text-sm">- <Tooltip content={el.tooltip} className="max-w-96">- <FontAwesomeIcon- size="sm"- className="text-mineshaft-400"- icon={faQuestionCircle}- />+ field.onChange(el.value);+ }}+ role="button"+ tabIndex={0}+ >+ <div className="flex items-center gap-1">+ <div className="text-center text-sm text-foreground">{el.label}</div>+ {el.tooltip && (+ <Tooltip>+ <TooltipTrigger asChild>+ <button+ type="button"+ className="inline-flex text-muted hover:text-foreground"+ onClick={(e) => e.stopPropagation()}+ >+ <CircleHelpIcon className="size-4" aria-label="More info" />+ </button>+ </TooltipTrigger>+ <TooltipContent className="max-w-96">{el.tooltip}</TooltipContent></Tooltip>- </div>- )}+ )}+ </div></div>- </div>- ))}- </div>- </FormControl>+ ))}+ </div>+ </FieldContent>+ <FieldError>{error?.message}</FieldError>+ </Field>)}/>- <div className="mt-6 flex items-center space-x-4">+ <div className="flex items-center gap-2 pt-2"><Buttontype="submit"- isLoading={isLoading}+ variant="project"+ isPending={isLoading || isSubmitting}isDisabled={!isDirty || isSubmitting || isLoading || !isValid}>Import Data</Button>- <Button variant="outline_bg" onClick={onClose}>+ <Button type="button" variant="outline" onClick={onClose}>Cancel</Button></div>