Skip to content

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

requested changes

varonix0aea7f4a5d80f
diff --git a/frontend/src/hooks/api/secrets/index.ts b/frontend/src/hooks/api/secrets/index.ts
index 3f5596e378..3f6bb42a25 100644
--- a/frontend/src/hooks/api/secrets/index.ts
+++ b/frontend/src/hooks/api/secrets/index.ts
@@ -1,5 +1,4 @@
export {
- useBackfillSecretReference,
useCreateSecretBatch,
useCreateSecretV3,
useDeleteSecretBatch,
diff --git a/frontend/src/hooks/api/secrets/mutations.tsx b/frontend/src/hooks/api/secrets/mutations.tsx
index ce48d28e82..dcc84990ad 100644
--- a/frontend/src/hooks/api/secrets/mutations.tsx
+++ b/frontend/src/hooks/api/secrets/mutations.tsx
@@ -564,16 +564,6 @@ export const createSecret = async (dto: TCreateSecretsV3DTO) => {
return data;
};
-export const useBackfillSecretReference = () =>
- useMutation<{ message: string }, object, { projectId: string }>({
- mutationFn: async ({ projectId }) => {
- const { data } = await apiRequest.post("/api/v4/secrets/backfill-secret-references", {
- projectId
- });
- return data.message;
- }
- });
-
export const useCreateCommit = () => {
const queryClient = useQueryClient();
return useMutation<
diff --git a/frontend/src/pages/secret-manager/SettingsPage/SettingsPage.tsx b/frontend/src/pages/secret-manager/SettingsPage/SettingsPage.tsx
index 82f8bff6de..0327e566a5 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/SettingsPage.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/SettingsPage.tsx
@@ -73,7 +73,11 @@ export const SettingsPage = () => {
}
];
- const activeTab = tabs.find((tab) => !tab.isHidden && tab.key === selectedTab);
+ const visibleTabs = tabs.filter((tab) => !tab.isHidden);
+ const activeTab =
+ visibleTabs.find((tab) => tab.key === selectedTab) ??
+ visibleTabs.find((tab) => tab.key === "tab-project-general") ??
+ visibleTabs[0];
const baseTitle = t("settings.project.title");
const pageTitle = activeTab ? `${activeTab.name} - ${baseTitle}` : baseTitle;
@@ -99,14 +103,12 @@ export const SettingsPage = () => {
settings?
</Link>
</PageHeader>
- <Tabs orientation="vertical" value={selectedTab}>
- {tabs
- .filter((el) => !el.isHidden)
- .map(({ key, Component }) => (
- <TabPanel value={key} key={key}>
- <Component />
- </TabPanel>
- ))}
+ <Tabs orientation="vertical" value={activeTab?.key}>
+ {visibleTabs.map(({ key, Component }) => (
+ <TabPanel value={key} key={key}>
+ <Component />
+ </TabPanel>
+ ))}
</Tabs>
</div>
</div>
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/PreferencesSection/PreferencesSection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/PreferencesSection/PreferencesSection.tsx
index 9e2c6b1ac1..616c43ec24 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/PreferencesSection/PreferencesSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/PreferencesSection/PreferencesSection.tsx
@@ -1,3 +1,4 @@
+import { useState } from "react";
import { useTranslation } from "react-i18next";
import { createNotification } from "@app/components/notifications";
@@ -18,37 +19,56 @@ import {
import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
import { useUpdateProject } from "@app/hooks/api";
+type ToggleKey = "autoCapitalization" | "enforceEncryptedMetadata" | "secretSharing";
+
export const PreferencesSection = () => {
const { t } = useTranslation();
const { currentProject } = useProject();
const { mutateAsync } = useUpdateProject();
+ const [pending, setPending] = useState<Record<ToggleKey, boolean>>({
+ autoCapitalization: false,
+ enforceEncryptedMetadata: false,
+ secretSharing: false
+ });
- const notify = (state: boolean, label: string) =>
- createNotification({
- text: `Successfully ${state ? "enabled" : "disabled"} ${label}`,
- type: "success"
- });
+ const isPending = (key: ToggleKey) => pending[key];
- const handleToggleAutoCapitalization = async (state: boolean) => {
- if (!currentProject?.id) return;
- await mutateAsync({ projectId: currentProject.id, autoCapitalization: state });
- notify(state, "auto capitalization");
+ const runToggle = async (
+ key: ToggleKey,
+ state: boolean,
+ successLabel: string,
+ mutation: () => Promise<unknown>
+ ) => {
+ if (!currentProject?.id || pending[key]) return;
+ setPending((prev) => ({ ...prev, [key]: true }));
+ try {
+ await mutation();
+ createNotification({
+ text: `Successfully ${state ? "enabled" : "disabled"} ${successLabel}`,
+ type: "success"
+ });
+ } finally {
+ setPending((prev) => ({ ...prev, [key]: false }));
+ }
};
- const handleToggleEnforceEncryptedMetadata = async (state: boolean) => {
- if (!currentProject?.id) return;
- await mutateAsync({
- projectId: currentProject.id,
- enforceEncryptedSecretManagerSecretMetadata: state
- });
- notify(state, "enforced encrypted metadata");
- };
+ const handleToggleAutoCapitalization = (state: boolean) =>
+ runToggle("autoCapitalization", state, "auto capitalization", () =>
+ mutateAsync({ projectId: currentProject!.id, autoCapitalization: state })
+ );
- const handleToggleSecretSharing = async (state: boolean) => {
- if (!currentProject?.id) return;
- await mutateAsync({ projectId: currentProject.id, secretSharing: state });
- notify(state, "secret sharing for this project");
- };
+ const handleToggleEnforceEncryptedMetadata = (state: boolean) =>
+ runToggle("enforceEncryptedMetadata", state, "enforced encrypted metadata", () =>
+ mutateAsync({
+ projectId: currentProject!.id,
+ enforceEncryptedSecretManagerSecretMetadata: state
+ })
+ );
+
+ const handleToggleSecretSharing = (state: boolean) =>
+ runToggle("secretSharing", state, "secret sharing for this project", () =>
+ mutateAsync({ projectId: currentProject!.id, secretSharing: state })
+ );
return (
<Card className="mb-6">
@@ -76,7 +96,7 @@ export const PreferencesSection = () => {
id="autoCapitalization"
variant="project"
checked={currentProject?.autoCapitalization ?? false}
- disabled={!isAllowed}
+ disabled={!isAllowed || isPending("autoCapitalization")}
onCheckedChange={handleToggleAutoCapitalization}
/>
)}
@@ -99,7 +119,7 @@ export const PreferencesSection = () => {
id="enforceEncryptedMetadata"
variant="project"
checked={currentProject?.enforceEncryptedSecretManagerSecretMetadata ?? false}
- disabled={!isAllowed}
+ disabled={!isAllowed || isPending("enforceEncryptedMetadata")}
onCheckedChange={handleToggleEnforceEncryptedMetadata}
/>
)}
@@ -121,7 +141,7 @@ export const PreferencesSection = () => {
id="secretSharing"
variant="project"
checked={currentProject?.secretSharing ?? true}
- disabled={!isAllowed}
+ disabled={!isAllowed || isPending("secretSharing")}
onCheckedChange={handleToggleSecretSharing}
/>
)}