Skip to content

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

improvement(ui): migrate org access, settings, auth and project template overlays to V3 (#8611)

Andrew Huang655d3d02f6e2
diff --git a/frontend/src/pages/auth/SelectOrgPage/EmailDuplicationConfirmation.tsx b/frontend/src/pages/auth/SelectOrgPage/EmailDuplicationConfirmation.tsx
deleted file mode 100644
index 48d1a42093..0000000000
--- a/frontend/src/pages/auth/SelectOrgPage/EmailDuplicationConfirmation.tsx
+++ /dev/null
@@ -1,155 +0,0 @@
-import { useCallback } from "react";
-import { Helmet } from "react-helmet";
-import { useTranslation } from "react-i18next";
-import { faInfoCircle } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useNavigate } from "@tanstack/react-router";
-import { format } from "date-fns";
-
-import { AuthPageLayout } from "@app/components/auth/AuthPageLayout";
-import { AuthPagePanel } from "@app/components/auth/AuthPagePanel";
-import { createNotification } from "@app/components/notifications";
-import { Button, DeleteActionModal, Tooltip } from "@app/components/v2";
-import { usePopUp } from "@app/hooks";
-import {
- useGetMyDuplicateAccount,
- useLogoutUser,
- useRemoveMyDuplicateAccounts
-} from "@app/hooks/api";
-
-type Props = {
- onRemoveDuplicateLater: () => void;
-};
-
-export const EmailDuplicationConfirmation = ({ onRemoveDuplicateLater }: Props) => {
- const duplicateAccounts = useGetMyDuplicateAccount();
- const removeDuplicateEmails = useRemoveMyDuplicateAccounts();
- const { t } = useTranslation();
- const navigate = useNavigate();
- const logout = useLogoutUser();
- const { popUp, handlePopUpToggle } = usePopUp(["removeDuplicateConfirm"] as const);
- const handleLogout = useCallback(async () => {
- try {
- console.log("Logging out...");
- await logout.mutateAsync();
- navigate({ to: "/login" });
- } catch (error) {
- console.error(error);
- }
- }, [logout, navigate]);
-
- return (
- <>
- <AuthPageLayout variant="focused" showFooter={false} contentClassName="max-w-2xl">
- <Helmet>
- <title>{t("common.head-title", { title: t("login.title") })}</title>
- <link rel="icon" href="/infisical.ico" />
- <meta property="og:image" content="/images/message.png" />
- <meta property="og:title" content={t("login.og-title") ?? ""} />
- <meta name="og:description" content={t("login.og-description") ?? ""} />
- </Helmet>
- <AuthPagePanel>
- <form className="mx-auto flex w-full flex-col">
- <div className="mb-6">
- <h1 className="mb-2 font-alliance text-2xl font-normal text-foreground">
- Multiple Accounts Detected
- </h1>
- <p className="mb-4 text-sm text-label">
- <span>You&apos;re currently logged in as</span>{" "}
- <b>{duplicateAccounts?.data?.myAccount?.username}</b>.
- </p>
- <div className="mt-4 mb-4 flex flex-col rounded-r border-l-2 border-l-project bg-label/5 px-4 py-2.5">
- <p className="mt-1 mb-2 text-sm text-label-secondary">
- We&apos;ve detected multiple accounts using variations of the same email address.
- </p>
- </div>
- </div>
- <div className="mb-4 w-full border-b border-border-emphasis pb-1 text-sm text-foreground-secondary">
- Your other accounts
- </div>
- <div className="flex h-full max-h-60 thin-scrollbar w-full flex-col items-stretch gap-2 overflow-auto rounded-md">
- {duplicateAccounts?.data?.duplicateAccounts?.map((el) => {
- const lastSession = el.devices?.at(-1);
- return (
- <div
- key={el.id}
- className="flex items-center gap-8 rounded-md bg-surface-hover px-4 py-3 text-foreground-cool"
- >
- <div className="group flex grow flex-col">
- <div className="truncate text-sm transition-colors">{el.username}</div>
- <div className="mt-2 text-xs">
- Last logged in at {format(new Date(el.updatedAt), "Pp")}
- </div>
- <div className="mt-2 text-xs">
- Organizations: {el?.organizations?.map((i) => i.slug)?.join(",")}
- </div>
- </div>
- <div>
- <Tooltip
- className="max-w-lg"
- content={
- <div className="flex flex-col space-y-1 text-sm">
- <div>IP: {lastSession?.ip || "-"}</div>
- <div>User Agent: {lastSession?.userAgent || "-"}</div>
- </div>
- }
- >
- <FontAwesomeIcon icon={faInfoCircle} />
- </Tooltip>
- </div>
- </div>
- );
- })}
- </div>
- <div className="mt-4 flex w-full flex-col">
- <div className="flex gap-6">
- <Button
- className="flex-1 grow"
- isLoading={removeDuplicateEmails.isPending}
- onClick={() => handlePopUpToggle("removeDuplicateConfirm", true)}
- >
- Delete all other accounts
- </Button>
- <Button
- variant="outline_bg"
- onClick={() => onRemoveDuplicateLater()}
- className="flex-1 grow"
- >
- Remind me later
- </Button>
- </div>
- <Button
- isLoading={logout.isPending}
- variant="plain"
- colorSchema="secondary"
- className="mt-4"
- onClick={handleLogout}
- >
- Change Account
- </Button>
- </div>
- </form>
- </AuthPagePanel>
- </AuthPageLayout>
- <DeleteActionModal
- isOpen={popUp.removeDuplicateConfirm.isOpen}
- subTitle={`You’re currently logged in as ${duplicateAccounts?.data?.myAccount?.username}. Once you confirm, your other duplicate accounts will be permanently removed. Please make sure none of those accounts contain any production secrets, as this action cannot be undone.`}
- title="Confirmation Required"
- onChange={(isOpen) => handlePopUpToggle("removeDuplicateConfirm", isOpen)}
- deleteKey="remove"
- buttonText="Confirm"
- onDeleteApproved={() =>
- removeDuplicateEmails.mutateAsync(undefined, {
- onSuccess: () => {
- createNotification({
- type: "success",
- text: "Removed duplicate accounts"
- });
- onRemoveDuplicateLater();
- }
- })
- }
- />
- </>
- );
-};
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgGroupsTab/components/OrgGroupsSection/OrgGroupsSection.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgGroupsTab/components/OrgGroupsSection/OrgGroupsSection.tsx
index c5ed4a390f..f2fff43aab 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgGroupsTab/components/OrgGroupsSection/OrgGroupsSection.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgGroupsTab/components/OrgGroupsSection/OrgGroupsSection.tsx
@@ -4,7 +4,6 @@ import { PlusIcon } from "lucide-react";
import { GroupsUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
-import { DeleteActionModal } from "@app/components/v2";
import {
Button,
Card,
@@ -13,6 +12,7 @@ import {
CardDescription,
CardHeader,
CardTitle,
+ DeleteConfirmDialog,
DocumentationLinkBadge
} from "@app/components/v3";
import {
@@ -115,7 +115,7 @@ export const OrgGroupsSection = () => {
setWizardStep={setWizardStep}
isSubOrganization={isSubOrganization}
/>
- <DeleteActionModal
+ <DeleteConfirmDialog
isOpen={popUp.deleteGroup.isOpen}
title={
(popUp?.deleteGroup?.data as { name: string; isLinkedGroup?: boolean })?.isLinkedGroup
@@ -126,9 +126,10 @@ export const OrgGroupsSection = () => {
(popUp?.deleteGroup?.data as { name: string })?.name || ""
}?`
}
- onChange={(isOpen) => handlePopUpToggle("deleteGroup", isOpen)}
- deleteKey="confirm"
- onDeleteApproved={() =>
+ description="This action is irreversible."
+ onOpenChange={(isOpen) => handlePopUpToggle("deleteGroup", isOpen)}
+ confirmKey="confirm"
+ onConfirm={() =>
onDeleteGroupSubmit(
popUp?.deleteGroup?.data as { name: string; groupId: string; isLinkedGroup?: boolean }
)
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/VaultKubernetesAuthImportModal.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/VaultKubernetesAuthImportModal.tsx
deleted file mode 100644
index 71a610a305..0000000000
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/VaultKubernetesAuthImportModal.tsx
+++ /dev/null
@@ -1,221 +0,0 @@
-import { useEffect, useState } from "react";
-
-import {
- defaultVaultConnectionId,
- VaultConnectionAndNamespaceFields
-} from "@app/components/external-migrations";
-import { createNotification } from "@app/components/notifications";
-import {
- Button,
- FilterableSelect,
- FormControl,
- Modal,
- ModalClose,
- ModalContent
-} from "@app/components/v2";
-import { TAvailableAppConnection } from "@app/hooks/api/appConnections/types";
-import {
- useGetVaultAuthMounts,
- useGetVaultKubernetesAuthRoles
-} from "@app/hooks/api/migration/queries";
-import { VaultKubernetesAuthRole } from "@app/hooks/api/migration/types";
-
-type Props = {
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
- appConnections: TAvailableAppConnection[];
- onImport: (role: VaultKubernetesAuthRole) => void;
-};
-
-type ContentProps = {
- onClose: () => void;
- appConnections: TAvailableAppConnection[];
- onImport: (role: VaultKubernetesAuthRole) => void;
-};
-
-const Content = ({ onClose, appConnections, onImport }: ContentProps) => {
- const hasAppConnections = appConnections.length > 0;
- const [selectedConnectionId, setSelectedConnectionId] = useState<string | null>(
- defaultVaultConnectionId(appConnections)
- );
- const [selectedNamespace, setSelectedNamespace] = useState<string | null>(null);
- const [selectedMountPath, setSelectedMountPath] = useState<string | null>(null);
- const [selectedRole, setSelectedRole] = useState<VaultKubernetesAuthRole | null>(null);
- const [shouldFetchRoles, setShouldFetchRoles] = useState(false);
- const [shouldFetchMounts, setShouldFetchMounts] = useState(false);
-
- const activeConnectionId = hasAppConnections ? (selectedConnectionId ?? undefined) : undefined;
-
- const { data: authMounts, isLoading: isLoadingMounts } = useGetVaultAuthMounts(
- shouldFetchMounts,
- selectedNamespace ?? undefined,
- "kubernetes",
- activeConnectionId
- );
- const { data: roles, isLoading: isLoadingRoles } = useGetVaultKubernetesAuthRoles(
- shouldFetchRoles,
- selectedNamespace ?? undefined,
- selectedMountPath ?? undefined,
- activeConnectionId
- );
-
- const handleConnectionChange = (id: string | null) => {
- setSelectedConnectionId(id);
- setSelectedNamespace(null);
- setSelectedMountPath(null);
- setSelectedRole(null);
- setShouldFetchMounts(false);
- setShouldFetchRoles(false);
- };
-
- const handleNamespaceChange = (ns: string | null) => {
- setSelectedNamespace(ns);
- setSelectedMountPath(null);
- setSelectedRole(null);
- };
-
- useEffect(() => {
- if (selectedNamespace) {
- setShouldFetchMounts(true);
- }
- }, [selectedNamespace]);
-
- useEffect(() => {
- if (selectedNamespace && selectedMountPath) {
- setShouldFetchRoles(true);
- } else {
- setShouldFetchRoles(false);
- }
- }, [selectedNamespace, selectedMountPath]);
-
- const handleImportAndApply = () => {
- if (!selectedRole) {
- createNotification({
- type: "error",
- text: "Please select a Kubernetes role to load"
- });
- return;
- }
-
- if (hasAppConnections && !selectedConnectionId) {
- createNotification({ type: "error", text: "Please select an app connection" });
- return;
- }
-
- onImport(selectedRole);
- onClose();
- };
-
- return (
- <>
- <VaultConnectionAndNamespaceFields
- appConnections={appConnections}
- connectionId={selectedConnectionId}
- onConnectionIdChange={handleConnectionChange}
- namespace={selectedNamespace}
- onNamespaceChange={handleNamespaceChange}
- namespaceTooltip="Select the Vault namespace containing the Kubernetes auth configuration."
- namespaceHelpText="Select the Vault namespace to fetch available auth mounts"
- />
-
- <FormControl
- label="Auth Engine"
- className="mb-4"
- tooltipText="Select the Kubernetes auth engine to narrow down available roles."
- >
- <>
- <FilterableSelect
- value={
- selectedMountPath
- ? authMounts?.find((mount) => mount.path === selectedMountPath)
- : null
- }
- onChange={(value) => {
- if (value && !Array.isArray(value)) {
- const mount = value as { path: string; type: string };
- setSelectedMountPath(mount.path.replace(/\/$/, ""));
- setSelectedRole(null);
- } else {
- setSelectedMountPath(null);
- }
- }}
- options={authMounts || []}
- getOptionValue={(option) => option.path}
- getOptionLabel={(option) => option.path.replace(/\/$/, "")}
- isDisabled={isLoadingMounts || !authMounts?.length}
- placeholder="Select auth engine..."
- isClearable
- className="w-full"
- />
- <p className="mt-1 text-xs text-muted">
- Choose a Kubernetes auth engine to filter available roles
- </p>
- </>
- </FormControl>
-
- <FormControl label="Kubernetes Role" className="mb-6">
- <>
- <FilterableSelect
- value={selectedRole}
- onChange={(value) => {
- if (value && !Array.isArray(value)) {
- setSelectedRole(value as VaultKubernetesAuthRole);
- } else {
- setSelectedRole(null);
- }
- }}
- options={roles || []}
- getOptionValue={(option) => option.name}
- getOptionLabel={(option) => option.name}
- isDisabled={isLoadingRoles || !roles?.length || !selectedMountPath}
- placeholder={
- !selectedMountPath
- ? "Select an auth engine first..."
- : "Select a Kubernetes role to load..."
- }
- isClearable
- className="w-full"
- />
- <p className="mt-1 text-xs text-muted">
- Select the Kubernetes role to load configuration from
- </p>
- </>
- </FormControl>
-
- <div className="mt-8 flex space-x-4">
- <Button onClick={handleImportAndApply} isDisabled={!selectedRole || isLoadingRoles}>
- Load
- </Button>
- <ModalClose asChild>
- <Button colorSchema="secondary" variant="plain">
- Cancel
- </Button>
- </ModalClose>
- </div>
- </>
- );
-};
-
-export const VaultKubernetesAuthImportModal = ({
- isOpen,
- onOpenChange,
- appConnections,
- onImport
-}: Props) => {
- return (
- <Modal isOpen={isOpen} onOpenChange={onOpenChange}>
- <ModalContent
- bodyClassName="overflow-visible"
- title="Load Kubernetes Auth from HashiCorp Vault"
- subTitle="Load Kubernetes authentication configuration from your Vault instance. The auth method and role settings will be automatically translated and prefilled in the form."
- className="max-w-2xl"
- >
- <Content
- onClose={() => onOpenChange(false)}
- appConnections={appConnections}
- onImport={onImport}
- />
- </ModalContent>
- </Modal>
- );
-};
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgRoleTabSection/OrgRoleTable.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgRoleTabSection/OrgRoleTable.tsx
index 777f1cd05b..b5c12aaae4 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgRoleTabSection/OrgRoleTable.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgRoleTabSection/OrgRoleTable.tsx
@@ -18,7 +18,6 @@ import { twMerge } from "tailwind-merge";
import { CustomRolesUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
-import { DeleteActionModal } from "@app/components/v2";
import {
Badge,
Button,
@@ -28,6 +27,7 @@ import {
CardDescription,
CardHeader,
CardTitle,
+ DeleteConfirmDialog,
DocumentationLinkBadge,
DropdownMenu,
DropdownMenuContent,
@@ -503,15 +503,15 @@ export const OrgRoleTable = () => {
</CardContent>
</Card>
<RoleModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />
- <DeleteActionModal
+ <DeleteConfirmDialog
isOpen={popUp.deleteRole.isOpen}
title={`Are you sure you want to delete ${
(popUp?.deleteRole?.data as TOrgRole)?.name || " "
} role?`}
- onChange={(isOpen) => handlePopUpToggle("deleteRole", isOpen)}
- deleteKey={(popUp?.deleteRole?.data as TOrgRole)?.slug || ""}
- onClose={() => handlePopUpClose("deleteRole")}
- onDeleteApproved={handleRoleDelete}
+ description="This action is irreversible."
+ onOpenChange={(isOpen) => handlePopUpToggle("deleteRole", isOpen)}
+ confirmKey={(popUp?.deleteRole?.data as TOrgRole)?.slug || ""}
+ onConfirm={handleRoleDelete}
/>
<UpgradeGate
intent={{
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/UpgradePrivilegeSystemModal/UpgradePrivilegeSystemModal.tsx b/frontend/src/pages/organization/AccessManagementPage/components/UpgradePrivilegeSystemModal/UpgradePrivilegeSystemModal.tsx
index 6832d61c9a..7177cf7f00 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/UpgradePrivilegeSystemModal/UpgradePrivilegeSystemModal.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/UpgradePrivilegeSystemModal/UpgradePrivilegeSystemModal.tsx
@@ -4,9 +4,25 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
-import { Button, Checkbox, Modal, ModalContent, Tooltip } from "@app/components/v2";
+import {
+ Button,
+ Checkbox,
+ Dialog,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ Field,
+ FieldContent,
+ FieldGroup,
+ FieldLabel,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import { useOrgPermission } from "@app/context";
import { OrgMembershipRole } from "@app/helpers/roles";
+import { useScopeVariant } from "@app/hooks";
import { useUpgradePrivilegeSystem } from "@app/hooks/api";
const formSchema = z.object({
@@ -24,6 +40,7 @@ type Props = {
export const UpgradePrivilegeSystemModal = ({ isOpen, onOpenChange }: Props) => {
const { hasOrgRole } = useOrgPermission();
const [step, setStep] = useState<"info" | "upgrade">("info");
+ const scopeVariant = useScopeVariant();
const {
handleSubmit,
@@ -62,10 +79,13 @@ export const UpgradePrivilegeSystemModal = ({ isOpen, onOpenChange }: Props) =>
const isAdmin = hasOrgRole(OrgMembershipRole.Admin);
return (
- <Modal isOpen={isOpen} onOpenChange={handleClose}>
- <ModalContent title="Privilege Management System Upgrade" className="max-w-2xl">
+ <Dialog open={isOpen} onOpenChange={handleClose}>
+ <DialogContent isPending={isSubmitting}>
+ <DialogHeader>
+ <DialogTitle>Privilege Management System Upgrade</DialogTitle>
+ </DialogHeader>
{step === "info" ? (
- <div className="mb-4">
+ <div>
<p className="mb-4 text-sm text-label">
We&apos;ve developed an improved privilege management system that enhances how access
controls work in your organization.
@@ -136,20 +156,14 @@ export const UpgradePrivilegeSystemModal = ({ isOpen, onOpenChange }: Props) =>
</div>
</div>
- <div className="mt-4 flex justify-end">
- <Button
- onClick={() => setStep("upgrade")}
- variant="solid"
- colorSchema="primary"
- size="md"
- className="w-[120px] bg-project hover:bg-project"
- >
+ <DialogFooter>
+ <Button onClick={() => setStep("upgrade")} variant={scopeVariant}>
Continue
</Button>
- </div>
+ </DialogFooter>
</div>
) : (
- <div className="mb-4">
+ <form onSubmit={handleSubmit(handlePrivilegeSystemUpgrade)}>
<p className="mb-4 text-sm text-label">
Your existing access control workflows will continue to function. However, actions
that involve modifying privileges or permissions will now use the new permission-based
@@ -171,25 +185,31 @@ export const UpgradePrivilegeSystemModal = ({ isOpen, onOpenChange }: Props) =>
<div className="mb-4">
<p className="mb-3 text-sm font-medium">Required preparation checklist:</p>
- <div className="flex flex-col space-y-4">
+ <FieldGroup>
<Controller
control={control}
name="isProjectPrivilegesUpdated"
defaultValue={false}
render={({ field: { onBlur, value, onChange }, fieldState: { error } }) => (
- <Checkbox
- containerClassName="items-start"
- className="mt-0.5 items-start"
- id="is-project-privileges-updated"
- indicatorClassName="flex h-full w-full items-center justify-center"
- allowMultilineLabel
- isChecked={value}
- onCheckedChange={onChange}
- onBlur={onBlur}
- isError={Boolean(error?.message)}
- >
- I have reviewed project-level privileges and updated them if necessary
- </Checkbox>
+ <Field orientation="horizontal" data-invalid={Boolean(error)}>
+ <Checkbox
+ id="is-project-privileges-updated"
+ variant={scopeVariant}
+ isChecked={value}
+ onCheckedChange={(checked) => onChange(checked === true)}
+ onBlur={onBlur}
+ isError={Boolean(error)}
+ />
+ <FieldContent>
+ <FieldLabel
+ htmlFor="is-project-privileges-updated"
+ className="cursor-pointer"
+ size="sm"
+ >
+ I have reviewed project-level privileges and updated them if necessary
+ </FieldLabel>
+ </FieldContent>
+ </Field>
)}
/>
<Controller
@@ -197,19 +217,26 @@ export const UpgradePrivilegeSystemModal = ({ isOpen, onOpenChange }: Props) =>
name="isOrgPrivilegesUpdated"
defaultValue={false}
render={({ field: { onBlur, value, onChange }, fieldState: { error } }) => (
- <Checkbox
- containerClassName="items-start"
- className="mt-0.5 items-start"
- id="is-org-privileges-updated"
- indicatorClassName="flex h-full w-full items-center justify-center"
- allowMultilineLabel
- isChecked={value}
- onCheckedChange={onChange}
- onBlur={onBlur}
- isError={Boolean(error?.message)}
- >
- I have reviewed organization-level privileges and updated them if necessary
- </Checkbox>
+ <Field orientation="horizontal" data-invalid={Boolean(error)}>
+ <Checkbox
+ id="is-org-privileges-updated"
+ variant={scopeVariant}
+ isChecked={value}
+ onCheckedChange={(checked) => onChange(checked === true)}
+ onBlur={onBlur}
+ isError={Boolean(error)}
+ />
+ <FieldContent>
+ <FieldLabel
+ htmlFor="is-org-privileges-updated"
+ className="cursor-pointer"
+ size="sm"
+ >
+ I have reviewed organization-level privileges and updated them if
+ necessary
+ </FieldLabel>
+ </FieldContent>
+ </Field>
)}
/>
<Controller
@@ -217,20 +244,26 @@ export const UpgradePrivilegeSystemModal = ({ isOpen, onOpenChange }: Props) =>
name="isInfrastructureUpdated"
defaultValue={false}
render={({ field: { onBlur, value, onChange }, fieldState: { error } }) => (
- <Checkbox
- containerClassName="items-start"
- className="mt-0.5 items-start"
- id="is-infrastructure-updated"
- indicatorClassName="flex h-full w-full items-center justify-center"
- allowMultilineLabel
- isChecked={value}
- onCheckedChange={onChange}
- onBlur={onBlur}
- isError={Boolean(error?.message)}
- >
- I have checked Terraform configurations and API integrations for
- compatibility with the new system
- </Checkbox>
+ <Field orientation="horizontal" data-invalid={Boolean(error)}>
+ <Checkbox
+ id="is-infrastructure-updated"
+ variant={scopeVariant}
+ isChecked={value}
+ onCheckedChange={(checked) => onChange(checked === true)}
+ onBlur={onBlur}
+ isError={Boolean(error)}
+ />
+ <FieldContent>
+ <FieldLabel
+ htmlFor="is-infrastructure-updated"
+ className="cursor-pointer"
+ size="sm"
+ >
+ I have checked Terraform configurations and API integrations for
+ compatibility with the new system
+ </FieldLabel>
+ </FieldContent>
+ </Field>
)}
/>
<Controller
@@ -238,59 +271,61 @@ export const UpgradePrivilegeSystemModal = ({ isOpen, onOpenChange }: Props) =>
name="acknowledgesPermanentChange"
defaultValue={false}
render={({ field: { onBlur, value, onChange }, fieldState: { error } }) => (
- <Checkbox
- containerClassName="items-start"
- className="mt-0.5 items-start"
- id="acknowledges-permanent-change"
- indicatorClassName="flex h-full w-full items-center justify-center"
- allowMultilineLabel
- isChecked={value}
- onCheckedChange={onChange}
- onBlur={onBlur}
- isError={Boolean(error?.message)}
- >
- I understand that this upgrade is permanent and cannot be reversed
- </Checkbox>
+ <Field orientation="horizontal" data-invalid={Boolean(error)}>
+ <Checkbox
+ id="acknowledges-permanent-change"
+ variant={scopeVariant}
+ isChecked={value}
+ onCheckedChange={(checked) => onChange(checked === true)}
+ onBlur={onBlur}
+ isError={Boolean(error)}
+ />
+ <FieldContent>
+ <FieldLabel
+ htmlFor="acknowledges-permanent-change"
+ className="cursor-pointer"
+ size="sm"
+ >
+ I understand that this upgrade is permanent and cannot be reversed
+ </FieldLabel>
+ </FieldContent>
+ </Field>
)}
/>
- </div>
+ </FieldGroup>
</div>
</div>
- <form onSubmit={handleSubmit(handlePrivilegeSystemUpgrade)}>
- <div className="mt-6 flex items-center justify-end gap-4">
- <button
- type="button"
- onClick={() => setStep("info")}
- className="w-[120px] text-sm text-label hover:text-foreground-secondary"
- >
- Cancel
- </button>
- <Tooltip
- content={
- !isAdmin
- ? "You cannot perform this upgrade because you are not an organization admin."
- : undefined
- }
+ <DialogFooter>
+ <Button variant="ghost" isDisabled={isSubmitting} onClick={() => setStep("info")}>
+ Cancel
+ </Button>
+ {isAdmin ? (
+ <Button
+ type="submit"
+ variant={scopeVariant}
+ isDisabled={!isAllChecksCompleted}
+ isPending={isSubmitting}
>
- <div>
- <Button
- type="submit"
- variant="solid"
- colorSchema="primary"
- size="md"
- className="w-[120px] bg-project hover:bg-project"
- isDisabled={!isAllChecksCompleted || !isAdmin}
- isLoading={isSubmitting}
- >
- Upgrade
- </Button>
- </div>
+ Upgrade
+ </Button>
+ ) : (
+ <Tooltip hoverable delayDuration={50}>
+ <TooltipTrigger asChild>
+ <div>
+ <Button type="submit" variant={scopeVariant} isDisabled>
+ Upgrade
+ </Button>
+ </div>
+ </TooltipTrigger>
+ <TooltipContent>
+ You cannot perform this upgrade because you are not an organization admin.
+ </TooltipContent>
</Tooltip>
- </div>
- </form>
- </div>
+ )}
+ </DialogFooter>
+ </form>
)}
- </ModalContent>
- </Modal>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/frontend/src/pages/organization/GroupDetailsByIDPage/GroupDetailsByIDPage.tsx b/frontend/src/pages/organization/GroupDetailsByIDPage/GroupDetailsByIDPage.tsx
index 40d31c79c3..189cf223e0 100644
--- a/frontend/src/pages/organization/GroupDetailsByIDPage/GroupDetailsByIDPage.tsx
+++ b/frontend/src/pages/organization/GroupDetailsByIDPage/GroupDetailsByIDPage.tsx
@@ -5,13 +5,14 @@ import { ChevronLeftIcon, EllipsisIcon } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
-import { DeleteActionModal, Spinner } from "@app/components/v2";
import {
Button,
+ DeleteConfirmDialog,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
- DropdownMenuTrigger
+ DropdownMenuTrigger,
+ Spinner
} from "@app/components/v3";
import { PageHeader } from "@app/components/v3/platform";
import { ROUTE_PATHS } from "@app/const/routes";
@@ -191,7 +192,7 @@ const Page = () => {
handlePopUpClose={handlePopUpClose}
handlePopUpToggle={handlePopUpToggle}
/>
- <DeleteActionModal
+ <DeleteConfirmDialog
isOpen={popUp.deleteGroup.isOpen}
title={
(popUp?.deleteGroup?.data as { isLinkedGroup?: boolean })?.isLinkedGroup
@@ -202,9 +203,10 @@ const Page = () => {
(popUp?.deleteGroup?.data as { name: string })?.name || ""
}?`
}
- onChange={(isOpen) => handlePopUpToggle("deleteGroup", isOpen)}
- deleteKey="confirm"
- onDeleteApproved={() =>
+ description="This action is irreversible."
+ onOpenChange={(isOpen) => handlePopUpToggle("deleteGroup", isOpen)}
+ confirmKey="confirm"
+ onConfirm={() =>
onDeleteGroupSubmit(popUp?.deleteGroup?.data as { name: string; id: string })
}
/>
diff --git a/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupProjectModal.tsx b/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupProjectModal.tsx
index 45a82d5181..0d7bb3214a 100644
--- a/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupProjectModal.tsx
+++ b/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupProjectModal.tsx
@@ -1,25 +1,29 @@
import { useState } from "react";
-import { faFolder, faMagnifyingGlass } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { SearchIcon } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import {
Button,
- EmptyState,
- Input,
- Modal,
- ModalContent,
+ Empty,
+ EmptyHeader,
+ EmptyTitle,
+ InputGroup,
+ InputGroupAddon,
+ InputGroupInput,
Pagination,
+ Sheet,
+ SheetContent,
+ SheetHeader,
+ SheetTitle,
Table,
- TableContainer,
- TableSkeleton,
- TBody,
- Td,
- Th,
- THead,
- Tr
-} from "@app/components/v2";
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+ TableSkeletonRows
+} from "@app/components/v3";
import { OrgPermissionGroupActions, OrgPermissionSubjects } from "@app/context";
import { getProjectTitle } from "@app/helpers/project";
import { useDebounce, useResetPageHelper } from "@app/hooks";
@@ -93,93 +97,96 @@ export const AddGroupProjectModal = ({ popUp, handlePopUpToggle }: Props) => {
};
return (
- <Modal
- isOpen={popUp?.addGroupProjects?.isOpen}
+ <Sheet
+ open={popUp?.addGroupProjects?.isOpen}
onOpenChange={(isOpen) => {
handlePopUpToggle("addGroupProjects", isOpen);
}}
>
- <ModalContent title="Add Projects">
- <Input
- value={searchProjectFilter}
- onChange={(e) => setSearchProjectFilter(e.target.value)}
- leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
- placeholder="Search projects..."
- />
- <TableContainer className="mt-4">
- <Table>
- <THead>
- <Tr>
- <Th>Project</Th>
- <Th>Type</Th>
- <Th />
- </Tr>
- </THead>
- <TBody>
- {isPending && <TableSkeleton columns={3} innerKey="group-projects" />}
- {!isPending &&
- data?.projects?.map((project) => {
- return (
- <Tr className="items-center" key={`group-project-${project.id}`}>
- <Td className="w-1/3">
- <p>{project.name}</p>
- {project.description && (
- <p className="text-sm text-muted">{project.description}</p>
- )}
- </Td>
- <Td>
- <p>{getProjectTitle(project.type as ProjectType)}</p>
- </Td>
- <Td>
- <OrgPermissionCan
- I={OrgPermissionGroupActions.Edit}
- a={OrgPermissionSubjects.Groups}
- >
- {(isAllowed) => {
- return (
+ <SheetContent size="form" isPending={isAdding}>
+ <SheetHeader>
+ <SheetTitle>Add Projects</SheetTitle>
+ </SheetHeader>
+ <div className="flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-4">
+ <InputGroup>
+ <InputGroupAddon>
+ <SearchIcon />
+ </InputGroupAddon>
+ <InputGroupInput
+ value={searchProjectFilter}
+ onChange={(e) => setSearchProjectFilter(e.target.value)}
+ placeholder="Search projects..."
+ />
+ </InputGroup>
+ {!isPending && !data?.projects?.length ? (
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyTitle>
+ {debouncedSearch
+ ? "No projects match search"
+ : "This group is already a part of all projects"}
+ </EmptyTitle>
+ </EmptyHeader>
+ </Empty>
+ ) : (
+ <div>
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>Project</TableHead>
+ <TableHead>Type</TableHead>
+ <TableHead variant="action" />
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {isPending && <TableSkeletonRows columns={3} />}
+ {!isPending &&
+ data?.projects?.map((project) => (
+ <TableRow key={`group-project-${project.id}`}>
+ <TableCell isWrappable>
+ <p>{project.name}</p>
+ {project.description && (
+ <p className="text-xs text-muted">{project.description}</p>
+ )}
+ </TableCell>
+ <TableCell>{getProjectTitle(project.type as ProjectType)}</TableCell>
+ <TableCell variant="action">
+ <OrgPermissionCan
+ I={OrgPermissionGroupActions.Edit}
+ a={OrgPermissionSubjects.Groups}
+ >
+ {(isAllowed) => (
<Button
- className="self-center"
- isLoading={isAdding}
+ variant="outline"
+ size="xs"
+ isPending={isAdding}
isDisabled={!isAllowed}
- colorSchema="primary"
- variant="outline_bg"
- type="submit"
onClick={() =>
handleAddProject(project.id, project.name, project.type)
}
>
Assign
</Button>
- );
- }}
- </OrgPermissionCan>
- </Td>
- </Tr>
- );
- })}
- </TBody>
- </Table>
- {!isPending && totalCount > 0 && (
- <Pagination
- count={totalCount}
- page={page}
- perPage={perPage}
- onChangePage={(newPage) => setPage(newPage)}
- onChangePerPage={(newPerPage) => setPerPage(newPerPage)}
- />
- )}
- {!isPending && !data?.projects?.length && (
- <EmptyState
- title={
- debouncedSearch
- ? "No projects match search"
- : "This group is already a part of all projects"
- }
- icon={faFolder}
- />
+ )}
+ </OrgPermissionCan>
+ </TableCell>
+ </TableRow>
+ ))}
+ </TableBody>
+ </Table>
+ {!isPending && totalCount > 0 && (
+ <Pagination
+ count={totalCount}
+ page={page}
+ perPage={perPage}
+ onChangePage={(newPage) => setPage(newPage)}
+ onChangePerPage={(newPerPage) => setPerPage(newPerPage)}
+ />
+ )}
+ </div>
)}
- </TableContainer>
- </ModalContent>
- </Modal>
+ </div>
+ </SheetContent>
+ </Sheet>
);
};
diff --git a/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersSection.tsx b/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersSection.tsx
index f4aeff4ecf..d3ec7fe56d 100644
--- a/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersSection.tsx
+++ b/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembersSection.tsx
@@ -2,7 +2,6 @@ import { PlusIcon } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
-import { DeleteActionModal } from "@app/components/v2";
import {
Button,
Card,
@@ -10,7 +9,8 @@ import {
CardContent,
CardDescription,
CardHeader,
- CardTitle
+ CardTitle,
+ DeleteConfirmDialog
} from "@app/components/v3";
import { OrgPermissionGroupActions, OrgPermissionSubjects, useOrganization } from "@app/context";
import {
@@ -127,12 +127,13 @@ export const GroupMembersSection = ({ groupId, groupSlug, isLinkedGroup = false
handlePopUpToggle={handlePopUpToggle}
isOidcManageGroupMembershipsEnabled={isOidcManageGroupMembershipsEnabled}
/>
- <DeleteActionModal
+ <DeleteConfirmDialog
isOpen={popUp.removeMemberFromGroup.isOpen}
title={`Are you sure you want to remove ${getMemberName(popUp?.removeMemberFromGroup?.data)} from the group?`}
- onChange={(isOpen) => handlePopUpToggle("removeMemberFromGroup", isOpen)}
- deleteKey="confirm"
- onDeleteApproved={() => {
+ description="This action is irreversible."
+ onOpenChange={(isOpen) => handlePopUpToggle("removeMemberFromGroup", isOpen)}
+ confirmKey="confirm"
+ onConfirm={() => {
const memberData = popUp?.removeMemberFromGroup?.data as RemoveMemberData;
return handleRemoveMemberFromGroup(memberData);
}}
diff --git a/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupProjectsSection/GroupProjectsSection.tsx b/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupProjectsSection/GroupProjectsSection.tsx
index b3dca6ade4..3eee62aaee 100644
--- a/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupProjectsSection/GroupProjectsSection.tsx
+++ b/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupProjectsSection/GroupProjectsSection.tsx
@@ -2,7 +2,6 @@ import { PlusIcon } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
-import { DeleteActionModal } from "@app/components/v2";
import {
Button,
Card,
@@ -10,7 +9,8 @@ import {
CardContent,
CardDescription,
CardHeader,
- CardTitle
+ CardTitle,
+ DeleteConfirmDialog
} from "@app/components/v3";
import { OrgPermissionGroupActions, OrgPermissionSubjects } from "@app/context";
import { useDeleteGroupFromWorkspace as useRemoveProjectFromGroup } from "@app/hooks/api";
@@ -86,14 +86,15 @@ export const GroupProjectsSection = ({ groupId, groupSlug, hideAddToProject = fa
</CardContent>
</Card>
<AddGroupProjectModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />
- <DeleteActionModal
+ <DeleteConfirmDialog
isOpen={popUp.removeProjectFromGroup.isOpen}
title={`Are you sure you want to remove the group from ${
(popUp?.removeProjectFromGroup?.data as { projectName: string })?.projectName || ""
}?`}
- onChange={(isOpen) => handlePopUpToggle("removeProjectFromGroup", isOpen)}
- deleteKey="confirm"
- onDeleteApproved={() => {
+ description="This action is irreversible."
+ onOpenChange={(isOpen) => handlePopUpToggle("removeProjectFromGroup", isOpen)}
+ confirmKey="confirm"
+ onConfirm={() => {
const projectData = popUp?.removeProjectFromGroup?.data as {
projectId: string;
projectName: string;
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/IdentityDetailsByIDPage.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/IdentityDetailsByIDPage.tsx
index a9fffb5966..0d5216fa33 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/IdentityDetailsByIDPage.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/IdentityDetailsByIDPage.tsx
@@ -5,7 +5,6 @@ import { ChevronLeftIcon, EllipsisIcon } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
-import { DeleteActionModal } from "@app/components/v2";
import {
Alert,
AlertDescription,
@@ -16,6 +15,7 @@ import {
CardDescription,
CardHeader,
CardTitle,
+ DeleteConfirmDialog,
Dialog,
DialogContent,
DialogDescription,
@@ -240,14 +240,15 @@ const Page = () => {
handlePopUpOpen={handlePopUpOpen}
handlePopUpToggle={handlePopUpToggle}
/>
- <DeleteActionModal
+ <DeleteConfirmDialog
isOpen={popUp.deleteIdentity.isOpen}
title={`Are you sure you want to delete ${
(popUp?.deleteIdentity?.data as { name: string })?.name || ""
}?`}
- onChange={(isOpen) => handlePopUpToggle("deleteIdentity", isOpen)}
- deleteKey="confirm"
- onDeleteApproved={() =>
+ description="This action is irreversible."
+ onOpenChange={(isOpen) => handlePopUpToggle("deleteIdentity", isOpen)}
+ confirmKey="confirm"
+ onConfirm={() =>
onDeleteIdentitySubmit(
(popUp?.deleteIdentity?.data as { identityId: string })?.identityId
)
diff --git a/frontend/src/pages/organization/ProductSettingsPage/project-templates/DeleteProjectTemplateModal.tsx b/frontend/src/pages/organization/ProductSettingsPage/project-templates/DeleteProjectTemplateModal.tsx
index 33b54afcab..a398b103f1 100644
--- a/frontend/src/pages/organization/ProductSettingsPage/project-templates/DeleteProjectTemplateModal.tsx
+++ b/frontend/src/pages/organization/ProductSettingsPage/project-templates/DeleteProjectTemplateModal.tsx
@@ -1,5 +1,5 @@
import { createNotification } from "@app/components/notifications";
-import { DeleteActionModal } from "@app/components/v2";
+import { DeleteConfirmDialog } from "@app/components/v3";
import { TProjectTemplate, useDeleteProjectTemplate } from "@app/hooks/api/projectTemplates";
type Props = {
@@ -29,12 +29,13 @@ export const DeleteProjectTemplateModal = ({ isOpen, onOpenChange, template }: P
};
return (
- <DeleteActionModal
+ <DeleteConfirmDialog
isOpen={isOpen}
- onChange={onOpenChange}
+ description="This action is irreversible."
+ onOpenChange={onOpenChange}
title={`Are you sure you want to delete ${name}?`}
- deleteKey="confirm"
- onDeleteApproved={handleDeleteProjectTemplate}
+ confirmKey="confirm"
+ onConfirm={handleDeleteProjectTemplate}
/>
);
};
diff --git a/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateRolesSection.tsx b/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateRolesSection.tsx
index c56232dd7b..3f0193c69b 100644
--- a/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateRolesSection.tsx
+++ b/frontend/src/pages/organization/ProductSettingsPage/project-templates/EditProjectTemplateSection/components/ProjectTemplateRolesSection.tsx
@@ -2,7 +2,6 @@ import { Plus, Rows3, Trash2, WrenchIcon } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
-import { DeleteActionModal } from "@app/components/v2";
import {
Badge,
Button,
@@ -12,6 +11,7 @@ import {
CardDescription,
CardHeader,
CardTitle,
+ DeleteConfirmDialog,
Empty,
EmptyHeader,
EmptyTitle,
@@ -219,12 +219,13 @@ export const ProjectTemplateRolesSection = ({ projectTemplate, isInfisicalTempla
</Empty>
)}
</CardContent>
- <DeleteActionModal
+ <DeleteConfirmDialog
isOpen={popUp.removeRole.isOpen}
- deleteKey="remove"
+ confirmKey="remove"
title={`Are you sure you want to remove the role ${roleToDelete?.slug}?`}
- onChange={(isOpen) => handlePopUpToggle("removeRole", isOpen)}
- onDeleteApproved={() => handleRemoveRole(roleToDelete?.slug)}
+ description="This action is irreversible."
+ onOpenChange={(isOpen) => handlePopUpToggle("removeRole", isOpen)}
+ onConfirm={() => handleRemoveRole(roleToDelete?.slug)}
/>
</Card>
)}
diff --git a/frontend/src/pages/organization/ProductSettingsPage/project-templates/ProjectTemplatePage.tsx b/frontend/src/pages/organization/ProductSettingsPage/project-templates/ProjectTemplatePage.tsx
index 157e467d5b..de13826c96 100644
--- a/frontend/src/pages/organization/ProductSettingsPage/project-templates/ProjectTemplatePage.tsx
+++ b/frontend/src/pages/organization/ProductSettingsPage/project-templates/ProjectTemplatePage.tsx
@@ -3,8 +3,7 @@ import { ChevronLeft, Pencil, Trash2 } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
-import { DeleteActionModal } from "@app/components/v2";
-import { Button } from "@app/components/v3";
+import { Button, DeleteConfirmDialog } from "@app/components/v3";
import { PageHeader } from "@app/components/v3/platform";
import { OrgPermissionActions, OrgPermissionSubjects } from "@app/context";
import { getProjectTitle } from "@app/helpers/project";
@@ -133,12 +132,13 @@ export const ProjectTemplatePage = ({ templateId, projectType, onBack }: Props)
onOpenChange={(isOpen) => handlePopUpToggle("editDetails", isOpen)}
projectTemplate={matchingProjectTemplate}
/>
- <DeleteActionModal
+ <DeleteConfirmDialog
isOpen={popUp.removeTemplate.isOpen}
title={`Are you sure you want to delete ${matchingProjectTemplate.name}?`}
- deleteKey="confirm"
- onChange={(isOpen) => handlePopUpToggle("removeTemplate", isOpen)}
- onDeleteApproved={handleRemoveTemplate}
+ confirmKey="confirm"
+ description="This action is irreversible."
+ onOpenChange={(isOpen) => handlePopUpToggle("removeTemplate", isOpen)}
+ onConfirm={handleRemoveTemplate}
/>
</>
)}
diff --git a/frontend/src/pages/organization/RoleByIDPage/RoleByIDPage.tsx b/frontend/src/pages/organization/RoleByIDPage/RoleByIDPage.tsx
index d5404b2996..c39a9bcc97 100644
--- a/frontend/src/pages/organization/RoleByIDPage/RoleByIDPage.tsx
+++ b/frontend/src/pages/organization/RoleByIDPage/RoleByIDPage.tsx
@@ -6,9 +6,9 @@ import { twMerge } from "tailwind-merge";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
-import { DeleteActionModal } from "@app/components/v2";
import {
Button,
+ DeleteConfirmDialog,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
@@ -181,12 +181,13 @@ export const Page = () => {
</div>
)}
<RoleModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />
- <DeleteActionModal
+ <DeleteConfirmDialog
isOpen={popUp.deleteOrgRole.isOpen}
title={`Are you sure you want to delete the organization role ${data?.name ?? ""}?`}
- onChange={(isOpen) => handlePopUpToggle("deleteOrgRole", isOpen)}
- deleteKey="confirm"
- onDeleteApproved={() => onDeleteOrgRoleSubmit()}
+ description="This action is irreversible."
+ onOpenChange={(isOpen) => handlePopUpToggle("deleteOrgRole", isOpen)}
+ confirmKey="confirm"
+ onConfirm={() => onDeleteOrgRoleSubmit()}
/>
<DuplicateOrgRoleModal
isOpen={popUp.duplicateRole.isOpen}
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgCertManagerTab/OrgCertManagerTab.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgCertManagerTab/OrgCertManagerTab.tsx
index 8377662f60..cabc241b7a 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgCertManagerTab/OrgCertManagerTab.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgCertManagerTab/OrgCertManagerTab.tsx
@@ -11,7 +11,6 @@ import {
} from "lucide-react";
import { createNotification } from "@app/components/notifications";
-import { DeleteActionModal } from "@app/components/v2";
import {
Alert,
AlertDescription,
@@ -21,6 +20,7 @@ import {
CardContent,
CardHeader,
CardTitle,
+ DeleteConfirmDialog,
Dialog,
DialogContent,
DialogDescription,
@@ -266,16 +266,16 @@ export const OrgCertManagerTab = () => {
</DialogContent>
</Dialog>
- <DeleteActionModal
+ <DeleteConfirmDialog
isOpen={Boolean(pendingDelete)}
- onChange={(open) => {
+ onOpenChange={(open) => {
if (!open) setPendingDelete(null);
}}
title={`Delete ${pendingDelete?.name ?? "this project"}?`}
- subTitle="This permanently deletes the Certificate Manager project, including its certificates, profiles, applications, and approval policies. This cannot be undone."
- deleteKey={pendingDelete?.slug ?? "delete"}
- onDeleteApproved={handleConfirmDelete}
- buttonText="Delete project"
+ description="This permanently deletes the Certificate Manager project, including its certificates, profiles, applications, and approval policies. This cannot be undone."
+ confirmKey={pendingDelete?.slug ?? "delete"}
+ onConfirm={handleConfirmDelete}
+ confirmLabel="Delete project"
/>
<CertManagerExportProjectModal
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSubOrgsTab/OrgSubOrgsTab.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSubOrgsTab/OrgSubOrgsTab.tsx
index 0ee96a5c0d..70ce55ad49 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSubOrgsTab/OrgSubOrgsTab.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSubOrgsTab/OrgSubOrgsTab.tsx
@@ -21,7 +21,6 @@ import { createNotification } from "@app/components/notifications";
import { NewSubOrganizationModal } from "@app/components/organization/NewSubOrganizationModal";
import { OrgPermissionCan } from "@app/components/permissions";
import SecurityClient from "@app/components/utilities/SecurityClient";
-import { DeleteActionModal, FormControl, Input, Modal, ModalContent } from "@app/components/v2";
import {
Badge,
Button,
@@ -31,6 +30,14 @@ import {
CardDescription,
CardHeader,
CardTitle,
+ DeleteConfirmDialog,
+ Dialog,
+ DialogClose,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
@@ -39,7 +46,11 @@ import {
EmptyDescription,
EmptyHeader,
EmptyTitle,
+ Field,
+ FieldError,
+ FieldLabel,
IconButton,
+ Input,
InputGroup,
InputGroupAddon,
InputGroupInput,
@@ -440,51 +451,58 @@ export const OrgSubOrgsTab = () => {
onOpenChange={(isOpen) => handlePopUpToggle("addSubOrg", isOpen)}
/>
- <Modal
- isOpen={popUp.editSubOrg.isOpen}
+ <Dialog
+ open={popUp.editSubOrg.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("editSubOrg", isOpen)}
>
- <ModalContent
- title="Edit Sub-Org"
- subTitle="Update the name and slug of this sub-organization."
- footerContent={
- <div className="flex items-center gap-2">
- <Button variant="org" type="submit" form="edit-sub-org-form" isPending={isUpdating}>
+ <DialogContent isPending={isUpdating}>
+ <DialogHeader>
+ <DialogTitle>Edit Sub-Org</DialogTitle>
+ <DialogDescription>
+ Update the name and slug of this sub-organization.
+ </DialogDescription>
+ </DialogHeader>
+ <form className="flex flex-col gap-4" onSubmit={handleSubmit(handleEditSubmit)}>
+ <Field>
+ <FieldLabel htmlFor="edit-sub-org-name">Name</FieldLabel>
+ <Input
+ id="edit-sub-org-name"
+ {...register("name")}
+ placeholder="My Sub-Organization"
+ autoComplete="off"
+ isError={Boolean(errors.name)}
+ />
+ <FieldError>{errors.name?.message}</FieldError>
+ </Field>
+ <Field>
+ <FieldLabel htmlFor="edit-sub-org-slug">Slug (optional)</FieldLabel>
+ <Input
+ id="edit-sub-org-slug"
+ {...register("slug")}
+ placeholder="my-sub-organization"
+ isError={Boolean(errors.slug)}
+ />
+ <FieldError>{errors.slug?.message}</FieldError>
+ </Field>
+ <DialogFooter>
+ <DialogClose asChild>
+ <Button variant="ghost">Cancel</Button>
+ </DialogClose>
+ <Button variant="org" type="submit" isPending={isUpdating}>
Save Changes
</Button>
- <Button variant="outline" onClick={() => handlePopUpClose("editSubOrg")}>
- Cancel
- </Button>
- </div>
- }
- >
- <form id="edit-sub-org-form" onSubmit={handleSubmit(handleEditSubmit)}>
- <FormControl
- label="Name"
- isError={Boolean(errors.name)}
- errorText={errors.name?.message}
- >
- <Input {...register("name")} placeholder="My Sub-Organization" autoComplete="off" />
- </FormControl>
- <FormControl
- label="Slug"
- isError={Boolean(errors.slug)}
- errorText={errors.slug?.message}
- isOptional
- >
- <Input {...register("slug")} placeholder="my-sub-organization" />
- </FormControl>
+ </DialogFooter>
</form>
- </ModalContent>
- </Modal>
+ </DialogContent>
+ </Dialog>
- <DeleteActionModal
+ <DeleteConfirmDialog
isOpen={popUp.deleteSubOrg.isOpen}
- onChange={(isOpen) => handlePopUpToggle("deleteSubOrg", isOpen)}
+ onOpenChange={(isOpen) => handlePopUpToggle("deleteSubOrg", isOpen)}
title="Are you sure you want to delete this sub-organization?"
- subTitle={`Permanently remove ${selectedSubOrg?.name} and all of its data. This action is not reversible, so please be careful.`}
- deleteKey="confirm"
- onDeleteApproved={handleDeleteApproved}
+ description={`Permanently remove ${selectedSubOrg?.name} and all of its data. This action is not reversible, so please be careful.`}
+ confirmKey="confirm"
+ onConfirm={handleDeleteApproved}
/>
</>
);
diff --git a/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserGroupsSection.tsx b/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserGroupsSection.tsx
index e4af4ea99b..217b915958 100644
--- a/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserGroupsSection.tsx
+++ b/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserGroupsSection.tsx
@@ -1,8 +1,14 @@
import { useCallback } from "react";
import { createNotification } from "@app/components/notifications";
-import { DeleteActionModal } from "@app/components/v2";
-import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@app/components/v3";
+import {
+ Card,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+ DeleteConfirmDialog
+} from "@app/components/v3";
import { useRemoveUserFromGroup } from "@app/hooks/api";
import { OrgUser } from "@app/hooks/api/users/types";
import { usePopUp } from "@app/hooks/usePopUp";
@@ -50,12 +56,13 @@ export const UserGroupsSection = ({ orgMembership }: Props) => {
</CardContent>
</Card>
- <DeleteActionModal
+ <DeleteConfirmDialog
isOpen={popUp.removeUserFromGroup.isOpen}
title="Are you sure you want to unassign user from group?"
- onChange={(isOpen) => handlePopUpToggle("removeUserFromGroup", isOpen)}
- deleteKey="confirm"
- onDeleteApproved={() => {
+ description="This action is irreversible."
+ onOpenChange={(isOpen) => handlePopUpToggle("removeUserFromGroup", isOpen)}
+ confirmKey="confirm"
+ onConfirm={() => {
const popupData = popUp?.removeUserFromGroup?.data as {
groupId: string;
groupSlug: string;
diff --git a/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserProjectsSection.tsx b/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserProjectsSection.tsx
index 2706fd004e..69698f0bce 100644
--- a/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserProjectsSection.tsx
+++ b/frontend/src/pages/organization/UserDetailsByIDPage/components/UserProjectsSection/UserProjectsSection.tsx
@@ -1,7 +1,6 @@
import { PlusIcon } from "lucide-react";
import { createNotification } from "@app/components/notifications";
-import { DeleteActionModal } from "@app/components/v2";
import {
Button,
Card,
@@ -9,7 +8,8 @@ import {
CardContent,
CardDescription,
CardHeader,
- CardTitle
+ CardTitle,
+ DeleteConfirmDialog
} from "@app/components/v3";
import { useOrganization, useUser } from "@app/context";
import {
@@ -95,14 +95,15 @@ export const UserProjectsSection = ({ membershipId }: Props) => {
popUp={popUp}
handlePopUpToggle={handlePopUpToggle}
/>
- <DeleteActionModal
+ <DeleteConfirmDialog
isOpen={popUp.removeUserFromProject.isOpen}
- deleteKey="remove"
+ confirmKey="remove"
title={`Do you want to remove this user from ${
(popUp?.removeUserFromProject?.data as { projectName: string })?.projectName || ""
}?`}
- onChange={(isOpen) => handlePopUpToggle("removeUserFromProject", isOpen)}
- onDeleteApproved={() => {
+ description="This action is irreversible."
+ onOpenChange={(isOpen) => handlePopUpToggle("removeUserFromProject", isOpen)}
+ onConfirm={() => {
const popupData = popUp?.removeUserFromProject?.data as {
username: string;
projectId: string;