Skip to content

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

ui: move project settings to v3

adilson3690d7ae6ac8
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/AutoCapitalizationSection/AutoCapitalizationSection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/AutoCapitalizationSection/AutoCapitalizationSection.tsx
index 7c9d03904f..06e3fd62d2 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/AutoCapitalizationSection/AutoCapitalizationSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/AutoCapitalizationSection/AutoCapitalizationSection.tsx
@@ -2,7 +2,15 @@ import { useTranslation } from "react-i18next";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
-import { Checkbox } from "@app/components/v2";
+import {
+ Card,
+ CardContent,
+ Field,
+ FieldContent,
+ FieldDescription,
+ FieldTitle,
+ Switch
+} from "@app/components/v3";
import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { useUpdateProject } from "@app/hooks/api";
@@ -28,25 +36,30 @@ export const AutoCapitalizationSection = () => {
};
return (
- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <p className="mb-3 text-xl font-medium">{t("settings.project.enforce-capitalization")}</p>
- <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.Settings}>
- {(isAllowed) => (
- <div>
- <Checkbox
- id="autoCapitalization"
- isDisabled={!isAllowed}
- isChecked={currentProject?.autoCapitalization ?? false}
- onCheckedChange={(state) => {
- handleToggleCapitalizationToggle(state as boolean);
- }}
- allowMultilineLabel
- >
- {t("settings.project.enforce-capitalization-description")}
- </Checkbox>
- </div>
- )}
- </ProjectPermissionCan>
- </div>
+ <Card className="mb-6">
+ <CardContent>
+ <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.Settings}>
+ {(isAllowed) => (
+ <Field orientation="horizontal">
+ <FieldContent>
+ <FieldTitle>{t("settings.project.enforce-capitalization")}</FieldTitle>
+ <FieldDescription>
+ {t("settings.project.enforce-capitalization-description")}
+ </FieldDescription>
+ </FieldContent>
+ <Switch
+ id="autoCapitalization"
+ variant="project"
+ checked={currentProject?.autoCapitalization ?? false}
+ disabled={!isAllowed}
+ onCheckedChange={(state) => {
+ handleToggleCapitalizationToggle(state);
+ }}
+ />
+ </Field>
+ )}
+ </ProjectPermissionCan>
+ </CardContent>
+ </Card>
);
};
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/BackfillSecretReferenceSection/BackfillSecretReferenceSection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/BackfillSecretReferenceSection/BackfillSecretReferenceSection.tsx
index 9350698dcf..12b0321a3d 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/BackfillSecretReferenceSection/BackfillSecretReferenceSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/BackfillSecretReferenceSection/BackfillSecretReferenceSection.tsx
@@ -1,5 +1,12 @@
import { createNotification } from "@app/components/notifications";
-import { Button } from "@app/components/v2";
+import {
+ Button,
+ Card,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle
+} from "@app/components/v3";
import { useProject, useProjectPermission } from "@app/context";
import { useBackfillSecretReference } from "@app/hooks/api";
import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
@@ -19,22 +26,25 @@ export const BackfillSecretReferenceSecretion = () => {
const isAdmin = hasProjectRole(ProjectMembershipRole.Admin);
return (
- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <div className="flex w-full items-center justify-between">
- <p className="text-xl font-medium">Index Secret References</p>
- </div>
- <p className="mt-2 mb-4 max-w-2xl text-sm text-gray-400">
- This will index all secret references, enabling integrations to be triggered when their
- values change going forward. This happens automatically when secrets are created or updated.
- </p>
- <Button
- variant="outline_bg"
- isLoading={backfillSecretReferences.isPending}
- onClick={handleBackfill}
- isDisabled={!isAdmin}
- >
- Index Secret References
- </Button>
- </div>
+ <Card className="mb-6">
+ <CardHeader>
+ <CardTitle>Index Secret References</CardTitle>
+ <CardDescription>
+ This will index all secret references, enabling integrations to be triggered when their
+ values change going forward. This happens automatically when secrets are created or
+ updated.
+ </CardDescription>
+ </CardHeader>
+ <CardContent>
+ <Button
+ variant="outline"
+ isPending={backfillSecretReferences.isPending}
+ onClick={handleBackfill}
+ isDisabled={!isAdmin}
+ >
+ Index Secret References
+ </Button>
+ </CardContent>
+ </Card>
);
};
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/EnforceEncryptedMetadataSection/EnforceEncryptedMetadataSection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/EnforceEncryptedMetadataSection/EnforceEncryptedMetadataSection.tsx
index d9c74febfc..3aae5c9386 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/EnforceEncryptedMetadataSection/EnforceEncryptedMetadataSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/EnforceEncryptedMetadataSection/EnforceEncryptedMetadataSection.tsx
@@ -1,6 +1,14 @@
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
-import { Checkbox } from "@app/components/v2";
+import {
+ Card,
+ CardContent,
+ Field,
+ FieldContent,
+ FieldDescription,
+ FieldTitle,
+ Switch
+} from "@app/components/v3";
import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { useUpdateProject } from "@app/hooks/api";
@@ -24,26 +32,31 @@ export const EnforceEncryptedMetadataSection = () => {
};
return (
- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <p className="mb-3 text-xl font-medium">Enforce Encrypted Metadata</p>
- <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.Settings}>
- {(isAllowed) => (
- <div>
- <Checkbox
- id="enforceEncryptedMetadata"
- isDisabled={!isAllowed}
- isChecked={currentProject?.enforceEncryptedSecretManagerSecretMetadata ?? false}
- onCheckedChange={(state) => {
- handleToggle(state as boolean);
- }}
- allowMultilineLabel
- >
- When enabled, secrets in this project can only have encrypted metadata. Unencrypted
- metadata fields will be rejected.
- </Checkbox>
- </div>
- )}
- </ProjectPermissionCan>
- </div>
+ <Card className="mb-6">
+ <CardContent>
+ <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.Settings}>
+ {(isAllowed) => (
+ <Field orientation="horizontal">
+ <FieldContent>
+ <FieldTitle>Enforce Encrypted Metadata</FieldTitle>
+ <FieldDescription>
+ When enabled, secrets in this project can only have encrypted metadata.
+ Unencrypted metadata fields will be rejected.
+ </FieldDescription>
+ </FieldContent>
+ <Switch
+ id="enforceEncryptedMetadata"
+ variant="project"
+ checked={currentProject?.enforceEncryptedSecretManagerSecretMetadata ?? false}
+ disabled={!isAllowed}
+ onCheckedChange={(state) => {
+ handleToggle(state);
+ }}
+ />
+ </Field>
+ )}
+ </ProjectPermissionCan>
+ </CardContent>
+ </Card>
);
};
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/AddEnvironmentModal.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/AddEnvironmentModal.tsx
index 6eefbf239c..a10b167d7c 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/AddEnvironmentModal.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/AddEnvironmentModal.tsx
@@ -130,7 +130,7 @@ export const AddEnvironmentModal = ({ isOpen, onOpenChange, onComplete }: Props)
/>
<DialogFooter>
<DialogClose asChild>
- <Button variant="outline" type="button">
+ <Button variant="ghost" type="button">
Cancel
</Button>
</DialogClose>
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentSection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentSection.tsx
index b6276a8c06..5a308de271 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentSection.tsx
@@ -1,10 +1,27 @@
-import { faPlus } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { useState } from "react";
+import { PlusIcon } from "lucide-react";
import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
import { createNotification } from "@app/components/notifications";
import { PermissionDeniedBanner, ProjectPermissionCan } from "@app/components/permissions";
-import { Button, DeleteActionModal } from "@app/components/v2";
+import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogTitle,
+ Button,
+ Card,
+ CardAction,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+ Input
+} from "@app/components/v3";
import {
ProjectPermissionActions,
ProjectPermissionSub,
@@ -25,6 +42,7 @@ export const EnvironmentSection = () => {
const { permission } = useProjectPermission();
const deleteWsEnvironment = useDeleteWsEnvironment();
+ const [deleteConfirmation, setDeleteConfirmation] = useState("");
const isMoreEnvironmentsAllowed =
subscription?.environmentLimit && currentProject?.environments
@@ -38,12 +56,16 @@ export const EnvironmentSection = () => {
"upgradePlan"
] as const);
- const onEnvDeleteSubmit = async (id: string) => {
- if (!currentProject?.id) return;
+ const deleteEnvData = popUp?.deleteEnv?.data as
+ | { name: string; slug: string; id: string }
+ | undefined;
+
+ const onEnvDeleteSubmit = async () => {
+ if (!currentProject?.id || !deleteEnvData?.id) return;
await deleteWsEnvironment.mutateAsync({
projectId: currentProject.id,
- id
+ id: deleteEnvData.id
});
createNotification({
@@ -52,24 +74,26 @@ export const EnvironmentSection = () => {
});
handlePopUpClose("deleteEnv");
+ setDeleteConfirmation("");
};
return (
- <div
- id="environments"
- className="mb-6 scroll-m-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4"
- >
- <div className="mb-8 flex justify-between">
- <p className="text-xl font-medium text-mineshaft-100">Environments</p>
- <div>
+ <Card id="environments" className="mb-6 scroll-m-6">
+ <CardHeader>
+ <CardTitle>Environments</CardTitle>
+ <CardDescription>
+ Choose which environments will show up in your dashboard like development, staging,
+ production.
+ </CardDescription>
+ <CardAction>
<ProjectPermissionCan
I={ProjectPermissionActions.Create}
a={ProjectPermissionSub.Environments}
>
{(isAllowed) => (
<Button
- colorSchema="secondary"
- leftIcon={<FontAwesomeIcon icon={faPlus} />}
+ variant="project"
+ size="xs"
onClick={() => {
if (isMoreEnvironmentsAllowed) {
handlePopUpOpen("createEnv");
@@ -79,21 +103,20 @@ export const EnvironmentSection = () => {
}}
isDisabled={!isAllowed}
>
- Create environment
+ <PlusIcon className="size-4" />
+ Create Environment
</Button>
)}
</ProjectPermissionCan>
- </div>
- </div>
- <p className="mb-8 text-gray-400">
- Choose which environments will show up in your dashboard like development, staging,
- production
- </p>
- {permission.can(ProjectPermissionActions.Read, ProjectPermissionSub.Environments) ? (
- <EnvironmentTable handlePopUpOpen={handlePopUpOpen} />
- ) : (
- <PermissionDeniedBanner />
- )}
+ </CardAction>
+ </CardHeader>
+ <CardContent>
+ {permission.can(ProjectPermissionActions.Read, ProjectPermissionSub.Environments) ? (
+ <EnvironmentTable handlePopUpOpen={handlePopUpOpen} />
+ ) : (
+ <PermissionDeniedBanner />
+ )}
+ </CardContent>
<AddEnvironmentModal
isOpen={popUp.createEnv.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("createEnv", isOpen)}
@@ -103,20 +126,49 @@ export const EnvironmentSection = () => {
handlePopUpClose={handlePopUpClose}
handlePopUpToggle={handlePopUpToggle}
/>
- <DeleteActionModal
- isOpen={popUp.deleteEnv.isOpen}
- title={`Are you sure you want to delete ${
- (popUp?.deleteEnv?.data as { name: string })?.name || " "
- }?`}
- onChange={(isOpen) => handlePopUpToggle("deleteEnv", isOpen)}
- deleteKey={(popUp?.deleteEnv?.data as { slug: string })?.slug || ""}
- onDeleteApproved={() => onEnvDeleteSubmit((popUp?.deleteEnv?.data as { id: string })?.id)}
- />
+ <AlertDialog
+ open={popUp.deleteEnv.isOpen}
+ onOpenChange={(isOpen) => {
+ handlePopUpToggle("deleteEnv", isOpen);
+ if (!isOpen) setDeleteConfirmation("");
+ }}
+ >
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogTitle>Delete Environment</AlertDialogTitle>
+ <AlertDialogDescription>
+ Are you sure you want to delete this environment? This action cannot be undone.
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <div className="w-full pb-4">
+ <p className="mb-2 text-sm text-muted">
+ Enter the environment slug{" "}
+ <span className="font-medium text-foreground">{deleteEnvData?.slug ?? ""}</span> to
+ confirm the deletion
+ </p>
+ <Input
+ value={deleteConfirmation}
+ onChange={(e) => setDeleteConfirmation(e.target.value)}
+ placeholder={deleteEnvData?.slug ?? ""}
+ />
+ </div>
+ <AlertDialogFooter>
+ <AlertDialogCancel>Cancel</AlertDialogCancel>
+ <AlertDialogAction
+ variant="danger"
+ onClick={onEnvDeleteSubmit}
+ disabled={!deleteEnvData?.slug || deleteConfirmation !== deleteEnvData.slug}
+ >
+ Delete
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
<UpgradePlanModal
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
text="You have reached the maximum number of environments allowed on the free plan. Upgrade to Infisical Pro plan to add more environments."
/>
- </div>
+ </Card>
);
};
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentTable.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentTable.tsx
index 6b5b3a8d2e..153ae769e3 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentTable.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentTable.tsx
@@ -1,20 +1,23 @@
-import { faArrowDown, faArrowUp, faPencil, faXmark } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { ArrowDownIcon, ArrowUpIcon, PencilIcon, XIcon } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
- EmptyState,
+ Empty,
+ EmptyDescription,
+ EmptyHeader,
+ EmptyTitle,
IconButton,
Table,
- TableContainer,
- TBody,
- Td,
- Th,
- THead,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
Tooltip,
- Tr
-} from "@app/components/v2";
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import {
ProjectPermissionActions,
ProjectPermissionSub,
@@ -70,38 +73,50 @@ export const EnvironmentTable = ({ handlePopUpOpen }: Props) => {
? Math.max(0, currentProject.environments.length - subscription.environmentLimit)
: 0;
+ if (!currentProject.environments?.length) {
+ return (
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyTitle>No environments found</EmptyTitle>
+ <EmptyDescription>
+ Create your first environment to organize secrets by stage.
+ </EmptyDescription>
+ </EmptyHeader>
+ </Empty>
+ );
+ }
+
return (
- <TableContainer>
- <Table>
- <THead>
- <Tr>
- <Th>Name</Th>
- <Th>Slug</Th>
- <Th aria-label="button" />
- </Tr>
- </THead>
- <TBody>
- {currentProject.environments.map(({ name, slug, id }, pos) => (
- <Tr key={id}>
- <Td>{name}</Td>
- <Td>{slug}</Td>
- <Td className="flex items-center justify-end">
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>Name</TableHead>
+ <TableHead>Slug</TableHead>
+ <TableHead className="text-right">Actions</TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {currentProject.environments.map(({ name, slug, id }, pos) => (
+ <TableRow key={id}>
+ <TableCell>{name}</TableCell>
+ <TableCell>{slug}</TableCell>
+ <TableCell>
+ <div className="flex items-center justify-end gap-1">
<ProjectPermissionCan
I={ProjectPermissionActions.Edit}
a={ProjectPermissionSub.Environments}
>
{(isAllowed) => (
<IconButton
- className="mr-3 py-2"
+ aria-label="Move down"
+ variant="ghost-muted"
+ size="xs"
onClick={() =>
handleReorderEnv(id, Math.min(currentProject.environments.length, pos + 2))
}
- colorSchema="primary"
- variant="plain"
- ariaLabel="update"
isDisabled={pos === currentProject.environments.length - 1 || !isAllowed}
>
- <FontAwesomeIcon icon={faArrowDown} />
+ <ArrowDownIcon className="size-4" />
</IconButton>
)}
</ProjectPermissionCan>
@@ -111,42 +126,45 @@ export const EnvironmentTable = ({ handlePopUpOpen }: Props) => {
>
{(isAllowed) => (
<IconButton
- className="mr-3 py-2"
+ aria-label="Move up"
+ variant="ghost-muted"
+ size="xs"
onClick={() => handleReorderEnv(id, Math.max(1, pos))}
- colorSchema="primary"
- variant="plain"
- ariaLabel="update"
isDisabled={pos === 0 || !isAllowed}
>
- <FontAwesomeIcon icon={faArrowUp} />
+ <ArrowUpIcon className="size-4" />
</IconButton>
)}
</ProjectPermissionCan>
-
<ProjectPermissionCan
I={ProjectPermissionActions.Edit}
a={ProjectPermissionSub.Environments}
>
{(isAllowed) => (
- <Tooltip
- content={
- isMoreEnvironmentsAllowed
- ? ""
- : `You have exceeded the number of environments allowed by your plan. To edit an existing environment, either upgrade your plan or remove at least ${environmentsOverPlanLimit} environment${environmentsOverPlanLimit === 1 ? "" : "s"}.`
- }
- >
- <IconButton
- className="mr-3 py-2"
- onClick={() => {
- handlePopUpOpen("updateEnv", { name, slug, id });
- }}
- isDisabled={!isAllowed || !isMoreEnvironmentsAllowed}
- colorSchema="primary"
- variant="plain"
- ariaLabel="update"
- >
- <FontAwesomeIcon icon={faPencil} />
- </IconButton>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span>
+ <IconButton
+ aria-label="Edit environment"
+ variant="ghost-muted"
+ size="xs"
+ onClick={() => {
+ handlePopUpOpen("updateEnv", { name, slug, id });
+ }}
+ isDisabled={!isAllowed || !isMoreEnvironmentsAllowed}
+ >
+ <PencilIcon className="size-4" />
+ </IconButton>
+ </span>
+ </TooltipTrigger>
+ {!isMoreEnvironmentsAllowed && (
+ <TooltipContent>
+ You have exceeded the number of environments allowed by your plan. To edit
+ an existing environment, either upgrade your plan or remove at least{" "}
+ {environmentsOverPlanLimit} environment
+ {environmentsOverPlanLimit === 1 ? "" : "s"}.
+ </TooltipContent>
+ )}
</Tooltip>
)}
</ProjectPermissionCan>
@@ -156,31 +174,23 @@ export const EnvironmentTable = ({ handlePopUpOpen }: Props) => {
>
{(isAllowed) => (
<IconButton
+ aria-label="Delete environment"
+ variant="danger"
+ size="xs"
onClick={() => {
handlePopUpOpen("deleteEnv", { name, slug, id });
}}
- size="lg"
- colorSchema="danger"
- variant="plain"
- ariaLabel="update"
isDisabled={!isAllowed}
>
- <FontAwesomeIcon icon={faXmark} />
+ <XIcon className="size-4" />
</IconButton>
)}
</ProjectPermissionCan>
- </Td>
- </Tr>
- ))}
- {currentProject.environments?.length === 0 && (
- <Tr>
- <Td colSpan={3}>
- <EmptyState title="No environments found" />
- </Td>
- </Tr>
- )}
- </TBody>
- </Table>
- </TableContainer>
+ </div>
+ </TableCell>
+ </TableRow>
+ ))}
+ </TableBody>
+ </Table>
);
};
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/UpdateEnvironmentModal.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/UpdateEnvironmentModal.tsx
index 1c9d09101c..c888ee5d49 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/UpdateEnvironmentModal.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/UpdateEnvironmentModal.tsx
@@ -3,7 +3,20 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
-import { Button, FormControl, Input, Modal, ModalContent } from "@app/components/v2";
+import {
+ Button,
+ Dialog,
+ DialogClose,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ Field,
+ FieldDescription,
+ FieldError,
+ FieldLabel,
+ Input
+} from "@app/components/v3";
import { useProject } from "@app/context";
import { useUpdateWsEnvironment } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -51,27 +64,28 @@ export const UpdateEnvironmentModal = ({ popUp, handlePopUpClose, handlePopUpTog
};
return (
- <Modal
- isOpen={popUp?.updateEnv?.isOpen}
+ <Dialog
+ open={popUp?.updateEnv?.isOpen}
onOpenChange={(isOpen) => {
handlePopUpToggle("updateEnv", isOpen);
- reset();
+ if (!isOpen) reset();
}}
>
- <ModalContent title="Update environment">
- <form onSubmit={handleSubmit(onFormSubmit)}>
+ <DialogContent className="sm:max-w-md">
+ <DialogHeader>
+ <DialogTitle>Update Environment</DialogTitle>
+ </DialogHeader>
+ <form onSubmit={handleSubmit(onFormSubmit)} className="flex flex-col gap-6">
<Controller
control={control}
defaultValue=""
name="name"
render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Environment Name"
- isError={Boolean(error)}
- errorText={error?.message}
- >
- <Input {...field} />
- </FormControl>
+ <Field>
+ <FieldLabel htmlFor="updateEnvName">Environment Name</FieldLabel>
+ <Input id="updateEnvName" isError={Boolean(error)} {...field} />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
<Controller
@@ -79,37 +93,28 @@ export const UpdateEnvironmentModal = ({ popUp, handlePopUpClose, handlePopUpTog
defaultValue=""
name="slug"
render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Environment Slug"
- helperText="Slugs are shorthands used in cli to access environment"
- isError={Boolean(error)}
- errorText={error?.message}
- >
- <Input {...field} />
- </FormControl>
+ <Field>
+ <FieldLabel htmlFor="updateEnvSlug">Environment Slug</FieldLabel>
+ <Input id="updateEnvSlug" isError={Boolean(error)} {...field} />
+ <FieldError>{error?.message}</FieldError>
+ <FieldDescription>
+ Slugs are shorthand identifiers used to reference this environment.
+ </FieldDescription>
+ </Field>
)}
/>
- <div className="mt-8 flex items-center">
- <Button
- className="mr-4"
- size="sm"
- type="submit"
- isLoading={isPending}
- isDisabled={isPending}
- >
+ <DialogFooter>
+ <DialogClose asChild>
+ <Button variant="ghost" type="button">
+ Cancel
+ </Button>
+ </DialogClose>
+ <Button type="submit" variant="project" isPending={isPending} isDisabled={isPending}>
Update
</Button>
-
- <Button
- onClick={() => handlePopUpClose("updateEnv")}
- colorSchema="secondary"
- variant="plain"
- >
- Cancel
- </Button>
- </div>
+ </DialogFooter>
</form>
- </ModalContent>
- </Modal>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/PointInTimeVersionLimitSection/PointInTimeVersionLimitSection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/PointInTimeVersionLimitSection/PointInTimeVersionLimitSection.tsx
index 6345301a02..694eca6515 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/PointInTimeVersionLimitSection/PointInTimeVersionLimitSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/PointInTimeVersionLimitSection/PointInTimeVersionLimitSection.tsx
@@ -3,7 +3,18 @@ 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,
+ Card,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+ Field,
+ FieldError,
+ FieldLabel,
+ Input
+} from "@app/components/v3";
import { useProject, useProjectPermission } from "@app/context";
import { useUpdateProject } from "@app/hooks/api";
import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
@@ -47,40 +58,47 @@ export const PointInTimeVersionLimitSection = () => {
const isAdmin = hasProjectRole(ProjectMembershipRole.Admin);
return (
- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <div className="flex w-full items-center justify-between">
- <p className="text-xl font-medium">Version Retention</p>
- </div>
- <p className="mt-2 mb-4 max-w-2xl text-sm text-gray-400">
- This defines the maximum number of recent secret versions to keep per folder. Excess
- versions will be removed at midnight (UTC) each day.
- </p>
- <form onSubmit={handleSubmit(handleVersionLimitSubmit)} autoComplete="off">
- <div className="max-w-xs">
+ <Card className="mb-6">
+ <CardHeader>
+ <CardTitle>Version Retention</CardTitle>
+ <CardDescription>
+ This defines the maximum number of recent secret versions to keep per folder. Excess
+ versions will be removed at midnight (UTC) each day.
+ </CardDescription>
+ </CardHeader>
+ <CardContent>
+ <form onSubmit={handleSubmit(handleVersionLimitSubmit)} autoComplete="off">
<Controller
control={control}
defaultValue={0}
name="pitVersionLimit"
render={({ field, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Recent versions to keep"
- >
- <Input {...field} type="number" min={1} step={1} isDisabled={!isAdmin} />
- </FormControl>
+ <Field className="max-w-xs">
+ <FieldLabel htmlFor="pitVersionLimit">Recent versions to keep</FieldLabel>
+ <Input
+ id="pitVersionLimit"
+ type="number"
+ min={1}
+ step={1}
+ isError={Boolean(error)}
+ disabled={!isAdmin}
+ {...field}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
- </div>
- <Button
- colorSchema="secondary"
- type="submit"
- isLoading={isSubmitting}
- disabled={!isAdmin || !isDirty}
- >
- Save
- </Button>
- </form>
- </div>
+ <Button
+ className="mt-4"
+ variant="project"
+ type="submit"
+ isPending={isSubmitting}
+ isDisabled={!isAdmin || !isDirty}
+ >
+ Save
+ </Button>
+ </form>
+ </CardContent>
+ </Card>
);
};
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/SecretDetectionIgnoreValuesSection/SecretDetectionIgnoreValuesSection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/SecretDetectionIgnoreValuesSection/SecretDetectionIgnoreValuesSection.tsx
index 5667afa760..fe8c3ccae5 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/SecretDetectionIgnoreValuesSection/SecretDetectionIgnoreValuesSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/SecretDetectionIgnoreValuesSection/SecretDetectionIgnoreValuesSection.tsx
@@ -1,12 +1,22 @@
import { useEffect } from "react";
import { Controller, useFieldArray, useForm } from "react-hook-form";
-import { faPlus, faTrash } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { zodResolver } from "@hookform/resolvers/zod";
+import { PlusIcon, TrashIcon } from "lucide-react";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
-import { Button, FormControl, IconButton, Input } from "@app/components/v2";
+import {
+ Button,
+ Card,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+ Field,
+ FieldError,
+ IconButton,
+ Input
+} from "@app/components/v3";
import { useProject, useProjectPermission } from "@app/context";
import { useUpdateProject } from "@app/hooks/api";
import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
@@ -71,71 +81,72 @@ export const SecretDetectionIgnoreValuesSection = () => {
if (!currentProject) return null;
return (
- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <div className="flex w-full items-center justify-between">
- <p className="text-xl font-medium">Secret Detection</p>
- </div>
- <p className="mt-2 mb-4 max-w-2xl text-sm text-gray-400">
- Define secret values to ignore when scanning designated parameter folders. Add values here
- to prevent false positives or allow approved sensitive data. These ignored values will not
- trigger policy violation alerts.
- </p>
-
- <form onSubmit={handleSubmit(handleIgnoreValuesSubmit)} autoComplete="off">
- <div className="mb-4">
- <div className="flex flex-col space-y-2">
+ <Card className="mb-6">
+ <CardHeader>
+ <CardTitle>Secret Detection</CardTitle>
+ <CardDescription>
+ Define secret values to ignore when scanning designated parameter folders. Add values here
+ to prevent false positives or allow approved sensitive data. These ignored values will not
+ trigger policy violation alerts.
+ </CardDescription>
+ </CardHeader>
+ <CardContent>
+ <form onSubmit={handleSubmit(handleIgnoreValuesSubmit)} autoComplete="off">
+ <div className="mb-4 flex flex-col gap-2">
{ignoreValuesFormFields.fields.map(({ id: ignoreValueFieldId }, i) => (
- <div key={ignoreValueFieldId} className="flex items-end space-x-2">
- <div className="grow">
- {i === 0 && <span className="text-xs text-mineshaft-400">Secret Value</span>}
- <Controller
- control={control}
- name={`ignoreValues.${i}.value`}
- render={({ field, fieldState: { error } }) => (
- <FormControl
+ <div key={ignoreValueFieldId} className="flex items-start gap-2">
+ <Controller
+ control={control}
+ name={`ignoreValues.${i}.value`}
+ render={({ field, fieldState: { error } }) => (
+ <Field className="grow">
+ {i === 0 && <span className="text-xs text-accent">Secret Value</span>}
+ <Input
+ {...field}
+ placeholder="sk-1234567890abcdef"
isError={Boolean(error?.message)}
- errorText={error?.message}
- className="mb-0"
- >
- <Input {...field} placeholder="sk-1234567890abcdef" isDisabled={!isAdmin} />
- </FormControl>
- )}
- />
- </div>
+ disabled={!isAdmin}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
<IconButton
- ariaLabel="delete ignore value"
- className="bottom-0.5 h-9"
- variant="outline_bg"
+ aria-label="Delete ignore value"
+ variant="ghost"
+ size="sm"
+ className={i === 0 ? "mt-[1.4rem]" : ""}
onClick={() => ignoreValuesFormFields.remove(i)}
isDisabled={!isAdmin}
>
- <FontAwesomeIcon icon={faTrash} />
+ <TrashIcon className="size-4" />
</IconButton>
</div>
))}
<div className="mt-2 flex justify-end">
<Button
- leftIcon={<FontAwesomeIcon icon={faPlus} />}
+ type="button"
size="xs"
- variant="outline_bg"
+ variant="outline"
onClick={() => ignoreValuesFormFields.append({ value: "" })}
isDisabled={!isAdmin}
>
+ <PlusIcon className="size-4" />
Add value to ignore
</Button>
</div>
</div>
- </div>
- <Button
- colorSchema="secondary"
- type="submit"
- isLoading={isSubmitting}
- disabled={!isAdmin || !isDirty}
- >
- Save
- </Button>
- </form>
- </div>
+ <Button
+ variant="project"
+ type="submit"
+ isPending={isSubmitting}
+ isDisabled={!isAdmin || !isDirty}
+ >
+ Save
+ </Button>
+ </form>
+ </CardContent>
+ </Card>
);
};
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/SecretSharingSection/SecretSharingSection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/SecretSharingSection/SecretSharingSection.tsx
index 9b611100f2..a38f5ced05 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/SecretSharingSection/SecretSharingSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/SecretSharingSection/SecretSharingSection.tsx
@@ -2,7 +2,15 @@ import { useState } from "react";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
-import { Checkbox } from "@app/components/v2";
+import {
+ Card,
+ CardContent,
+ Field,
+ FieldContent,
+ FieldDescription,
+ FieldTitle,
+ Switch
+} from "@app/components/v3";
import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { useUpdateProject } from "@app/hooks/api/projects/queries";
@@ -36,23 +44,28 @@ export const SecretSharingSection = () => {
};
return (
- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <p className="mb-3 text-xl font-medium">Allow Secret Sharing</p>
- <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.Settings}>
- {(isAllowed) => (
- <div>
- <Checkbox
- id="secretSharing"
- isDisabled={!isAllowed || isLoading}
- isChecked={currentProject?.secretSharing ?? true}
- onCheckedChange={(state) => handleToggle(state as boolean)}
- allowMultilineLabel
- >
- This feature enables your project members to securely share secrets.
- </Checkbox>
- </div>
- )}
- </ProjectPermissionCan>
- </div>
+ <Card className="mb-6">
+ <CardContent>
+ <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.Settings}>
+ {(isAllowed) => (
+ <Field orientation="horizontal">
+ <FieldContent>
+ <FieldTitle>Allow Secret Sharing</FieldTitle>
+ <FieldDescription>
+ This feature enables your project members to securely share secrets.
+ </FieldDescription>
+ </FieldContent>
+ <Switch
+ id="secretSharing"
+ variant="project"
+ checked={currentProject?.secretSharing ?? true}
+ disabled={!isAllowed || isLoading}
+ onCheckedChange={(state) => handleToggle(state)}
+ />
+ </Field>
+ )}
+ </ProjectPermissionCan>
+ </CardContent>
+ </Card>
);
};
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/SecretSnapshotsLegacySection/SecretSnapshotsLegacySection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/SecretSnapshotsLegacySection/SecretSnapshotsLegacySection.tsx
index 01c95f68f6..b604314796 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/SecretSnapshotsLegacySection/SecretSnapshotsLegacySection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/SecretSnapshotsLegacySection/SecretSnapshotsLegacySection.tsx
@@ -2,7 +2,15 @@ import { useState } from "react";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
-import { Checkbox } from "@app/components/v2";
+import {
+ Card,
+ CardContent,
+ Field,
+ FieldContent,
+ FieldDescription,
+ FieldTitle,
+ Switch
+} from "@app/components/v3";
import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { useUpdateProject } from "@app/hooks/api/projects/queries";
@@ -36,24 +44,29 @@ export const SecretSnapshotsLegacySection = () => {
};
return (
- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <p className="mb-3 text-xl font-medium">Show Secret Snapshots ( legacy )</p>
- <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.Settings}>
- {(isAllowed) => (
- <div>
- <Checkbox
- id="showSnapshotsLegacy"
- isDisabled={!isAllowed || isLoading}
- isChecked={currentProject?.showSnapshotsLegacy ?? false}
- onCheckedChange={(state) => handleToggle(state as boolean)}
- allowMultilineLabel
- >
- This feature enables your project members to view secret snapshots in the legacy
- format.
- </Checkbox>
- </div>
- )}
- </ProjectPermissionCan>
- </div>
+ <Card className="mb-6">
+ <CardContent>
+ <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.Settings}>
+ {(isAllowed) => (
+ <Field orientation="horizontal">
+ <FieldContent>
+ <FieldTitle>Show Secret Snapshots (legacy)</FieldTitle>
+ <FieldDescription>
+ This feature enables your project members to view secret snapshots in the legacy
+ format.
+ </FieldDescription>
+ </FieldContent>
+ <Switch
+ id="showSnapshotsLegacy"
+ variant="project"
+ checked={currentProject?.showSnapshotsLegacy ?? false}
+ disabled={!isAllowed || isLoading}
+ onCheckedChange={(state) => handleToggle(state)}
+ />
+ </Field>
+ )}
+ </ProjectPermissionCan>
+ </CardContent>
+ </Card>
);
};
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/AddSecretTagModal.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/AddSecretTagModal.tsx
index cfe7dff8e3..423d6974df 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/AddSecretTagModal.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/AddSecretTagModal.tsx
@@ -3,7 +3,20 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
-import { Button, FormControl, Input, Modal, ModalClose, ModalContent } from "@app/components/v2";
+import {
+ Button,
+ Dialog,
+ DialogClose,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ Field,
+ FieldError,
+ FieldLabel,
+ Input
+} from "@app/components/v3";
import { useProject } from "@app/context";
import { useCreateWsTag } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -57,45 +70,55 @@ export const AddSecretTagModal = ({ popUp, handlePopUpClose, handlePopUpToggle }
};
return (
- <Modal
- isOpen={popUp?.CreateSecretTag?.isOpen}
+ <Dialog
+ open={popUp?.CreateSecretTag?.isOpen}
onOpenChange={(open) => {
handlePopUpToggle("CreateSecretTag", open);
- reset();
+ if (!open) reset();
}}
>
- <ModalContent
- title={`Add a tag for ${currentProject?.name ?? ""}`}
- subTitle="Specify your tag name, and the slug will be created automatically."
- >
- <form onSubmit={handleSubmit(onFormSubmit)}>
+ <DialogContent className="sm:max-w-md">
+ <DialogHeader>
+ <DialogTitle>Add a Tag for {currentProject?.name ?? ""}</DialogTitle>
+ <DialogDescription>
+ Specify your tag name, and the slug will be created automatically.
+ </DialogDescription>
+ </DialogHeader>
+ <form onSubmit={handleSubmit(onFormSubmit)} className="flex flex-col gap-6">
<Controller
control={control}
name="slug"
defaultValue=""
render={({ field, fieldState: { error } }) => (
- <FormControl label="Tag Slug" isError={Boolean(error)} errorText={error?.message}>
- <Input {...field} placeholder="Type your tag slug" />
- </FormControl>
+ <Field>
+ <FieldLabel htmlFor="tagSlug">Tag Slug</FieldLabel>
+ <Input
+ id="tagSlug"
+ placeholder="Type your tag slug"
+ isError={Boolean(error)}
+ {...field}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
- <div className="mt-8 flex items-center">
+ <DialogFooter>
+ <DialogClose asChild>
+ <Button variant="ghost" type="button">
+ Cancel
+ </Button>
+ </DialogClose>
<Button
- className="mr-4"
type="submit"
+ variant="project"
+ isPending={isSubmitting}
isDisabled={isSubmitting}
- isLoading={isSubmitting}
>
Create
</Button>
- <ModalClose asChild>
- <Button variant="plain" colorSchema="secondary">
- Cancel
- </Button>
- </ModalClose>
- </div>
+ </DialogFooter>
</form>
- </ModalContent>
- </Modal>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/SecretTagsSection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/SecretTagsSection.tsx
index 2964467ad1..96ed3546e5 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/SecretTagsSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/SecretTagsSection.tsx
@@ -1,9 +1,26 @@
-import { faPlus } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { useState } from "react";
+import { PlusIcon } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import { PermissionDeniedBanner, ProjectPermissionCan } from "@app/components/permissions";
-import { Button, DeleteActionModal } from "@app/components/v2";
+import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogTitle,
+ Button,
+ Card,
+ CardAction,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+ Input
+} from "@app/components/v3";
import {
ProjectPermissionActions,
ProjectPermissionSub,
@@ -25,13 +42,16 @@ export const SecretTagsSection = (): JSX.Element => {
] as const);
const { currentProject } = useProject();
const { permission } = useProjectPermission();
+ const [deleteConfirmation, setDeleteConfirmation] = useState("");
const deleteWsTag = useDeleteWsTag();
+ const deleteTagData = popUp?.deleteTagConfirmation?.data as DeleteModalData | undefined;
const onDeleteApproved = async () => {
+ if (!deleteTagData?.id) return;
await deleteWsTag.mutateAsync({
projectId: currentProject?.id || "",
- tagID: (popUp?.deleteTagConfirmation?.data as DeleteModalData)?.id
+ tagID: deleteTagData.id
});
createNotification({
@@ -40,51 +60,85 @@ export const SecretTagsSection = (): JSX.Element => {
});
handlePopUpClose("deleteTagConfirmation");
+ setDeleteConfirmation("");
};
return (
- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <div className="mb-8 flex justify-between">
- <p className="mb-3 text-xl font-medium">Secret Tags</p>
- <ProjectPermissionCan I={ProjectPermissionActions.Create} a={ProjectPermissionSub.Tags}>
- {(isAllowed) => (
- <Button
- colorSchema="secondary"
- leftIcon={<FontAwesomeIcon icon={faPlus} />}
- onClick={() => {
- handlePopUpOpen("CreateSecretTag");
- }}
- isDisabled={!isAllowed}
- >
- Create Tag
- </Button>
- )}
- </ProjectPermissionCan>
- </div>
- <p className="mb-8 text-gray-400">
- Every secret can be assigned to one or more tags. Here you can add and remove tags for the
- current project.
- </p>
- {permission.can(ProjectPermissionActions.Read, ProjectPermissionSub.Tags) ? (
- <SecretTagsTable handlePopUpOpen={handlePopUpOpen} />
- ) : (
- <PermissionDeniedBanner />
- )}
+ <Card className="mb-6">
+ <CardHeader>
+ <CardTitle>Secret Tags</CardTitle>
+ <CardDescription>
+ Every secret can be assigned to one or more tags. Here you can add and remove tags for the
+ current project.
+ </CardDescription>
+ <CardAction>
+ <ProjectPermissionCan I={ProjectPermissionActions.Create} a={ProjectPermissionSub.Tags}>
+ {(isAllowed) => (
+ <Button
+ variant="project"
+ size="xs"
+ onClick={() => {
+ handlePopUpOpen("CreateSecretTag");
+ }}
+ isDisabled={!isAllowed}
+ >
+ <PlusIcon className="size-4" />
+ Create Tag
+ </Button>
+ )}
+ </ProjectPermissionCan>
+ </CardAction>
+ </CardHeader>
+ <CardContent>
+ {permission.can(ProjectPermissionActions.Read, ProjectPermissionSub.Tags) ? (
+ <SecretTagsTable handlePopUpOpen={handlePopUpOpen} />
+ ) : (
+ <PermissionDeniedBanner />
+ )}
+ </CardContent>
<AddSecretTagModal
popUp={popUp}
handlePopUpClose={handlePopUpClose}
handlePopUpToggle={handlePopUpToggle}
/>
- <DeleteActionModal
- isOpen={popUp.deleteTagConfirmation.isOpen}
- title={`Delete ${
- (popUp?.deleteTagConfirmation?.data as DeleteModalData)?.name || " "
- } api key?`}
- onChange={(isOpen) => handlePopUpToggle("deleteTagConfirmation", isOpen)}
- deleteKey={(popUp?.deleteTagConfirmation?.data as DeleteModalData)?.name}
- onClose={() => handlePopUpClose("deleteTagConfirmation")}
- onDeleteApproved={onDeleteApproved}
- />
- </div>
+ <AlertDialog
+ open={popUp.deleteTagConfirmation.isOpen}
+ onOpenChange={(isOpen) => {
+ handlePopUpToggle("deleteTagConfirmation", isOpen);
+ if (!isOpen) setDeleteConfirmation("");
+ }}
+ >
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogTitle>Delete Tag</AlertDialogTitle>
+ <AlertDialogDescription>
+ Are you sure you want to delete this tag? This action cannot be undone.
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <div className="w-full pb-4">
+ <p className="mb-2 text-sm text-muted">
+ Enter the tag slug{" "}
+ <span className="font-medium text-foreground">{deleteTagData?.name ?? ""}</span> to
+ confirm the deletion
+ </p>
+ <Input
+ value={deleteConfirmation}
+ onChange={(e) => setDeleteConfirmation(e.target.value)}
+ placeholder={deleteTagData?.name ?? ""}
+ />
+ </div>
+ <AlertDialogFooter>
+ <AlertDialogCancel>Cancel</AlertDialogCancel>
+ <AlertDialogAction
+ variant="danger"
+ onClick={onDeleteApproved}
+ disabled={!deleteTagData?.name || deleteConfirmation !== deleteTagData.name}
+ >
+ Delete
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+ </Card>
);
};
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/SecretTagsTable.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/SecretTagsTable.tsx
index 15d8ef7cbd..00c3932f98 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/SecretTagsTable.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/SecretTagsSection/SecretTagsTable.tsx
@@ -1,29 +1,25 @@
import { useMemo } from "react";
-import {
- faArrowDown,
- faArrowUp,
- faMagnifyingGlass,
- faSearch,
- faTag,
- faTrashCan
-} from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { ArrowDownIcon, ArrowUpIcon, SearchIcon, TrashIcon } from "lucide-react";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
- EmptyState,
+ Empty,
+ EmptyDescription,
+ EmptyHeader,
+ EmptyTitle,
IconButton,
- Input,
+ InputGroup,
+ InputGroupAddon,
+ InputGroupInput,
Pagination,
+ Skeleton,
Table,
- TableContainer,
- TableSkeleton,
- TBody,
- Td,
- Th,
- THead,
- Tr
-} from "@app/components/v2";
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow
+} from "@app/components/v3";
import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import {
getUserTablePreference,
@@ -95,69 +91,94 @@ export const SecretTagsTable = ({ handlePopUpOpen }: Props) => {
return (
<div>
- <Input
- value={search}
- onChange={(e) => setSearch(e.target.value)}
- leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
- placeholder="Search tags..."
- />
- <TableContainer className="mt-4">
- <Table>
- <THead>
- <Tr>
- <Th className="w-full">
- <div className="flex items-center">
- Slug
- <IconButton
- variant="plain"
- className="ml-2"
- ariaLabel="sort"
- onClick={toggleOrderDirection}
- >
- <FontAwesomeIcon
- icon={orderDirection === OrderByDirection.DESC ? faArrowUp : faArrowDown}
- />
- </IconButton>
- </div>
- </Th>
- <Th aria-label="button" />
- </Tr>
- </THead>
- <TBody>
- {isPending && <TableSkeleton columns={3} innerKey="secret-tags" />}
- {!isPending &&
- filteredTags.slice(offset, perPage * page).map(({ id, slug }) => (
- <Tr key={id}>
- <Td>{slug}</Td>
- <Td className="flex items-center justify-end">
- <ProjectPermissionCan
- I={ProjectPermissionActions.Delete}
- a={ProjectPermissionSub.Tags}
+ <InputGroup className="mb-4">
+ <InputGroupAddon>
+ <SearchIcon />
+ </InputGroupAddon>
+ <InputGroupInput
+ value={search}
+ onChange={(e) => setSearch(e.target.value)}
+ placeholder="Search tags..."
+ />
+ </InputGroup>
+ {isPending && (
+ <div className="flex flex-col gap-2">
+ {Array.from({ length: 4 }).map((_, idx) => (
+ // eslint-disable-next-line react/no-array-index-key
+ <Skeleton key={`secret-tags-skeleton-${idx}`} className="h-10 w-full" />
+ ))}
+ </div>
+ )}
+ {!isPending && !filteredTags.length && (
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyTitle>{tags.length ? "No tags match search" : "No tags found"}</EmptyTitle>
+ <EmptyDescription>
+ {tags.length
+ ? "Try a different search term."
+ : "Create a tag to organize secrets in this project."}
+ </EmptyDescription>
+ </EmptyHeader>
+ </Empty>
+ )}
+ {!isPending && filteredTags.length > 0 && (
+ <>
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead className="w-full">
+ <div className="flex items-center gap-2">
+ Slug
+ <IconButton
+ aria-label="Sort by slug"
+ variant="ghost-muted"
+ size="xs"
+ onClick={toggleOrderDirection}
>
- {(isAllowed) => (
- <IconButton
- onClick={() =>
- handlePopUpOpen("deleteTagConfirmation", {
- name: slug,
- id
- })
- }
- size="xs"
- colorSchema="danger"
- ariaLabel="update"
- variant="plain"
- isDisabled={!isAllowed}
- >
- <FontAwesomeIcon icon={faTrashCan} />
- </IconButton>
+ {orderDirection === OrderByDirection.DESC ? (
+ <ArrowUpIcon className="size-4" />
+ ) : (
+ <ArrowDownIcon className="size-4" />
)}
- </ProjectPermissionCan>
- </Td>
- </Tr>
+ </IconButton>
+ </div>
+ </TableHead>
+ <TableHead className="text-right">Actions</TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {filteredTags.slice(offset, perPage * page).map(({ id, slug }) => (
+ <TableRow key={id}>
+ <TableCell>{slug}</TableCell>
+ <TableCell>
+ <div className="flex items-center justify-end">
+ <ProjectPermissionCan
+ I={ProjectPermissionActions.Delete}
+ a={ProjectPermissionSub.Tags}
+ >
+ {(isAllowed) => (
+ <IconButton
+ aria-label="Delete tag"
+ variant="danger"
+ size="xs"
+ onClick={() =>
+ handlePopUpOpen("deleteTagConfirmation", {
+ name: slug,
+ id
+ })
+ }
+ isDisabled={!isAllowed}
+ >
+ <TrashIcon className="size-4" />
+ </IconButton>
+ )}
+ </ProjectPermissionCan>
+ </div>
+ </TableCell>
+ </TableRow>
))}
- </TBody>
- </Table>
- {Boolean(filteredTags.length) && (
+ </TableBody>
+ </Table>
<Pagination
count={filteredTags.length}
page={page}
@@ -165,14 +186,8 @@ export const SecretTagsTable = ({ handlePopUpOpen }: Props) => {
onChangePage={setPage}
onChangePerPage={handlePerPageChange}
/>
- )}
- {!isPending && !filteredTags?.length && (
- <EmptyState
- title={tags.length ? "No tags match search..." : "No tags found for project"}
- icon={tags.length ? faSearch : faTag}
- />
- )}
- </TableContainer>
+ </>
+ )}
</div>
);
};