Skip to content

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

fix position

adilson96c470d4527d
diff --git a/backend/src/services/project-env/project-env-dal.ts b/backend/src/services/project-env/project-env-dal.ts
index da9e768427..dcf4a433a1 100644
--- a/backend/src/services/project-env/project-env-dal.ts
+++ b/backend/src/services/project-env/project-env-dal.ts
@@ -74,13 +74,14 @@ export const projectEnvDALFactory = (db: TDbClient) => {
softDeletedAt: Date,
deletedByUserId: string | null,
deletedByIdentityId: string | null,
+ position: number,
tx?: Knex
) => {
try {
const [doc] = await (tx || db)(TableName.Environment)
.where({ id, projectId })
.whereNull("hardDeletesAt")
- .update({ hardDeletesAt, softDeletedAt, deletedByUserId, deletedByIdentityId })
+ .update({ hardDeletesAt, softDeletedAt, deletedByUserId, deletedByIdentityId, position })
.returning("*");
return doc as TProjectEnvironments | undefined;
} catch (error) {
@@ -179,6 +180,15 @@ export const projectEnvDALFactory = (db: TDbClient) => {
await (tx || db)(TableName.Environment).where({ projectId }).where("position", ">=", pos).increment("position", 1);
};
+ // Closes a gap at `pos` by shifting all higher positions down by 1.
+ // Symmetric to shiftPositions, which opens a slot at `pos`.
+ const closePositionGap = async (projectId: string, pos: number, tx?: Knex) => {
+ await (tx || db)(TableName.Environment)
+ .where({ projectId })
+ .andWhere("position", ">", pos)
+ .decrement("position", 1);
+ };
+
return {
...projectEnvOrm,
findById,
@@ -191,6 +201,7 @@ export const projectEnvDALFactory = (db: TDbClient) => {
restoreById,
findLastEnvPosition,
updateAllPosition,
- shiftPositions
+ shiftPositions,
+ closePositionGap
};
};
diff --git a/backend/src/services/project-env/project-env-queue.ts b/backend/src/services/project-env/project-env-queue.ts
index f61629bfdb..6bcd5cf1d4 100644
--- a/backend/src/services/project-env/project-env-queue.ts
+++ b/backend/src/services/project-env/project-env-queue.ts
@@ -12,7 +12,10 @@ export const SOFT_DELETE_GRACE_MS = SOFT_DELETE_GRACE_DAYS * 24 * 60 * 60 * 1000
type TProjectEnvQueueFactoryDep = {
queueService: TQueueServiceFactory;
- projectEnvDAL: Pick<TProjectEnvDALFactory, "findByIdIncludingExpired" | "delete" | "transaction">;
+ projectEnvDAL: Pick<
+ TProjectEnvDALFactory,
+ "findByIdIncludingExpired" | "delete" | "transaction" | "closePositionGap"
+ >;
keyStore: Pick<TKeyStoreFactory, "acquireLock">;
auditLogService: Pick<TAuditLogServiceFactory, "createAuditLog">;
};
@@ -85,7 +88,10 @@ export const projectEnvQueueFactory = ({
return;
}
- await projectEnvDAL.delete({ id: envId, projectId });
+ await projectEnvDAL.transaction(async (tx) => {
+ await projectEnvDAL.delete({ id: envId, projectId }, tx);
+ await projectEnvDAL.closePositionGap(projectId, fresh.position, tx);
+ });
logger.info(`project-env-hard-delete: hard-deleted environment [envId=${envId}] [projectId=${projectId}]`);
await auditLogService.createAuditLog({
diff --git a/backend/src/services/project-env/project-env-service.ts b/backend/src/services/project-env/project-env-service.ts
index aecedc597b..e70e1656c8 100644
--- a/backend/src/services/project-env/project-env-service.ts
+++ b/backend/src/services/project-env/project-env-service.ts
@@ -285,12 +285,28 @@ export const projectEnvServiceFactory = ({
name: "DeleteEnvironment"
});
+ await projectEnvDAL.closePositionGap(projectId, doc.position, tx);
+
// Clear any pending soft-delete cleanup; harmless if none exists.
await projectEnvQueue.cancelScheduledHardDelete(id);
return doc;
}
+ const target = await projectEnvDAL.findOne({ id, projectId }, tx);
+ if (!target)
+ throw new NotFoundError({
+ message: `Environment with id '${id}' in project with ID '${projectId}' not found`,
+ name: "DeleteEnvironment"
+ });
+
+ const maxPos = await projectEnvDAL.findLastEnvPosition(projectId, tx);
+ // Shift first (closes the gap at oldPos), then place the soft-deleted row at the
+ // pre-shift max position — that slot is now free since its previous occupant was
+ // shifted down to maxPos - 1. Deferred UNIQUE (projectId, position) tolerates the
+ // intermediate duplicate at oldPos.
+ await projectEnvDAL.closePositionGap(projectId, target.position, tx);
+
const softDeletedAt = new Date();
const hardDeletesAt = new Date(softDeletedAt.getTime() + SOFT_DELETE_GRACE_MS);
const deletedByUserId = actor === ActorType.USER ? actorId : null;
@@ -302,6 +318,7 @@ export const projectEnvServiceFactory = ({
softDeletedAt,
deletedByUserId,
deletedByIdentityId,
+ maxPos,
tx
);
if (!doc)
@@ -352,7 +369,8 @@ export const projectEnvServiceFactory = ({
await keyStore.waitTillReady({
key: operationMarkerKey,
keyCheckCb: (val) => !val || val === "false",
- waitingCb: () => logger.debug("Restore project environment. Waiting for "),
+ waitingCb: () =>
+ logger.debug("Restore project environment. Waiting for previous environment operation to finish"),
delay: 500
});
}
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 06e3fd62d2..94839a5257 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/AutoCapitalizationSection/AutoCapitalizationSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/AutoCapitalizationSection/AutoCapitalizationSection.tsx
@@ -4,11 +4,10 @@ import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
Card,
- CardContent,
- Field,
- FieldContent,
- FieldDescription,
- FieldTitle,
+ CardAction,
+ CardDescription,
+ CardHeader,
+ CardTitle,
Switch
} from "@app/components/v3";
import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
@@ -37,16 +36,14 @@ export const AutoCapitalizationSection = () => {
return (
<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>
+ <CardHeader>
+ <CardTitle>{t("settings.project.enforce-capitalization")}</CardTitle>
+ <CardDescription>
+ {t("settings.project.enforce-capitalization-description")}
+ </CardDescription>
+ <CardAction>
+ <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.Settings}>
+ {(isAllowed) => (
<Switch
id="autoCapitalization"
variant="project"
@@ -56,10 +53,10 @@ export const AutoCapitalizationSection = () => {
handleToggleCapitalizationToggle(state);
}}
/>
- </Field>
- )}
- </ProjectPermissionCan>
- </CardContent>
+ )}
+ </ProjectPermissionCan>
+ </CardAction>
+ </CardHeader>
</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 3aae5c9386..090368cc68 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/EnforceEncryptedMetadataSection/EnforceEncryptedMetadataSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/EnforceEncryptedMetadataSection/EnforceEncryptedMetadataSection.tsx
@@ -2,11 +2,10 @@ import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
Card,
- CardContent,
- Field,
- FieldContent,
- FieldDescription,
- FieldTitle,
+ CardAction,
+ CardDescription,
+ CardHeader,
+ CardTitle,
Switch
} from "@app/components/v3";
import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
@@ -33,17 +32,15 @@ export const EnforceEncryptedMetadataSection = () => {
return (
<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>
+ <CardHeader>
+ <CardTitle>Enforce Encrypted Metadata</CardTitle>
+ <CardDescription>
+ When enabled, secrets in this project can only have encrypted metadata. Unencrypted
+ metadata fields will be rejected.
+ </CardDescription>
+ <CardAction>
+ <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.Settings}>
+ {(isAllowed) => (
<Switch
id="enforceEncryptedMetadata"
variant="project"
@@ -53,10 +50,10 @@ export const EnforceEncryptedMetadataSection = () => {
handleToggle(state);
}}
/>
- </Field>
- )}
- </ProjectPermissionCan>
- </CardContent>
+ )}
+ </ProjectPermissionCan>
+ </CardAction>
+ </CardHeader>
</Card>
);
};
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 b614c30aba..3615e53f79 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentSection.tsx
@@ -1,18 +1,13 @@
import { useState } from "react";
import { addDays, format } from "date-fns";
-import {
- ClockIcon,
- KeyIcon,
- PlusIcon,
- RotateCcwIcon,
- Trash2Icon,
- TriangleAlertIcon
-} from "lucide-react";
+import { ClockIcon, KeyIcon, PlusIcon, RotateCcwIcon, TriangleAlertIcon } from "lucide-react";
import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
import { createNotification } from "@app/components/notifications";
import { PermissionDeniedBanner, ProjectPermissionCan } from "@app/components/permissions";
import {
+ Alert,
+ AlertDescription,
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
@@ -230,22 +225,19 @@ export const EnvironmentSection = () => {
secrets, folders, and history will be lost. This cannot be undone.
</AlertDialogDescription>
</AlertDialogHeader>
- <div className="space-y-2 rounded-md border border-danger/30 bg-danger/5 p-3 text-sm">
- <div className="flex gap-2">
- <Trash2Icon className="mt-0.5 size-4 shrink-0 text-danger" />
+ <Alert variant="danger">
+ <TriangleAlertIcon />
+ <AlertDescription>
<p>
- <span className="font-medium text-foreground">All secrets and folders</span>{" "}
- <span className="opacity-80">will be wiped from storage.</span>
+ <span className="font-medium text-foreground">All secrets and folders</span> will be
+ wiped from storage.
</p>
- </div>
- <div className="flex gap-2">
- <TriangleAlertIcon className="mt-0.5 size-4 shrink-0 text-danger" />
- <span className="opacity-80">
+ <p>
Any service token or integration referencing {hardDeleteEnvData?.slug ?? ""} will
fail immediately and cannot be restored from this UI.
- </span>
- </div>
- </div>
+ </p>
+ </AlertDescription>
+ </Alert>
<div className="w-full pt-2 pb-4">
<p className="mb-2 text-sm text-muted">
Type {hardDeleteEnvData?.slug ?? ""} to confirm.
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 159f5575d2..7bb1c9ea47 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentTable.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentTable.tsx
@@ -6,8 +6,7 @@ import {
HourglassIcon,
PencilIcon,
RotateCcwIcon,
- Trash2Icon,
- XIcon
+ Trash2Icon
} from "lucide-react";
import { createNotification } from "@app/components/notifications";
@@ -194,132 +193,130 @@ export const EnvironmentTable = ({ handlePopUpOpen }: Props) => {
</IconButton>
)}
</ProjectPermissionCan>
- <ProjectPermissionCan
- I={ProjectPermissionActions.Edit}
- a={ProjectPermissionSub.Environments}
- >
- {(isAllowed) => (
- <Tooltip>
- <TooltipTrigger asChild>
- <span>
- <IconButton
- aria-label="Edit environment"
- variant="ghost-muted"
- onClick={() => {
- handlePopUpOpen("updateEnv", { name, slug, id });
- }}
- isDisabled={!isAllowed || !isMoreEnvironmentsAllowed}
- >
- <PencilIcon />
- </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>
- <ProjectPermissionCan
- I={ProjectPermissionActions.Delete}
- a={ProjectPermissionSub.Environments}
- >
- {(isAllowed) => (
- <IconButton
- aria-label="Delete environment"
- variant="danger"
- onClick={() => {
- handlePopUpOpen("deleteEnv", { name, slug, id });
- }}
- isDisabled={!isAllowed}
- >
- <XIcon />
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <IconButton aria-label="Environment options" variant="ghost-muted">
+ <Ellipsis />
</IconButton>
- )}
- </ProjectPermissionCan>
- </div>
- </TableCell>
- </TableRow>
- ))}
- {deletedEnvironments.map(
- ({ name, slug, id, hardDeletesAt, softDeletedAt, deletedBy }) => {
- const hardDeletesAtDate = new Date(hardDeletesAt);
- const remaining = formatRemainingDuration(hardDeletesAtDate);
-
- return (
- <TableRow key={id} className="bg-warning/[0.025]">
- <TableCell className="text-mineshaft-400 line-through">{name}</TableCell>
- <TableCell className="text-mineshaft-400">{slug}</TableCell>
- <TableCell>
- <div className="flex items-center justify-end gap-2">
- <Tooltip>
- <TooltipTrigger asChild>
- <Badge variant="warning">
- <HourglassIcon />
- Pending deletion
- </Badge>
- </TooltipTrigger>
- <TooltipContent className="max-w-xs">
- <div className="flex flex-col gap-1">
- <span className="text-sm font-semibold text-foreground">
- {remaining
- ? `${remaining} until permanent deletion`
- : "Awaiting permanent deletion"}
- </span>
- <span className="text-xs text-mineshaft-300">
- Scheduled for {format(hardDeletesAtDate, "MMM d, yyyy, h:mm a")}
- </span>
- <span className="text-xs text-mineshaft-300">
- Soft-deleted by {getActorLabel(deletedBy)} ·{" "}
- {format(new Date(softDeletedAt), "MMM d, yyyy")}
- </span>
- </div>
- </TooltipContent>
- </Tooltip>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
<ProjectPermissionCan
- I={ProjectPermissionActions.Delete}
+ I={ProjectPermissionActions.Edit}
a={ProjectPermissionSub.Environments}
>
{(isAllowed) => (
- <DropdownMenu>
- <DropdownMenuTrigger asChild disabled={!isAllowed}>
- <IconButton
- aria-label="Environment options"
- variant="ghost-muted"
- isDisabled={!isAllowed}
- >
- <Ellipsis />
- </IconButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- <DropdownMenuItem onClick={() => handleRestoreEnv(id)}>
- <RotateCcwIcon />
- Restore environment
- </DropdownMenuItem>
+ <Tooltip open={!isMoreEnvironmentsAllowed ? undefined : false}>
+ <TooltipTrigger asChild>
<DropdownMenuItem
- variant="danger"
- onClick={() =>
- handlePopUpOpen("hardDeleteEnv", { name, slug, id, hardDeletesAt })
- }
+ isDisabled={!isAllowed || !isMoreEnvironmentsAllowed}
+ onClick={() => handlePopUpOpen("updateEnv", { name, slug, id })}
>
- <Trash2Icon />
- Delete permanently
+ <PencilIcon />
+ Edit environment
</DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
+ </TooltipTrigger>
+ <TooltipContent side="left">
+ 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>
+ <ProjectPermissionCan
+ I={ProjectPermissionActions.Delete}
+ a={ProjectPermissionSub.Environments}
+ >
+ {(isAllowed) => (
+ <DropdownMenuItem
+ variant="danger"
+ isDisabled={!isAllowed}
+ onClick={() => handlePopUpOpen("deleteEnv", { name, slug, id })}
+ >
+ <Trash2Icon />
+ Delete environment
+ </DropdownMenuItem>
)}
</ProjectPermissionCan>
- </div>
- </TableCell>
- </TableRow>
- );
- }
- )}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
+ </TableCell>
+ </TableRow>
+ ))}
+ {deletedEnvironments.map(({ name, slug, id, hardDeletesAt, softDeletedAt, deletedBy }) => {
+ const hardDeletesAtDate = new Date(hardDeletesAt);
+ const remaining = formatRemainingDuration(hardDeletesAtDate);
+
+ return (
+ <TableRow key={id} className="bg-warning/[0.025]">
+ <TableCell className="text-mineshaft-400 line-through">{name}</TableCell>
+ <TableCell className="text-mineshaft-400">{slug}</TableCell>
+ <TableCell>
+ <div className="flex items-center justify-end gap-2">
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Badge variant="warning">
+ <HourglassIcon />
+ Pending deletion
+ </Badge>
+ </TooltipTrigger>
+ <TooltipContent className="max-w-xs">
+ <div className="flex flex-col gap-1">
+ <span className="text-sm font-semibold text-foreground">
+ {remaining
+ ? `${remaining} until permanent deletion`
+ : "Awaiting permanent deletion"}
+ </span>
+ <span className="text-xs text-mineshaft-300">
+ Scheduled for {format(hardDeletesAtDate, "MMM d, yyyy, h:mm a")}
+ </span>
+ <span className="text-xs text-mineshaft-300">
+ Soft-deleted by {getActorLabel(deletedBy)} ·{" "}
+ {format(new Date(softDeletedAt), "MMM d, yyyy")}
+ </span>
+ </div>
+ </TooltipContent>
+ </Tooltip>
+ <ProjectPermissionCan
+ I={ProjectPermissionActions.Delete}
+ a={ProjectPermissionSub.Environments}
+ >
+ {(isAllowed) => (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild disabled={!isAllowed}>
+ <IconButton
+ aria-label="Environment options"
+ variant="ghost-muted"
+ isDisabled={!isAllowed}
+ >
+ <Ellipsis />
+ </IconButton>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem onClick={() => handleRestoreEnv(id)}>
+ <RotateCcwIcon />
+ Restore environment
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ variant="danger"
+ onClick={() =>
+ handlePopUpOpen("hardDeleteEnv", { name, slug, id, hardDeletesAt })
+ }
+ >
+ <Trash2Icon />
+ Delete permanently
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )}
+ </ProjectPermissionCan>
+ </div>
+ </TableCell>
+ </TableRow>
+ );
+ })}
</TableBody>
</Table>
);
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 a38f5ced05..c21e6ba913 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/SecretSharingSection/SecretSharingSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/SecretSharingSection/SecretSharingSection.tsx
@@ -4,11 +4,10 @@ import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
Card,
- CardContent,
- Field,
- FieldContent,
- FieldDescription,
- FieldTitle,
+ CardAction,
+ CardDescription,
+ CardHeader,
+ CardTitle,
Switch
} from "@app/components/v3";
import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
@@ -45,16 +44,14 @@ export const SecretSharingSection = () => {
return (
<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>
+ <CardHeader>
+ <CardTitle>Allow Secret Sharing</CardTitle>
+ <CardDescription>
+ This feature enables your project members to securely share secrets.
+ </CardDescription>
+ <CardAction>
+ <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.Settings}>
+ {(isAllowed) => (
<Switch
id="secretSharing"
variant="project"
@@ -62,10 +59,10 @@ export const SecretSharingSection = () => {
disabled={!isAllowed || isLoading}
onCheckedChange={(state) => handleToggle(state)}
/>
- </Field>
- )}
- </ProjectPermissionCan>
- </CardContent>
+ )}
+ </ProjectPermissionCan>
+ </CardAction>
+ </CardHeader>
</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 b604314796..da2bdecd0d 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/SecretSnapshotsLegacySection/SecretSnapshotsLegacySection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/SecretSnapshotsLegacySection/SecretSnapshotsLegacySection.tsx
@@ -4,11 +4,10 @@ import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
Card,
- CardContent,
- Field,
- FieldContent,
- FieldDescription,
- FieldTitle,
+ CardAction,
+ CardDescription,
+ CardHeader,
+ CardTitle,
Switch
} from "@app/components/v3";
import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
@@ -45,17 +44,14 @@ export const SecretSnapshotsLegacySection = () => {
return (
<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>
+ <CardHeader>
+ <CardTitle>Show Secret Snapshots (legacy)</CardTitle>
+ <CardDescription>
+ This feature enables your project members to view secret snapshots in the legacy format.
+ </CardDescription>
+ <CardAction>
+ <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.Settings}>
+ {(isAllowed) => (
<Switch
id="showSnapshotsLegacy"
variant="project"
@@ -63,10 +59,10 @@ export const SecretSnapshotsLegacySection = () => {
disabled={!isAllowed || isLoading}
onCheckedChange={(state) => handleToggle(state)}
/>
- </Field>
- )}
- </ProjectPermissionCan>
- </CardContent>
+ )}
+ </ProjectPermissionCan>
+ </CardAction>
+ </CardHeader>
</Card>
);
};