Skip to content

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

feat: completed breadcrumb and settings changes

=6b3279cbe51e
diff --git a/frontend/src/components/v2/Breadcrumb/Breadcrumb.tsx b/frontend/src/components/v2/Breadcrumb/Breadcrumb.tsx
index 20684ee611..b623276fcb 100644
--- a/frontend/src/components/v2/Breadcrumb/Breadcrumb.tsx
+++ b/frontend/src/components/v2/Breadcrumb/Breadcrumb.tsx
@@ -1,6 +1,6 @@
/* eslint-disable react/prop-types */
import React from "react";
-import { faCaretDown, faEllipsis, faSlash } from "@fortawesome/free-solid-svg-icons";
+import { faEllipsis, faSlash, faSort } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Link, ReactNode } from "@tanstack/react-router";
import { LinkComponentProps } from "node_modules/@tanstack/react-router/dist/esm/link";
@@ -141,11 +141,11 @@ const BreadcrumbContainer = ({ breadcrumbs }: { breadcrumbs: TBreadcrumbFormat[]
<DropdownMenuTrigger>
<BreadcrumbItem>
<BreadcrumbSegment>
- {el.label} <FontAwesomeIcon icon={faCaretDown} size="sm" />
+ {el.label} <FontAwesomeIcon icon={faSort} size="sm" />
</BreadcrumbSegment>
</BreadcrumbItem>
</DropdownMenuTrigger>
- <DropdownMenuContent>
+ <DropdownMenuContent side="right" align="start">
{el?.dropdownTitle && <DropdownMenuLabel>{el.dropdownTitle}</DropdownMenuLabel>}
{el.links.map((i, dropIndex) => (
<Link
diff --git a/frontend/src/layouts/KmsLayout/KmsLayout.tsx b/frontend/src/layouts/KmsLayout/KmsLayout.tsx
index ba31e870d2..e1db9db5a1 100644
--- a/frontend/src/layouts/KmsLayout/KmsLayout.tsx
+++ b/frontend/src/layouts/KmsLayout/KmsLayout.tsx
@@ -40,14 +40,16 @@ export const KmsLayout = () => {
>
{({ isActive }) => <MenuItem isSelected={isActive}>KMIP</MenuItem>}
</Link>
- <Link
- to="/projects/$projectId/cert-manager/settings"
- params={{
- projectId: currentWorkspace.id
- }}
- >
- {({ isActive }) => <MenuItem isSelected={isActive}>Settings</MenuItem>}
- </Link>
+ {
+ // <Link
+ // to="/projects/$projectId/kms/settings"
+ // params={{
+ // projectId: currentWorkspace.id
+ // }}
+ // >
+ // {({ isActive }) => <MenuItem isSelected={isActive}>Settings</MenuItem>}
+ // </Link>
+ }
</Menu>
</div>
</nav>
diff --git a/frontend/src/layouts/PkiManagerLayout/PkiManagerLayout.tsx b/frontend/src/layouts/PkiManagerLayout/PkiManagerLayout.tsx
index e1be17a350..3bc061abbe 100644
--- a/frontend/src/layouts/PkiManagerLayout/PkiManagerLayout.tsx
+++ b/frontend/src/layouts/PkiManagerLayout/PkiManagerLayout.tsx
@@ -73,14 +73,16 @@ export const PkiManagerLayout = () => {
>
{({ isActive }) => <MenuItem isSelected={isActive}>Alerting</MenuItem>}
</Link>
- <Link
- to="/projects/$projectId/cert-manager/settings"
- params={{
- projectId: currentWorkspace.id
- }}
- >
- {({ isActive }) => <MenuItem isSelected={isActive}>Settings</MenuItem>}
- </Link>
+ {
+ // <Link
+ // to="/projects/$projectId/cert-manager/settings"
+ // params={{
+ // projectId: currentWorkspace.id
+ // }}
+ // >
+ // {({ isActive }) => <MenuItem isSelected={isActive}>Settings</MenuItem>}
+ // </Link>
+ }
</Menu>
</div>
</nav>
diff --git a/frontend/src/layouts/ProjectGeneralLayout/ProjectGeneralLayout.tsx b/frontend/src/layouts/ProjectGeneralLayout/ProjectGeneralLayout.tsx
index c248d7ff39..e61aef8b71 100644
--- a/frontend/src/layouts/ProjectGeneralLayout/ProjectGeneralLayout.tsx
+++ b/frontend/src/layouts/ProjectGeneralLayout/ProjectGeneralLayout.tsx
@@ -20,7 +20,7 @@ export const ProjectGeneralLayout = () => {
>
<nav className="items-between flex h-full flex-col overflow-y-auto dark:[color-scheme:dark]">
<div className="border-b border-mineshaft-600 px-4 pb-2 pt-3 text-lg text-white">
- Project General
+ Project Overview
</div>
<div className="mt-2 flex-grow">
<Menu>
diff --git a/frontend/src/layouts/SecretManagerLayout/SecretManagerLayout.tsx b/frontend/src/layouts/SecretManagerLayout/SecretManagerLayout.tsx
index 1e18e9a4b9..faa3f998a7 100644
--- a/frontend/src/layouts/SecretManagerLayout/SecretManagerLayout.tsx
+++ b/frontend/src/layouts/SecretManagerLayout/SecretManagerLayout.tsx
@@ -51,7 +51,7 @@ export const SecretManagerLayout = () => {
>
<nav className="items-between flex h-full flex-col overflow-y-auto dark:[color-scheme:dark]">
<div className="border-b border-mineshaft-600 px-4 pb-2 pt-3 text-lg text-white">
- Project Overview
+ Secret Manager
</div>
<div className="mt-2 flex-grow">
<Menu>
@@ -110,9 +110,7 @@ export const SecretManagerLayout = () => {
projectId: currentWorkspace.id
}}
>
- {({ isActive }) => (
- <MenuItem isSelected={isActive}>{t("nav.menu.project-settings")}</MenuItem>
- )}
+ {({ isActive }) => <MenuItem isSelected={isActive}>Settings</MenuItem>}
</Link>
</Menu>
</div>
diff --git a/frontend/src/layouts/SecretScanningLayout/SecretScanningLayout.tsx b/frontend/src/layouts/SecretScanningLayout/SecretScanningLayout.tsx
index c948d50915..754f96f1a3 100644
--- a/frontend/src/layouts/SecretScanningLayout/SecretScanningLayout.tsx
+++ b/frontend/src/layouts/SecretScanningLayout/SecretScanningLayout.tsx
@@ -41,7 +41,7 @@ export const SecretScanningLayout = () => {
{({ isActive }) => <MenuItem isSelected={isActive}>Findings</MenuItem>}
</Link>
<Link
- to="/projects/$projectId/cert-manager/settings"
+ to="/projects/$projectId/secret-scanning/settings"
params={{
projectId: currentWorkspace.id
}}
diff --git a/frontend/src/layouts/SshLayout/SshLayout.tsx b/frontend/src/layouts/SshLayout/SshLayout.tsx
index 124af7519d..70a63b0577 100644
--- a/frontend/src/layouts/SshLayout/SshLayout.tsx
+++ b/frontend/src/layouts/SshLayout/SshLayout.tsx
@@ -46,40 +46,14 @@ export const SshLayout = () => {
}}
>
{({ isActive }) => (
- <MenuItem isSelected={isActive}> Certificate Templates</MenuItem>
+ <MenuItem isSelected={isActive}> Certificate Authorities</MenuItem>
)}
</Link>
)
}
</ProjectPermissionCan>
<Link
- to="/projects/$projectId/cert-manager/certificates"
- params={{
- projectId: currentWorkspace.id
- }}
- >
- {({ isActive }) => <MenuItem isSelected={isActive}> Certificates</MenuItem>}
- </Link>
- <Link
- to="/projects/$projectId/cert-manager/certificate-authorities"
- params={{
- projectId: currentWorkspace.id
- }}
- >
- {({ isActive }) => (
- <MenuItem isSelected={isActive}> Certificates Authorities</MenuItem>
- )}
- </Link>
- <Link
- to="/projects/$projectId/cert-manager/alerting"
- params={{
- projectId: currentWorkspace.id
- }}
- >
- {({ isActive }) => <MenuItem isSelected={isActive}>Alerting</MenuItem>}
- </Link>
- <Link
- to="/projects/$projectId/cert-manager/settings"
+ to="/projects/$projectId/ssh/settings"
params={{
projectId: currentWorkspace.id
}}
diff --git a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/route.tsx b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/route.tsx
index 10620b3252..8a374589ea 100644
--- a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/route.tsx
+++ b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/route.tsx
@@ -18,6 +18,9 @@ export const Route = createFileRoute(
projectId: params.projectId
}
})
+ },
+ {
+ label: params.caName
}
]
};
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/route.tsx b/frontend/src/pages/cert-manager/CertificatesPage/route.tsx
index 1a9a29da02..7039f8770c 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/route.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/route.tsx
@@ -5,5 +5,15 @@ import { CertificatesPage } from "./CertificatesPage";
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/projects/$projectId/_project-layout/cert-manager/_cert-manager-layout/certificates"
)({
- component: CertificatesPage
+ component: CertificatesPage,
+ beforeLoad: ({ context }) => {
+ return {
+ breadcrumbs: [
+ ...context.breadcrumbs,
+ {
+ label: "Certificates"
+ }
+ ]
+ };
+ }
});
diff --git a/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/routes.tsx b/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/routes.tsx
index af8f27602b..ac29245e02 100644
--- a/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/routes.tsx
+++ b/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/routes.tsx
@@ -18,6 +18,9 @@ export const Route = createFileRoute(
projectId: params.projectId
}
})
+ },
+ {
+ label: "Details"
}
]
};
diff --git a/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/route.tsx b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/route.tsx
index dbec32faa9..e9b0c7e7a1 100644
--- a/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/route.tsx
+++ b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/route.tsx
@@ -18,6 +18,9 @@ export const Route = createFileRoute(
projectId: params.projectId
}
})
+ },
+ {
+ label: params.subscriberName
}
]
};
diff --git a/frontend/src/pages/cert-manager/PkiSubscribersPage/route.tsx b/frontend/src/pages/cert-manager/PkiSubscribersPage/route.tsx
index 7b57a80c39..58f9066869 100644
--- a/frontend/src/pages/cert-manager/PkiSubscribersPage/route.tsx
+++ b/frontend/src/pages/cert-manager/PkiSubscribersPage/route.tsx
@@ -5,5 +5,15 @@ import { PkiSubscribersPage } from "./PkiSubscribersPage";
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/projects/$projectId/_project-layout/cert-manager/_cert-manager-layout/subscribers/"
)({
- component: PkiSubscribersPage
+ component: PkiSubscribersPage,
+ beforeLoad: ({ context }) => {
+ return {
+ breadcrumbs: [
+ ...context.breadcrumbs,
+ {
+ label: "Subscribers"
+ }
+ ]
+ };
+ }
});
diff --git a/frontend/src/pages/cert-manager/PkiTemplateListPage/route.tsx b/frontend/src/pages/cert-manager/PkiTemplateListPage/route.tsx
index 84e24041b3..bc0fb5e047 100644
--- a/frontend/src/pages/cert-manager/PkiTemplateListPage/route.tsx
+++ b/frontend/src/pages/cert-manager/PkiTemplateListPage/route.tsx
@@ -5,5 +5,15 @@ import { PkiTemplateListPage } from "./PkiTemplateListPage";
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/projects/$projectId/_project-layout/cert-manager/_cert-manager-layout/certificate-templates/"
)({
- component: PkiTemplateListPage
+ component: PkiTemplateListPage,
+ beforeLoad: ({ context }) => {
+ return {
+ breadcrumbs: [
+ ...context.breadcrumbs,
+ {
+ label: "Certificate Templates"
+ }
+ ]
+ };
+ }
});
diff --git a/frontend/src/pages/cert-manager/SettingsPage/SettingsPage.tsx b/frontend/src/pages/cert-manager/SettingsPage/SettingsPage.tsx
index dce31f01be..6c42e66dc3 100644
--- a/frontend/src/pages/cert-manager/SettingsPage/SettingsPage.tsx
+++ b/frontend/src/pages/cert-manager/SettingsPage/SettingsPage.tsx
@@ -3,9 +3,13 @@ import { useTranslation } from "react-i18next";
import { PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
-import { ProjectGeneralTab } from "./components/ProjectGeneralTab";
-
-const tabs = [{ name: "General", key: "tab-project-general", Component: ProjectGeneralTab }];
+const tabs = [
+ {
+ name: "General",
+ key: "tab-project-general",
+ Component: () => <div className="text-white">Coming soon</div>
+ }
+];
export const SettingsPage = () => {
const { t } = useTranslation();
diff --git a/frontend/src/pages/cert-manager/layout.tsx b/frontend/src/pages/cert-manager/layout.tsx
index 76b1539ff7..48f3a88b3d 100644
--- a/frontend/src/pages/cert-manager/layout.tsx
+++ b/frontend/src/pages/cert-manager/layout.tsx
@@ -5,10 +5,5 @@ import { PkiManagerLayout } from "@app/layouts/PkiManagerLayout";
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/projects/$projectId/_project-layout/cert-manager/_cert-manager-layout"
)({
- component: PkiManagerLayout,
- beforeLoad: async () => {
- return {
- breadcrumbs: []
- };
- }
+ component: PkiManagerLayout
});
diff --git a/frontend/src/pages/kms/KmipPage/route.tsx b/frontend/src/pages/kms/KmipPage/route.tsx
index 111356c299..520cae1166 100644
--- a/frontend/src/pages/kms/KmipPage/route.tsx
+++ b/frontend/src/pages/kms/KmipPage/route.tsx
@@ -5,5 +5,15 @@ import { KmipPage } from "./KmipPage";
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/projects/$projectId/_project-layout/kms/_kms-layout/kmip"
)({
- component: KmipPage
+ component: KmipPage,
+ beforeLoad: ({ context }) => {
+ return {
+ breadcrumbs: [
+ ...context.breadcrumbs,
+ {
+ label: "KMIP"
+ }
+ ]
+ };
+ }
});
diff --git a/frontend/src/pages/kms/OverviewPage/route.tsx b/frontend/src/pages/kms/OverviewPage/route.tsx
index 79a27f6682..b758782d71 100644
--- a/frontend/src/pages/kms/OverviewPage/route.tsx
+++ b/frontend/src/pages/kms/OverviewPage/route.tsx
@@ -5,5 +5,15 @@ import { OverviewPage } from "./OverviewPage";
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/projects/$projectId/_project-layout/kms/_kms-layout/overview"
)({
- component: OverviewPage
+ component: OverviewPage,
+ beforeLoad: ({ context }) => {
+ return {
+ breadcrumbs: [
+ ...context.breadcrumbs,
+ {
+ label: "Overview"
+ }
+ ]
+ };
+ }
});
diff --git a/frontend/src/pages/kms/SettingsPage/SettingsPage.tsx b/frontend/src/pages/kms/SettingsPage/SettingsPage.tsx
index dce31f01be..36249644a8 100644
--- a/frontend/src/pages/kms/SettingsPage/SettingsPage.tsx
+++ b/frontend/src/pages/kms/SettingsPage/SettingsPage.tsx
@@ -3,9 +3,13 @@ import { useTranslation } from "react-i18next";
import { PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
-import { ProjectGeneralTab } from "./components/ProjectGeneralTab";
-
-const tabs = [{ name: "General", key: "tab-project-general", Component: ProjectGeneralTab }];
+const tabs = [
+ {
+ name: "General",
+ key: "tab-project-general",
+ Component: () => <div className="text-white">Coming soon...</div>
+ }
+];
export const SettingsPage = () => {
const { t } = useTranslation();
diff --git a/frontend/src/pages/kms/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx b/frontend/src/pages/kms/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx
deleted file mode 100644
index 7c65b18573..0000000000
--- a/frontend/src/pages/kms/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx
+++ /dev/null
@@ -1,129 +0,0 @@
-import { Controller, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
-import { createNotification } from "@app/components/notifications";
-import { Button, FormControl, Input } from "@app/components/v2";
-import { useProjectPermission, useSubscription, useWorkspace } from "@app/context";
-import { usePopUp } from "@app/hooks";
-import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
-import { useUpdateWorkspaceAuditLogsRetention } from "@app/hooks/api/workspace/queries";
-
-const formSchema = z.object({
- auditLogsRetentionDays: z.coerce.number().min(0)
-});
-
-type TForm = z.infer<typeof formSchema>;
-
-export const AuditLogsRetentionSection = () => {
- const { mutateAsync: updateAuditLogsRetention } = useUpdateWorkspaceAuditLogsRetention();
-
- const { currentWorkspace } = useWorkspace();
- const { membership } = useProjectPermission();
- const { subscription } = useSubscription();
- const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["upgradePlan"] as const);
-
- const {
- control,
- formState: { isSubmitting, isDirty },
- handleSubmit
- } = useForm<TForm>({
- resolver: zodResolver(formSchema),
- values: {
- auditLogsRetentionDays:
- currentWorkspace?.auditLogsRetentionDays ?? subscription?.auditLogsRetentionDays ?? 0
- }
- });
-
- if (!currentWorkspace) return null;
-
- const handleAuditLogsRetentionSubmit = async ({ auditLogsRetentionDays }: TForm) => {
- try {
- if (!subscription?.auditLogs) {
- handlePopUpOpen("upgradePlan", {
- description: "You can only configure audit logs retention if you upgrade your plan."
- });
-
- return;
- }
-
- if (subscription && auditLogsRetentionDays > subscription?.auditLogsRetentionDays) {
- handlePopUpOpen("upgradePlan", {
- description:
- "To update your audit logs retention period to a higher value, upgrade your plan."
- });
-
- return;
- }
-
- await updateAuditLogsRetention({
- auditLogsRetentionDays,
- projectSlug: currentWorkspace.slug
- });
-
- createNotification({
- text: "Successfully updated audit logs retention period",
- type: "success"
- });
- } catch {
- createNotification({
- text: "Failed updating audit logs retention period",
- type: "error"
- });
- }
- };
-
- // render only for dedicated/self-hosted instances of Infisical
- if (
- window.location.origin.includes("https://app.infisical.com") ||
- window.location.origin.includes("https://gamma.infisical.com")
- ) {
- return null;
- }
-
- const isAdmin = membership.roles.includes(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-semibold">Audit Logs Retention</p>
- </div>
- <p className="mb-4 mt-2 max-w-2xl text-sm text-gray-400">
- Set the number of days to keep your project audit logs.
- </p>
- <form onSubmit={handleSubmit(handleAuditLogsRetentionSubmit)} autoComplete="off">
- <div className="max-w-xs">
- <Controller
- control={control}
- defaultValue={0}
- name="auditLogsRetentionDays"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Number of days"
- >
- <Input {...field} type="number" min={1} step={1} isDisabled={!isAdmin} />
- </FormControl>
- )}
- />
- </div>
- <Button
- colorSchema="secondary"
- type="submit"
- isLoading={isSubmitting}
- disabled={!isAdmin || !isDirty}
- >
- Save
- </Button>
- </form>
- </div>
- <UpgradePlanModal
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={(popUp.upgradePlan?.data as { description: string })?.description}
- />
- </>
- );
-};
diff --git a/frontend/src/pages/kms/SettingsPage/components/AuditLogsRetentionSection/index.tsx b/frontend/src/pages/kms/SettingsPage/components/AuditLogsRetentionSection/index.tsx
deleted file mode 100644
index 38a07f53b1..0000000000
--- a/frontend/src/pages/kms/SettingsPage/components/AuditLogsRetentionSection/index.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { AuditLogsRetentionSection } from "./AuditLogsRetentionSection";
diff --git a/frontend/src/pages/kms/SettingsPage/components/DeleteProjectSection/DeleteProjectSection.tsx b/frontend/src/pages/kms/SettingsPage/components/DeleteProjectSection/DeleteProjectSection.tsx
deleted file mode 100644
index 21ed0dec89..0000000000
--- a/frontend/src/pages/kms/SettingsPage/components/DeleteProjectSection/DeleteProjectSection.tsx
+++ /dev/null
@@ -1,184 +0,0 @@
-import { useMemo } from "react";
-import { useNavigate } from "@tanstack/react-router";
-
-import { createNotification } from "@app/components/notifications";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import { Button, DeleteActionModal } from "@app/components/v2";
-import { LeaveProjectModal } from "@app/components/v2/LeaveProjectModal";
-import {
- ProjectPermissionActions,
- ProjectPermissionSub,
- useOrganization,
- useProjectPermission,
- useWorkspace
-} from "@app/context";
-import { useToggle } from "@app/hooks";
-import { useDeleteWorkspace, useGetWorkspaceUsers, useLeaveProject } from "@app/hooks/api";
-import { ProjectType } from "@app/hooks/api/workspace/types";
-import { usePopUp } from "@app/hooks/usePopUp";
-
-export const DeleteProjectSection = () => {
- const navigate = useNavigate();
-
- const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
- "deleteWorkspace",
- "leaveWorkspace"
- ] as const);
-
- const { currentOrg } = useOrganization();
- const { hasProjectRole, membership } = useProjectPermission();
- const { currentWorkspace } = useWorkspace();
- const [isDeleting, setIsDeleting] = useToggle();
- const [isLeaving, setIsLeaving] = useToggle();
- const deleteWorkspace = useDeleteWorkspace();
- const leaveProject = useLeaveProject();
- const { data: members, isPending: isMembersLoading } = useGetWorkspaceUsers(
- currentWorkspace?.id || ""
- );
-
- // If isNoAccessMember is true, then the user can't read the workspace members. So we need to handle this case separately.
- const isNoAccessMember = hasProjectRole("no-access");
-
- const isOnlyAdminMember = useMemo(() => {
- if (!members || !membership || !hasProjectRole("admin")) return false;
-
- const adminMembers = members.filter(
- (member) => member.roles.map((r) => r.role).includes("admin") && member.id !== membership.id // exclude the current user
- );
-
- return !adminMembers.length;
- }, [members, membership]);
-
- const handleDeleteWorkspaceSubmit = async () => {
- setIsDeleting.on();
- try {
- if (!currentWorkspace?.id) return;
-
- await deleteWorkspace.mutateAsync({
- workspaceID: currentWorkspace?.id
- });
-
- createNotification({
- text: "Successfully deleted project",
- type: "success"
- });
-
- navigate({
- to: "/organization/projects"
- });
- handlePopUpClose("deleteWorkspace");
- } catch (err) {
- console.error(err);
- createNotification({
- text: "Failed to delete project",
- type: "error"
- });
- } finally {
- setIsDeleting.off();
- }
- };
-
- const handleLeaveWorkspaceSubmit = async () => {
- try {
- setIsLeaving.on();
-
- if (!currentWorkspace?.id || !currentOrg?.id) return;
-
- // If there's no members, and the user has access to read members, something went wrong.
- if (!members && !isNoAccessMember) return;
-
- // If the user has elevated permissions and can read members:
- if (!isNoAccessMember) {
- if (!members) return;
-
- if (members.length < 2) {
- createNotification({
- text: "You can't leave the project as you are the only member",
- type: "error"
- });
- return;
- }
- // If the user has access to read members, and there's less than 1 admin member excluding the current user, they can't leave the project.
- if (isOnlyAdminMember) {
- createNotification({
- text: "You can't leave a project with no admin members left. Promote another member to admin first.",
- type: "error"
- });
- return;
- }
- }
-
- // If it's actually a no-access member, then we don't really care about the members.
-
- await leaveProject.mutateAsync({
- workspaceId: currentWorkspace.id
- });
-
- navigate({
- to: `/organization/${ProjectType.SecretManager}/overview` as const
- });
- } catch (err) {
- console.error(err);
- createNotification({
- text: "Failed to leave project",
- type: "error"
- });
- } finally {
- setIsLeaving.off();
- }
- };
-
- return (
- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <p className="mb-4 text-xl font-semibold text-mineshaft-100">Danger Zone</p>
- <div className="space-x-4">
- <ProjectPermissionCan I={ProjectPermissionActions.Delete} a={ProjectPermissionSub.Project}>
- {(isAllowed) => (
- <Button
- isLoading={isDeleting}
- isDisabled={!isAllowed || isDeleting}
- colorSchema="danger"
- variant="outline_bg"
- type="submit"
- onClick={() => handlePopUpOpen("deleteWorkspace")}
- >
- {`Delete ${currentWorkspace?.name}`}
- </Button>
- )}
- </ProjectPermissionCan>
- {!isOnlyAdminMember && (
- <Button
- disabled={isMembersLoading || (members && members?.length < 2)}
- isLoading={isLeaving}
- colorSchema="danger"
- variant="outline_bg"
- type="submit"
- onClick={() => handlePopUpOpen("leaveWorkspace")}
- >
- {`Leave ${currentWorkspace?.name}`}
- </Button>
- )}
- </div>
-
- <DeleteActionModal
- isOpen={popUp.deleteWorkspace.isOpen}
- title="Are you sure you want to delete this project?"
- subTitle={`Permanently delete ${currentWorkspace?.name} and all of its data. This action is not reversible, so please be careful.`}
- onChange={(isOpen) => handlePopUpToggle("deleteWorkspace", isOpen)}
- deleteKey="confirm"
- buttonText="Delete Project"
- onDeleteApproved={handleDeleteWorkspaceSubmit}
- />
-
- <LeaveProjectModal
- isOpen={popUp.leaveWorkspace.isOpen}
- title="Are you sure you want to leave this project?"
- subTitle={`If you leave ${currentWorkspace?.name} you will lose access to the project and its contents.`}
- onChange={(isOpen) => handlePopUpToggle("leaveWorkspace", isOpen)}
- deleteKey="confirm"
- buttonText="Leave Project"
- onLeaveApproved={handleLeaveWorkspaceSubmit}
- />
- </div>
- );
-};
diff --git a/frontend/src/pages/kms/SettingsPage/components/DeleteProjectSection/index.tsx b/frontend/src/pages/kms/SettingsPage/components/DeleteProjectSection/index.tsx
deleted file mode 100644
index 04a624ec2f..0000000000
--- a/frontend/src/pages/kms/SettingsPage/components/DeleteProjectSection/index.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { DeleteProjectSection } from "./DeleteProjectSection";
diff --git a/frontend/src/pages/kms/SettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx b/frontend/src/pages/kms/SettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx
deleted file mode 100644
index 41e8107e09..0000000000
--- a/frontend/src/pages/kms/SettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import { ProjectOverviewChangeSection } from "@app/components/project/ProjectOverviewChangeSection";
-
-import { AuditLogsRetentionSection } from "../AuditLogsRetentionSection";
-import { DeleteProjectSection } from "../DeleteProjectSection";
-
-export const ProjectGeneralTab = () => {
- return (
- <div>
- <ProjectOverviewChangeSection showSlugField />
- <AuditLogsRetentionSection />
- <DeleteProjectSection />
- </div>
- );
-};
diff --git a/frontend/src/pages/kms/SettingsPage/components/ProjectGeneralTab/index.tsx b/frontend/src/pages/kms/SettingsPage/components/ProjectGeneralTab/index.tsx
deleted file mode 100644
index c6e611e0ff..0000000000
--- a/frontend/src/pages/kms/SettingsPage/components/ProjectGeneralTab/index.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { ProjectGeneralTab } from "./ProjectGeneralTab";
diff --git a/frontend/src/pages/kms/SettingsPage/components/index.tsx b/frontend/src/pages/kms/SettingsPage/components/index.tsx
deleted file mode 100644
index 04a624ec2f..0000000000
--- a/frontend/src/pages/kms/SettingsPage/components/index.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { DeleteProjectSection } from "./DeleteProjectSection";
diff --git a/frontend/src/pages/kms/layout.tsx b/frontend/src/pages/kms/layout.tsx
index 7a480d0f9d..48cdca4af2 100644
--- a/frontend/src/pages/kms/layout.tsx
+++ b/frontend/src/pages/kms/layout.tsx
@@ -5,10 +5,5 @@ import { KmsLayout } from "@app/layouts/KmsLayout";
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/projects/$projectId/_project-layout/kms/_kms-layout"
)({
- component: KmsLayout,
- beforeLoad: async () => {
- return {
- breadcrumbs: []
- };
- }
+ component: KmsLayout
});
diff --git a/frontend/src/pages/project/AccessControlPage/route.tsx b/frontend/src/pages/project/AccessControlPage/route.tsx
index 716fee791d..4b51fdecb9 100644
--- a/frontend/src/pages/project/AccessControlPage/route.tsx
+++ b/frontend/src/pages/project/AccessControlPage/route.tsx
@@ -21,7 +21,12 @@ export const Route = createFileRoute(
},
beforeLoad: ({ context }) => {
return {
- breadcrumbs: []
+ breadcrumbs: [
+ ...context.breadcrumbs,
+ {
+ label: "Access Control"
+ }
+ ]
};
}
});
diff --git a/frontend/src/pages/project/GroupDetailsByIDPage/route.tsx b/frontend/src/pages/project/GroupDetailsByIDPage/route.tsx
index aac99921c5..7baccb6e37 100644
--- a/frontend/src/pages/project/GroupDetailsByIDPage/route.tsx
+++ b/frontend/src/pages/project/GroupDetailsByIDPage/route.tsx
@@ -1,4 +1,4 @@
-import { createFileRoute } from "@tanstack/react-router";
+import { createFileRoute, linkOptions } from "@tanstack/react-router";
import { GroupDetailsByIDPage } from "./GroupDetailsByIDPage";
@@ -6,9 +6,23 @@ export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/projects/$projectId/_project-layout/_project-general-layout/groups/$groupId"
)({
component: GroupDetailsByIDPage,
- beforeLoad: ({ context }) => {
+ beforeLoad: ({ context, params }) => {
return {
- breadcrumbs: []
+ breadcrumbs: [
+ ...context.breadcrumbs,
+ {
+ label: "Access Control",
+ link: linkOptions({
+ to: "/projects/$projectId/access-management",
+ params: {
+ projectId: params.projectId
+ }
+ })
+ },
+ {
+ label: "Group"
+ }
+ ]
};
}
});
diff --git a/frontend/src/pages/project/IdentityDetailsByIDPage/route.tsx b/frontend/src/pages/project/IdentityDetailsByIDPage/route.tsx
index 672b11c0c3..5cfe3da7b9 100644
--- a/frontend/src/pages/project/IdentityDetailsByIDPage/route.tsx
+++ b/frontend/src/pages/project/IdentityDetailsByIDPage/route.tsx
@@ -1,4 +1,4 @@
-import { createFileRoute } from "@tanstack/react-router";
+import { createFileRoute, linkOptions } from "@tanstack/react-router";
import { IdentityDetailsByIDPage } from "./IdentityDetailsByIDPage";
@@ -6,9 +6,23 @@ export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/projects/$projectId/_project-layout/_project-general-layout/identities/$identityId"
)({
component: IdentityDetailsByIDPage,
- beforeLoad: ({ context }) => {
+ beforeLoad: ({ context, params }) => {
return {
- breadcrumbs: []
+ breadcrumbs: [
+ ...context.breadcrumbs,
+ {
+ label: "Access Control",
+ link: linkOptions({
+ to: "/projects/$projectId/access-management",
+ params: {
+ projectId: params.projectId
+ }
+ })
+ },
+ {
+ label: "Machine Identity"
+ }
+ ]
};
}
});
diff --git a/frontend/src/pages/project/MemberDetailsByIDPage/route.tsx b/frontend/src/pages/project/MemberDetailsByIDPage/route.tsx
index 007abbe8ff..c55a8fa1ee 100644
--- a/frontend/src/pages/project/MemberDetailsByIDPage/route.tsx
+++ b/frontend/src/pages/project/MemberDetailsByIDPage/route.tsx
@@ -1,4 +1,4 @@
-import { createFileRoute } from "@tanstack/react-router";
+import { createFileRoute, linkOptions } from "@tanstack/react-router";
import { MemberDetailsByIDPage } from "./MemberDetailsByIDPage";
@@ -6,9 +6,23 @@ export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/projects/$projectId/_project-layout/_project-general-layout/members/$membershipId"
)({
component: MemberDetailsByIDPage,
- beforeLoad: ({ context }) => {
+ beforeLoad: ({ context, params }) => {
return {
- breadcrumbs: []
+ breadcrumbs: [
+ ...context.breadcrumbs,
+ {
+ label: "Access Control",
+ link: linkOptions({
+ to: "/projects/$projectId/access-management",
+ params: {
+ projectId: params.projectId
+ }
+ })
+ },
+ {
+ label: "User"
+ }
+ ]
};
}
});
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/route.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/route.tsx
index 55b14de600..f5808b97cb 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/route.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/route.tsx
@@ -1,4 +1,4 @@
-import { createFileRoute } from "@tanstack/react-router";
+import { createFileRoute, linkOptions } from "@tanstack/react-router";
import { RoleDetailsBySlugPage } from "./RoleDetailsBySlugPage";
@@ -6,9 +6,23 @@ export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/projects/$projectId/_project-layout/_project-general-layout/roles/$roleSlug"
)({
component: RoleDetailsBySlugPage,
- beforeLoad: ({}) => {
+ beforeLoad: ({ context, params }) => {
return {
- breadcrumbs: []
+ breadcrumbs: [
+ ...context.breadcrumbs,
+ {
+ label: "Access Control",
+ link: linkOptions({
+ to: "/projects/$projectId/access-management",
+ params: {
+ projectId: params.projectId
+ }
+ })
+ },
+ {
+ label: "Roles"
+ }
+ ]
};
}
});
diff --git a/frontend/src/pages/project/SettingsPage/SettingsPage.tsx b/frontend/src/pages/project/SettingsPage/SettingsPage.tsx
index 8fb51763a9..dce31f01be 100644
--- a/frontend/src/pages/project/SettingsPage/SettingsPage.tsx
+++ b/frontend/src/pages/project/SettingsPage/SettingsPage.tsx
@@ -1,3 +1,37 @@
+import { Helmet } from "react-helmet";
+import { useTranslation } from "react-i18next";
+
+import { PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
+
+import { ProjectGeneralTab } from "./components/ProjectGeneralTab";
+
+const tabs = [{ name: "General", key: "tab-project-general", Component: ProjectGeneralTab }];
+
export const SettingsPage = () => {
- return <div>Settings</div>;
+ const { t } = useTranslation();
+
+ return (
+ <div className="flex h-full w-full justify-center bg-bunker-800 text-white">
+ <Helmet>
+ <title>{t("common.head-title", { title: t("settings.project.title") })}</title>
+ </Helmet>
+ <div className="w-full max-w-7xl">
+ <PageHeader title={t("settings.project.title")} />
+ <Tabs defaultValue={tabs[0].key}>
+ <TabList>
+ {tabs.map((tab) => (
+ <Tab value={tab.key} key={tab.key}>
+ {tab.name}
+ </Tab>
+ ))}
+ </TabList>
+ {tabs.map(({ key, Component }) => (
+ <TabPanel value={key} key={key}>
+ <Component />
+ </TabPanel>
+ ))}
+ </Tabs>
+ </div>
+ </div>
+ );
};
diff --git a/frontend/src/pages/cert-manager/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx b/frontend/src/pages/project/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx
similarity index 100%
rename from frontend/src/pages/cert-manager/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx
rename to frontend/src/pages/project/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx
diff --git a/frontend/src/pages/cert-manager/SettingsPage/components/AuditLogsRetentionSection/index.tsx b/frontend/src/pages/project/SettingsPage/components/AuditLogsRetentionSection/index.tsx
similarity index 100%
rename from frontend/src/pages/cert-manager/SettingsPage/components/AuditLogsRetentionSection/index.tsx
rename to frontend/src/pages/project/SettingsPage/components/AuditLogsRetentionSection/index.tsx
diff --git a/frontend/src/pages/cert-manager/SettingsPage/components/DeleteProjectSection/DeleteProjectSection.tsx b/frontend/src/pages/project/SettingsPage/components/DeleteProjectSection/DeleteProjectSection.tsx
similarity index 100%
rename from frontend/src/pages/cert-manager/SettingsPage/components/DeleteProjectSection/DeleteProjectSection.tsx
rename to frontend/src/pages/project/SettingsPage/components/DeleteProjectSection/DeleteProjectSection.tsx
diff --git a/frontend/src/pages/cert-manager/SettingsPage/components/DeleteProjectSection/index.tsx b/frontend/src/pages/project/SettingsPage/components/DeleteProjectSection/index.tsx
similarity index 100%
rename from frontend/src/pages/cert-manager/SettingsPage/components/DeleteProjectSection/index.tsx
rename to frontend/src/pages/project/SettingsPage/components/DeleteProjectSection/index.tsx
diff --git a/frontend/src/pages/cert-manager/SettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx b/frontend/src/pages/project/SettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx
similarity index 100%
rename from frontend/src/pages/cert-manager/SettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx
rename to frontend/src/pages/project/SettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx
diff --git a/frontend/src/pages/cert-manager/SettingsPage/components/ProjectGeneralTab/index.tsx b/frontend/src/pages/project/SettingsPage/components/ProjectGeneralTab/index.tsx
similarity index 100%
rename from frontend/src/pages/cert-manager/SettingsPage/components/ProjectGeneralTab/index.tsx
rename to frontend/src/pages/project/SettingsPage/components/ProjectGeneralTab/index.tsx
diff --git a/frontend/src/pages/cert-manager/SettingsPage/components/index.tsx b/frontend/src/pages/project/SettingsPage/components/index.tsx
similarity index 100%
rename from frontend/src/pages/cert-manager/SettingsPage/components/index.tsx
rename to frontend/src/pages/project/SettingsPage/components/index.tsx
diff --git a/frontend/src/pages/project/SettingsPage/route.tsx b/frontend/src/pages/project/SettingsPage/route.tsx
index 13058630a5..d245793ddf 100644
--- a/frontend/src/pages/project/SettingsPage/route.tsx
+++ b/frontend/src/pages/project/SettingsPage/route.tsx
@@ -1,25 +1,19 @@
-import { createFileRoute } from "@tanstack/react-router";
+import { createFileRoute } from '@tanstack/react-router'
-import { SettingsPage } from "./SettingsPage";
+import { SettingsPage } from './SettingsPage'
export const Route = createFileRoute(
- "/_authenticate/_inject-org-details/_org-layout/projects/$projectId/_project-layout/_project-general-layout/settings"
+ '/_authenticate/_inject-org-details/_org-layout/projects/$projectId/_project-layout/_project-general-layout/settings',
)({
component: SettingsPage,
- beforeLoad: ({ context, params }) => {
+ beforeLoad: ({ context }) => {
return {
breadcrumbs: [
- ...context.breadcrumbs
- // {
- // label: "Access Control",
- // link: linkOptions({
- // to: "/ssh/$projectId/access-management",
- // params: {
- // projectId: params.projectId
- // }
- // })
- // }
- ]
- };
- }
-});
+ ...context.breadcrumbs,
+ {
+ label: 'Settings',
+ },
+ ],
+ }
+ },
+})
diff --git a/frontend/src/pages/secret-manager/OverviewPage/route.tsx b/frontend/src/pages/secret-manager/OverviewPage/route.tsx
index 4da8de4515..66b57d547e 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/route.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/route.tsx
@@ -1,4 +1,4 @@
-import { createFileRoute, stripSearchParams } from "@tanstack/react-router";
+import { createFileRoute, linkOptions, stripSearchParams } from "@tanstack/react-router";
import { zodValidator } from "@tanstack/zod-adapter";
import { z } from "zod";
@@ -16,5 +16,18 @@ export const Route = createFileRoute(
validateSearch: zodValidator(SecretOverviewPageQuerySchema),
search: {
middlewares: [stripSearchParams({ secretPath: "/", search: "" })]
- }
+ },
+ beforeLoad: ({ context, params }) => ({
+ ...context,
+ breadcrumbs: [
+ ...context.breadcrumbs,
+ {
+ label: "Secrets",
+ link: linkOptions({
+ to: "/projects/$projectId/secret-manager/overview",
+ params
+ })
+ }
+ ]
+ })
});
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/route.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/route.tsx
index 867cda1a5a..e77120d7a6 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/route.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/route.tsx
@@ -25,6 +25,13 @@ export const Route = createFileRoute(
return {
breadcrumbs: [
...context.breadcrumbs,
+ {
+ label: "Secrets",
+ link: linkOptions({
+ to: "/projects/$projectId/secret-manager/overview",
+ params
+ })
+ },
{
type: BreadcrumbTypes.Dropdown,
label: context.project.environments.find((el) => el.slug === params.envSlug)?.name || "",
diff --git a/frontend/src/pages/secret-manager/SettingsPage/SettingsPage.tsx b/frontend/src/pages/secret-manager/SettingsPage/SettingsPage.tsx
index b2c2e406f9..2e53e956eb 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/SettingsPage.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/SettingsPage.tsx
@@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
import { PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
import { useWorkspace } from "@app/context";
-import { ProjectType, ProjectVersion } from "@app/hooks/api/workspace/types";
+import { ProjectVersion } from "@app/hooks/api/workspace/types";
import { EncryptionTab } from "./components/EncryptionTab";
import { ProjectGeneralTab } from "./components/ProjectGeneralTab";
@@ -18,22 +18,17 @@ export const SettingsPage = () => {
{
name: "Encryption",
key: "tab-project-encryption",
- isHidden:
- currentWorkspace?.version !== ProjectVersion.V3 ||
- currentWorkspace?.type !== ProjectType.SecretManager,
+ isHidden: currentWorkspace?.version !== ProjectVersion.V3,
Component: EncryptionTab
},
{
name: "Workflow Integrations",
key: "tab-workflow-integrations",
- isHidden: currentWorkspace?.type !== ProjectType.SecretManager,
Component: WorkflowIntegrationTab
},
{
name: "Webhooks",
key: "tab-project-webhooks",
- isHidden: currentWorkspace?.type !== ProjectType.SecretManager,
-
Component: WebhooksTab
}
];
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx
deleted file mode 100644
index 7c65b18573..0000000000
--- a/frontend/src/pages/secret-manager/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx
+++ /dev/null
@@ -1,129 +0,0 @@
-import { Controller, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
-import { createNotification } from "@app/components/notifications";
-import { Button, FormControl, Input } from "@app/components/v2";
-import { useProjectPermission, useSubscription, useWorkspace } from "@app/context";
-import { usePopUp } from "@app/hooks";
-import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
-import { useUpdateWorkspaceAuditLogsRetention } from "@app/hooks/api/workspace/queries";
-
-const formSchema = z.object({
- auditLogsRetentionDays: z.coerce.number().min(0)
-});
-
-type TForm = z.infer<typeof formSchema>;
-
-export const AuditLogsRetentionSection = () => {
- const { mutateAsync: updateAuditLogsRetention } = useUpdateWorkspaceAuditLogsRetention();
-
- const { currentWorkspace } = useWorkspace();
- const { membership } = useProjectPermission();
- const { subscription } = useSubscription();
- const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["upgradePlan"] as const);
-
- const {
- control,
- formState: { isSubmitting, isDirty },
- handleSubmit
- } = useForm<TForm>({
- resolver: zodResolver(formSchema),
- values: {
- auditLogsRetentionDays:
- currentWorkspace?.auditLogsRetentionDays ?? subscription?.auditLogsRetentionDays ?? 0
- }
- });
-
- if (!currentWorkspace) return null;
-
- const handleAuditLogsRetentionSubmit = async ({ auditLogsRetentionDays }: TForm) => {
- try {
- if (!subscription?.auditLogs) {
- handlePopUpOpen("upgradePlan", {
- description: "You can only configure audit logs retention if you upgrade your plan."
- });
-
- return;
- }
-
- if (subscription && auditLogsRetentionDays > subscription?.auditLogsRetentionDays) {
- handlePopUpOpen("upgradePlan", {
- description:
- "To update your audit logs retention period to a higher value, upgrade your plan."
- });
-
- return;
- }
-
- await updateAuditLogsRetention({
- auditLogsRetentionDays,
- projectSlug: currentWorkspace.slug
- });
-
- createNotification({
- text: "Successfully updated audit logs retention period",
- type: "success"
- });
- } catch {
- createNotification({
- text: "Failed updating audit logs retention period",
- type: "error"
- });
- }
- };
-
- // render only for dedicated/self-hosted instances of Infisical
- if (
- window.location.origin.includes("https://app.infisical.com") ||
- window.location.origin.includes("https://gamma.infisical.com")
- ) {
- return null;
- }
-
- const isAdmin = membership.roles.includes(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-semibold">Audit Logs Retention</p>
- </div>
- <p className="mb-4 mt-2 max-w-2xl text-sm text-gray-400">
- Set the number of days to keep your project audit logs.
- </p>
- <form onSubmit={handleSubmit(handleAuditLogsRetentionSubmit)} autoComplete="off">
- <div className="max-w-xs">
- <Controller
- control={control}
- defaultValue={0}
- name="auditLogsRetentionDays"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Number of days"
- >
- <Input {...field} type="number" min={1} step={1} isDisabled={!isAdmin} />
- </FormControl>
- )}
- />
- </div>
- <Button
- colorSchema="secondary"
- type="submit"
- isLoading={isSubmitting}
- disabled={!isAdmin || !isDirty}
- >
- Save
- </Button>
- </form>
- </div>
- <UpgradePlanModal
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={(popUp.upgradePlan?.data as { description: string })?.description}
- />
- </>
- );
-};
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/AuditLogsRetentionSection/index.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/AuditLogsRetentionSection/index.tsx
deleted file mode 100644
index 38a07f53b1..0000000000
--- a/frontend/src/pages/secret-manager/SettingsPage/components/AuditLogsRetentionSection/index.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { AuditLogsRetentionSection } from "./AuditLogsRetentionSection";
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/DeleteProjectSection/DeleteProjectSection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/DeleteProjectSection/DeleteProjectSection.tsx
deleted file mode 100644
index 94a22fed2d..0000000000
--- a/frontend/src/pages/secret-manager/SettingsPage/components/DeleteProjectSection/DeleteProjectSection.tsx
+++ /dev/null
@@ -1,190 +0,0 @@
-import { useMemo } from "react";
-import { useNavigate } from "@tanstack/react-router";
-
-import { createNotification } from "@app/components/notifications";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import { Button, DeleteActionModal, Tooltip } from "@app/components/v2";
-import { LeaveProjectModal } from "@app/components/v2/LeaveProjectModal";
-import {
- ProjectPermissionActions,
- ProjectPermissionSub,
- useOrganization,
- useProjectPermission,
- useWorkspace
-} from "@app/context";
-import { useToggle } from "@app/hooks";
-import { useDeleteWorkspace, useGetWorkspaceUsers, useLeaveProject } from "@app/hooks/api";
-import { ProjectType } from "@app/hooks/api/workspace/types";
-import { usePopUp } from "@app/hooks/usePopUp";
-
-export const DeleteProjectSection = () => {
- const navigate = useNavigate();
-
- const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
- "deleteWorkspace",
- "leaveWorkspace"
- ] as const);
-
- const { currentOrg } = useOrganization();
- const { hasProjectRole, membership } = useProjectPermission();
- const { currentWorkspace } = useWorkspace();
- const [isDeleting, setIsDeleting] = useToggle();
- const [isLeaving, setIsLeaving] = useToggle();
- const deleteWorkspace = useDeleteWorkspace();
- const leaveProject = useLeaveProject();
- const { data: members, isPending: isMembersLoading } = useGetWorkspaceUsers(
- currentWorkspace?.id || ""
- );
-
- // If isNoAccessMember is true, then the user can't read the workspace members. So we need to handle this case separately.
- const isNoAccessMember = hasProjectRole("no-access");
-
- const isOnlyAdminMember = useMemo(() => {
- if (!members || !membership || !hasProjectRole("admin")) return false;
-
- const adminMembers = members.filter(
- (member) => member.roles.map((r) => r.role).includes("admin") && member.id !== membership.id // exclude the current user
- );
-
- return !adminMembers.length;
- }, [members, membership]);
-
- const handleDeleteWorkspaceSubmit = async () => {
- setIsDeleting.on();
- try {
- if (!currentWorkspace?.id) return;
-
- await deleteWorkspace.mutateAsync({
- workspaceID: currentWorkspace?.id
- });
-
- createNotification({
- text: "Successfully deleted project",
- type: "success"
- });
-
- navigate({
- to: `/organization/${ProjectType.SecretManager}/overview` as const
- });
- handlePopUpClose("deleteWorkspace");
- } catch (err) {
- console.error(err);
- createNotification({
- text: "Failed to delete project",
- type: "error"
- });
- } finally {
- setIsDeleting.off();
- }
- };
-
- const handleLeaveWorkspaceSubmit = async () => {
- try {
- setIsLeaving.on();
-
- if (!currentWorkspace?.id || !currentOrg?.id) return;
-
- // If there's no members, and the user has access to read members, something went wrong.
- if (!members && !isNoAccessMember) return;
-
- // If the user has elevated permissions and can read members:
- if (!isNoAccessMember) {
- if (!members) return;
-
- if (members.length < 2) {
- createNotification({
- text: "You can't leave the project as you are the only member",
- type: "error"
- });
- return;
- }
- // If the user has access to read members, and there's less than 1 admin member excluding the current user, they can't leave the project.
- if (isOnlyAdminMember) {
- createNotification({
- text: "You can't leave a project with no admin members left. Promote another member to admin first.",
- type: "error"
- });
- return;
- }
- }
-
- // If it's actually a no-access member, then we don't really care about the members.
-
- await leaveProject.mutateAsync({
- workspaceId: currentWorkspace.id
- });
-
- navigate({
- to: `/organization/${ProjectType.SecretManager}/overview` as const
- });
- } catch (err) {
- console.error(err);
- createNotification({
- text: "Failed to leave project",
- type: "error"
- });
- } finally {
- setIsLeaving.off();
- }
- };
-
- return (
- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <p className="mb-4 text-xl font-semibold text-mineshaft-100">Danger Zone</p>
- <div className="space-x-4">
- <ProjectPermissionCan I={ProjectPermissionActions.Delete} a={ProjectPermissionSub.Project}>
- {(isAllowed) => (
- <Tooltip
- className="max-w-sm"
- content="This project is protected from deletion. To delete it, disable delete protection first."
- isDisabled={!currentWorkspace?.hasDeleteProtection}
- >
- <Button
- isLoading={isDeleting}
- isDisabled={!isAllowed || isDeleting || currentWorkspace?.hasDeleteProtection}
- colorSchema="danger"
- variant="outline_bg"
- type="submit"
- onClick={() => handlePopUpOpen("deleteWorkspace")}
- >
- {`Delete ${currentWorkspace?.name}`}
- </Button>
- </Tooltip>
- )}
- </ProjectPermissionCan>
- {!isOnlyAdminMember && (
- <Button
- disabled={isMembersLoading || (members && members?.length < 2)}
- isLoading={isLeaving}
- colorSchema="danger"
- variant="outline_bg"
- type="submit"
- onClick={() => handlePopUpOpen("leaveWorkspace")}
- >
- {`Leave ${currentWorkspace?.name}`}
- </Button>
- )}
- </div>
-
- <DeleteActionModal
- isOpen={popUp.deleteWorkspace.isOpen}
- title="Are you sure you want to delete this project?"
- subTitle={`Permanently delete ${currentWorkspace?.name} and all of its data. This action is not reversible, so please be careful.`}
- onChange={(isOpen) => handlePopUpToggle("deleteWorkspace", isOpen)}
- deleteKey="confirm"
- buttonText="Delete Project"
- onDeleteApproved={handleDeleteWorkspaceSubmit}
- />
-
- <LeaveProjectModal
- isOpen={popUp.leaveWorkspace.isOpen}
- title="Are you sure you want to leave this project?"
- subTitle={`If you leave ${currentWorkspace?.name} you will lose access to the project and its contents.`}
- onChange={(isOpen) => handlePopUpToggle("leaveWorkspace", isOpen)}
- deleteKey="confirm"
- buttonText="Leave Project"
- onLeaveApproved={handleLeaveWorkspaceSubmit}
- />
- </div>
- );
-};
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/DeleteProjectSection/index.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/DeleteProjectSection/index.tsx
deleted file mode 100644
index 04a624ec2f..0000000000
--- a/frontend/src/pages/secret-manager/SettingsPage/components/DeleteProjectSection/index.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { DeleteProjectSection } from "./DeleteProjectSection";
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx
index 2843300e8f..25a996844b 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx
@@ -1,12 +1,9 @@
-import { ProjectOverviewChangeSection } from "@app/components/project/ProjectOverviewChangeSection";
import { useWorkspace } from "@app/context";
-import { ProjectType, ProjectVersion } from "@app/hooks/api/workspace/types";
+import { ProjectVersion } from "@app/hooks/api/workspace/types";
-import { AuditLogsRetentionSection } from "../AuditLogsRetentionSection";
import { AutoCapitalizationSection } from "../AutoCapitalizationSection";
import { BackfillSecretReferenceSecretion } from "../BackfillSecretReferenceSection";
import { DeleteProjectProtection } from "../DeleteProjectProtection";
-import { DeleteProjectSection } from "../DeleteProjectSection";
import { EnvironmentSection } from "../EnvironmentSection";
import { PointInTimeVersionLimitSection } from "../PointInTimeVersionLimitSection";
import { RebuildSecretIndicesSection } from "../RebuildSecretIndicesSection/RebuildSecretIndicesSection";
@@ -16,24 +13,18 @@ import { SecretTagsSection } from "../SecretTagsSection";
export const ProjectGeneralTab = () => {
const { currentWorkspace } = useWorkspace();
- const isSecretManager = currentWorkspace?.type === ProjectType.SecretManager;
return (
<div>
- <ProjectOverviewChangeSection showSlugField />
- {isSecretManager && <EnvironmentSection />}
- {isSecretManager && <SecretTagsSection />}
- {isSecretManager && <AutoCapitalizationSection />}
- {isSecretManager && <SecretSharingSection />}
- {isSecretManager && <SecretSnapshotsLegacySection />}
- {isSecretManager && <PointInTimeVersionLimitSection />}
- <AuditLogsRetentionSection />
- {isSecretManager && <BackfillSecretReferenceSecretion />}
- {currentWorkspace?.version !== ProjectVersion.V3 && isSecretManager && (
- <RebuildSecretIndicesSection />
- )}
+ <EnvironmentSection />
+ <SecretTagsSection />
+ <AutoCapitalizationSection />
+ <SecretSharingSection />
+ <SecretSnapshotsLegacySection />
+ <PointInTimeVersionLimitSection />
+ <BackfillSecretReferenceSecretion />
+ {currentWorkspace?.version !== ProjectVersion.V3 && <RebuildSecretIndicesSection />}
<DeleteProjectProtection />
- <DeleteProjectSection />
</div>
);
};
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/index.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/index.tsx
index 92bda9d3b7..4d40794f5b 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/index.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/index.tsx
@@ -1,5 +1,4 @@
export { AutoCapitalizationSection } from "./AutoCapitalizationSection";
export { BackfillSecretReferenceSecretion } from "./BackfillSecretReferenceSection";
-export { DeleteProjectSection } from "./DeleteProjectSection";
export { EnvironmentSection } from "./EnvironmentSection";
export { SecretTagsSection } from "./SecretTagsSection";
diff --git a/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/route.tsx b/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/route.tsx
index ea1ee2d041..77c61ac051 100644
--- a/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/route.tsx
+++ b/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/route.tsx
@@ -13,12 +13,12 @@ export const Route = createFileRoute(
{
label: "Data Sources",
link: linkOptions({
- to: "/secret-scanning/$projectId/data-sources",
+ to: "/projects/$projectId/secret-scanning/data-sources",
params
})
},
{
- label: "Data Source"
+ label: "Details"
}
]
};
diff --git a/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/route.tsx b/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/route.tsx
index f7f06fb788..be85dc257b 100644
--- a/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/route.tsx
+++ b/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/route.tsx
@@ -5,15 +5,15 @@ import { SecretScanningDataSourcesPage } from "./SecretScanningDataSourcesPage";
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/projects/$projectId/_project-layout/secret-scanning/_secret-scanning-layout/data-sources/"
)({
- component: SecretScanningDataSourcesPage
- // beforeLoad: ({ context }) => {
- // return {
- // breadcrumbs: [
- // ...context.breadcrumbs,
- // {
- // label: "Data Sources"
- // }
- // ]
- // };
- // }
+ component: SecretScanningDataSourcesPage,
+ beforeLoad: ({ context }) => {
+ return {
+ breadcrumbs: [
+ ...context.breadcrumbs,
+ {
+ label: "Data Sources"
+ }
+ ]
+ };
+ }
});
diff --git a/frontend/src/pages/secret-scanning/SettingsPage/SettingsPage.tsx b/frontend/src/pages/secret-scanning/SettingsPage/SettingsPage.tsx
index 39ed618aa9..3a43bfbd81 100644
--- a/frontend/src/pages/secret-scanning/SettingsPage/SettingsPage.tsx
+++ b/frontend/src/pages/secret-scanning/SettingsPage/SettingsPage.tsx
@@ -6,7 +6,6 @@ import { PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
import { ProjectPermissionSub } from "@app/context";
import { ProjectPermissionSecretScanningConfigActions } from "@app/context/ProjectPermissionContext/types";
-import { ProjectGeneralTab } from "./components/ProjectGeneralTab";
import { ProjectScanningConfigTab } from "./components/ProjectScanningConfigTab";
export const SettingsPage = () => {
@@ -22,30 +21,16 @@ export const SettingsPage = () => {
<Tabs defaultValue="tab-project-general">
<TabList>
<Tab value="tab-project-general">General</Tab>
+ </TabList>
+ <TabPanel value="tab-project-general">
<ProjectPermissionCan
I={ProjectPermissionSecretScanningConfigActions.Read}
a={ProjectPermissionSub.SecretScanningConfigs}
+ renderGuardBanner
>
- {(isAllowed) =>
- isAllowed && <Tab value="tab-project-scanning-config">Scanning Configuration</Tab>
- }
+ <ProjectScanningConfigTab />
</ProjectPermissionCan>
- </TabList>
- <TabPanel value="tab-project-general">
- <ProjectGeneralTab />
</TabPanel>
- <ProjectPermissionCan
- I={ProjectPermissionSecretScanningConfigActions.Read}
- a={ProjectPermissionSub.SecretScanningConfigs}
- >
- {(isAllowed) =>
- isAllowed && (
- <TabPanel value="tab-project-scanning-config">
- <ProjectScanningConfigTab />
- </TabPanel>
- )
- }
- </ProjectPermissionCan>
</Tabs>
</div>
</div>
diff --git a/frontend/src/pages/secret-scanning/layout.tsx b/frontend/src/pages/secret-scanning/layout.tsx
index 65065a4693..24997ca428 100644
--- a/frontend/src/pages/secret-scanning/layout.tsx
+++ b/frontend/src/pages/secret-scanning/layout.tsx
@@ -5,10 +5,5 @@ import { SecretScanningLayout } from "@app/layouts/SecretScanningLayout";
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/projects/$projectId/_project-layout/secret-scanning/_secret-scanning-layout"
)({
- component: SecretScanningLayout,
- beforeLoad: async () => {
- return {
- breadcrumbs: []
- };
- }
+ component: SecretScanningLayout
});
diff --git a/frontend/src/pages/ssh/SettingsPage/SettingsPage.tsx b/frontend/src/pages/ssh/SettingsPage/SettingsPage.tsx
index 03d0e1c811..9bf8ae1d21 100644
--- a/frontend/src/pages/ssh/SettingsPage/SettingsPage.tsx
+++ b/frontend/src/pages/ssh/SettingsPage/SettingsPage.tsx
@@ -5,7 +5,6 @@ import { ProjectPermissionCan } from "@app/components/permissions";
import { PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
-import { ProjectGeneralTab } from "./components/ProjectGeneralTab";
import { ProjectSshTab } from "./components/ProjectSshTab";
export const SettingsPage = () => {
@@ -21,25 +20,16 @@ export const SettingsPage = () => {
<Tabs defaultValue="tab-project-general">
<TabList>
<Tab value="tab-project-general">General</Tab>
+ </TabList>
+ <TabPanel value="tab-project-general">
<ProjectPermissionCan
I={ProjectPermissionActions.Edit}
a={ProjectPermissionSub.Project}
+ renderGuardBanner
>
- {(isAllowed) => isAllowed && <Tab value="tab-project-ssh">SSH Settings</Tab>}
+ <ProjectSshTab />
</ProjectPermissionCan>
- </TabList>
- <TabPanel value="tab-project-general">
- <ProjectGeneralTab />
</TabPanel>
- <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.Project}>
- {(isAllowed) =>
- isAllowed && (
- <TabPanel value="tab-project-ssh">
- <ProjectSshTab />
- </TabPanel>
- )
- }
- </ProjectPermissionCan>
</Tabs>
</div>
</div>
diff --git a/frontend/src/pages/ssh/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx b/frontend/src/pages/ssh/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx
deleted file mode 100644
index 7c65b18573..0000000000
--- a/frontend/src/pages/ssh/SettingsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx
+++ /dev/null
@@ -1,129 +0,0 @@
-import { Controller, useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
-import { createNotification } from "@app/components/notifications";
-import { Button, FormControl, Input } from "@app/components/v2";
-import { useProjectPermission, useSubscription, useWorkspace } from "@app/context";
-import { usePopUp } from "@app/hooks";
-import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
-import { useUpdateWorkspaceAuditLogsRetention } from "@app/hooks/api/workspace/queries";
-
-const formSchema = z.object({
- auditLogsRetentionDays: z.coerce.number().min(0)
-});
-
-type TForm = z.infer<typeof formSchema>;
-
-export const AuditLogsRetentionSection = () => {
- const { mutateAsync: updateAuditLogsRetention } = useUpdateWorkspaceAuditLogsRetention();
-
- const { currentWorkspace } = useWorkspace();
- const { membership } = useProjectPermission();
- const { subscription } = useSubscription();
- const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["upgradePlan"] as const);
-
- const {
- control,
- formState: { isSubmitting, isDirty },
- handleSubmit
- } = useForm<TForm>({
- resolver: zodResolver(formSchema),
- values: {
- auditLogsRetentionDays:
- currentWorkspace?.auditLogsRetentionDays ?? subscription?.auditLogsRetentionDays ?? 0
- }
- });
-
- if (!currentWorkspace) return null;
-
- const handleAuditLogsRetentionSubmit = async ({ auditLogsRetentionDays }: TForm) => {
- try {
- if (!subscription?.auditLogs) {
- handlePopUpOpen("upgradePlan", {
- description: "You can only configure audit logs retention if you upgrade your plan."
- });
-
- return;
- }
-
- if (subscription && auditLogsRetentionDays > subscription?.auditLogsRetentionDays) {
- handlePopUpOpen("upgradePlan", {
- description:
- "To update your audit logs retention period to a higher value, upgrade your plan."
- });
-
- return;
- }
-
- await updateAuditLogsRetention({
- auditLogsRetentionDays,
- projectSlug: currentWorkspace.slug
- });
-
- createNotification({
- text: "Successfully updated audit logs retention period",
- type: "success"
- });
- } catch {
- createNotification({
- text: "Failed updating audit logs retention period",
- type: "error"
- });
- }
- };
-
- // render only for dedicated/self-hosted instances of Infisical
- if (
- window.location.origin.includes("https://app.infisical.com") ||
- window.location.origin.includes("https://gamma.infisical.com")
- ) {
- return null;
- }
-
- const isAdmin = membership.roles.includes(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-semibold">Audit Logs Retention</p>
- </div>
- <p className="mb-4 mt-2 max-w-2xl text-sm text-gray-400">
- Set the number of days to keep your project audit logs.
- </p>
- <form onSubmit={handleSubmit(handleAuditLogsRetentionSubmit)} autoComplete="off">
- <div className="max-w-xs">
- <Controller
- control={control}
- defaultValue={0}
- name="auditLogsRetentionDays"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- isError={Boolean(error)}
- errorText={error?.message}
- label="Number of days"
- >
- <Input {...field} type="number" min={1} step={1} isDisabled={!isAdmin} />
- </FormControl>
- )}
- />
- </div>
- <Button
- colorSchema="secondary"
- type="submit"
- isLoading={isSubmitting}
- disabled={!isAdmin || !isDirty}
- >
- Save
- </Button>
- </form>
- </div>
- <UpgradePlanModal
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={(popUp.upgradePlan?.data as { description: string })?.description}
- />
- </>
- );
-};
diff --git a/frontend/src/pages/ssh/SettingsPage/components/AuditLogsRetentionSection/index.tsx b/frontend/src/pages/ssh/SettingsPage/components/AuditLogsRetentionSection/index.tsx
deleted file mode 100644
index 38a07f53b1..0000000000
--- a/frontend/src/pages/ssh/SettingsPage/components/AuditLogsRetentionSection/index.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { AuditLogsRetentionSection } from "./AuditLogsRetentionSection";
diff --git a/frontend/src/pages/ssh/SettingsPage/components/DeleteProjectSection/DeleteProjectSection.tsx b/frontend/src/pages/ssh/SettingsPage/components/DeleteProjectSection/DeleteProjectSection.tsx
deleted file mode 100644
index 5a7549b3c9..0000000000
--- a/frontend/src/pages/ssh/SettingsPage/components/DeleteProjectSection/DeleteProjectSection.tsx
+++ /dev/null
@@ -1,184 +0,0 @@
-import { useMemo } from "react";
-import { useNavigate } from "@tanstack/react-router";
-
-import { createNotification } from "@app/components/notifications";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import { Button, DeleteActionModal } from "@app/components/v2";
-import { LeaveProjectModal } from "@app/components/v2/LeaveProjectModal";
-import {
- ProjectPermissionActions,
- ProjectPermissionSub,
- useOrganization,
- useProjectPermission,
- useWorkspace
-} from "@app/context";
-import { useToggle } from "@app/hooks";
-import { useDeleteWorkspace, useGetWorkspaceUsers, useLeaveProject } from "@app/hooks/api";
-import { ProjectType } from "@app/hooks/api/workspace/types";
-import { usePopUp } from "@app/hooks/usePopUp";
-
-export const DeleteProjectSection = () => {
- const navigate = useNavigate();
-
- const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
- "deleteWorkspace",
- "leaveWorkspace"
- ] as const);
-
- const { currentOrg } = useOrganization();
- const { hasProjectRole, membership } = useProjectPermission();
- const { currentWorkspace } = useWorkspace();
- const [isDeleting, setIsDeleting] = useToggle();
- const [isLeaving, setIsLeaving] = useToggle();
- const deleteWorkspace = useDeleteWorkspace();
- const leaveProject = useLeaveProject();
- const { data: members, isPending: isMembersLoading } = useGetWorkspaceUsers(
- currentWorkspace?.id || ""
- );
-
- // If isNoAccessMember is true, then the user can't read the workspace members. So we need to handle this case separately.
- const isNoAccessMember = hasProjectRole("no-access");
-
- const isOnlyAdminMember = useMemo(() => {
- if (!members || !membership || !hasProjectRole("admin")) return false;
-
- const adminMembers = members.filter(
- (member) => member.roles.map((r) => r.role).includes("admin") && member.id !== membership.id // exclude the current user
- );
-
- return !adminMembers.length;
- }, [members, membership]);
-
- const handleDeleteWorkspaceSubmit = async () => {
- setIsDeleting.on();
- try {
- if (!currentWorkspace?.id) return;
-
- await deleteWorkspace.mutateAsync({
- workspaceID: currentWorkspace?.id
- });
-
- createNotification({
- text: "Successfully deleted project",
- type: "success"
- });
-
- navigate({
- to: `/organization/${ProjectType.SecretManager}/overview` as const
- });
- handlePopUpClose("deleteWorkspace");
- } catch (err) {
- console.error(err);
- createNotification({
- text: "Failed to delete project",
- type: "error"
- });
- } finally {
- setIsDeleting.off();
- }
- };
-
- const handleLeaveWorkspaceSubmit = async () => {
- try {
- setIsLeaving.on();
-
- if (!currentWorkspace?.id || !currentOrg?.id) return;
-
- // If there's no members, and the user has access to read members, something went wrong.
- if (!members && !isNoAccessMember) return;
-
- // If the user has elevated permissions and can read members:
- if (!isNoAccessMember) {
- if (!members) return;
-
- if (members.length < 2) {
- createNotification({
- text: "You can't leave the project as you are the only member",
- type: "error"
- });
- return;
- }
- // If the user has access to read members, and there's less than 1 admin member excluding the current user, they can't leave the project.
- if (isOnlyAdminMember) {
- createNotification({
- text: "You can't leave a project with no admin members left. Promote another member to admin first.",
- type: "error"
- });
- return;
- }
- }
-
- // If it's actually a no-access member, then we don't really care about the members.
-
- await leaveProject.mutateAsync({
- workspaceId: currentWorkspace.id
- });
-
- navigate({
- to: `/organization/${ProjectType.SecretManager}/overview` as const
- });
- } catch (err) {
- console.error(err);
- createNotification({
- text: "Failed to leave project",
- type: "error"
- });
- } finally {
- setIsLeaving.off();
- }
- };
-
- return (
- <div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
- <p className="mb-4 text-xl font-semibold text-mineshaft-100">Danger Zone</p>
- <div className="space-x-4">
- <ProjectPermissionCan I={ProjectPermissionActions.Delete} a={ProjectPermissionSub.Project}>
- {(isAllowed) => (
- <Button
- isLoading={isDeleting}
- isDisabled={!isAllowed || isDeleting}
- colorSchema="danger"
- variant="outline_bg"
- type="submit"
- onClick={() => handlePopUpOpen("deleteWorkspace")}
- >
- {`Delete ${currentWorkspace?.name}`}
- </Button>
- )}
- </ProjectPermissionCan>
- {!isOnlyAdminMember && (
- <Button
- disabled={isMembersLoading || (members && members?.length < 2)}
- isLoading={isLeaving}
- colorSchema="danger"
- variant="outline_bg"
- type="submit"
- onClick={() => handlePopUpOpen("leaveWorkspace")}
- >
- {`Leave ${currentWorkspace?.name}`}
- </Button>
- )}
- </div>
-
- <DeleteActionModal
- isOpen={popUp.deleteWorkspace.isOpen}
- title="Are you sure you want to delete this project?"
- subTitle={`Permanently delete ${currentWorkspace?.name} and all of its data. This action is not reversible, so please be careful.`}
- onChange={(isOpen) => handlePopUpToggle("deleteWorkspace", isOpen)}
- deleteKey="confirm"
- buttonText="Delete Project"
- onDeleteApproved={handleDeleteWorkspaceSubmit}
- />
-
- <LeaveProjectModal
- isOpen={popUp.leaveWorkspace.isOpen}
- title="Are you sure you want to leave this project?"
- subTitle={`If you leave ${currentWorkspace?.name} you will lose access to the project and its contents.`}
- onChange={(isOpen) => handlePopUpToggle("leaveWorkspace", isOpen)}
- deleteKey="confirm"
- buttonText="Leave Project"
- onLeaveApproved={handleLeaveWorkspaceSubmit}
- />
- </div>
- );
-};
diff --git a/frontend/src/pages/ssh/SettingsPage/components/DeleteProjectSection/index.tsx b/frontend/src/pages/ssh/SettingsPage/components/DeleteProjectSection/index.tsx
deleted file mode 100644
index 04a624ec2f..0000000000
--- a/frontend/src/pages/ssh/SettingsPage/components/DeleteProjectSection/index.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { DeleteProjectSection } from "./DeleteProjectSection";
diff --git a/frontend/src/pages/ssh/SettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx b/frontend/src/pages/ssh/SettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx
deleted file mode 100644
index 41e8107e09..0000000000
--- a/frontend/src/pages/ssh/SettingsPage/components/ProjectGeneralTab/ProjectGeneralTab.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import { ProjectOverviewChangeSection } from "@app/components/project/ProjectOverviewChangeSection";
-
-import { AuditLogsRetentionSection } from "../AuditLogsRetentionSection";
-import { DeleteProjectSection } from "../DeleteProjectSection";
-
-export const ProjectGeneralTab = () => {
- return (
- <div>
- <ProjectOverviewChangeSection showSlugField />
- <AuditLogsRetentionSection />
- <DeleteProjectSection />
- </div>
- );
-};
diff --git a/frontend/src/pages/ssh/SettingsPage/components/ProjectGeneralTab/index.tsx b/frontend/src/pages/ssh/SettingsPage/components/ProjectGeneralTab/index.tsx
deleted file mode 100644
index c6e611e0ff..0000000000
--- a/frontend/src/pages/ssh/SettingsPage/components/ProjectGeneralTab/index.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { ProjectGeneralTab } from "./ProjectGeneralTab";
diff --git a/frontend/src/pages/ssh/SettingsPage/components/index.tsx b/frontend/src/pages/ssh/SettingsPage/components/index.tsx
deleted file mode 100644
index 04a624ec2f..0000000000
--- a/frontend/src/pages/ssh/SettingsPage/components/index.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { DeleteProjectSection } from "./DeleteProjectSection";
diff --git a/frontend/src/pages/ssh/SshCaByIDPage/route.tsx b/frontend/src/pages/ssh/SshCaByIDPage/route.tsx
index c716e2e0a4..e90f9736ea 100644
--- a/frontend/src/pages/ssh/SshCaByIDPage/route.tsx
+++ b/frontend/src/pages/ssh/SshCaByIDPage/route.tsx
@@ -11,13 +11,14 @@ export const Route = createFileRoute(
breadcrumbs: [
...context.breadcrumbs,
{
- label: "SSH Certificate Authorities",
+ label: "Certificate Authorities",
link: linkOptions({
- to: "/ssh/$projectId/overview",
- params: {
- projectId: params.projectId
- }
+ to: "/projects/$projectId/ssh/cas",
+ params
})
+ },
+ {
+ label: "Details"
}
]
};
diff --git a/frontend/src/pages/ssh/SshCasPage/route.tsx b/frontend/src/pages/ssh/SshCasPage/route.tsx
index a9017a6334..e2b9d25226 100644
--- a/frontend/src/pages/ssh/SshCasPage/route.tsx
+++ b/frontend/src/pages/ssh/SshCasPage/route.tsx
@@ -1,9 +1,23 @@
-import { createFileRoute } from "@tanstack/react-router";
+import { createFileRoute, linkOptions } from "@tanstack/react-router";
import { SshCasPage } from "./SshCasPage";
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/projects/$projectId/_project-layout/ssh/_ssh-layout/cas"
)({
- component: SshCasPage
+ component: SshCasPage,
+ beforeLoad: ({ context, params }) => {
+ return {
+ breadcrumbs: [
+ ...context.breadcrumbs,
+ {
+ label: "Certificate Authorities",
+ link: linkOptions({
+ to: "/projects/$projectId/ssh/cas",
+ params
+ })
+ }
+ ]
+ };
+ }
});
diff --git a/frontend/src/pages/ssh/SshHostGroupDetailsByIDPage/route.tsx b/frontend/src/pages/ssh/SshHostGroupDetailsByIDPage/route.tsx
index 4ccb5c4265..45b536593f 100644
--- a/frontend/src/pages/ssh/SshHostGroupDetailsByIDPage/route.tsx
+++ b/frontend/src/pages/ssh/SshHostGroupDetailsByIDPage/route.tsx
@@ -1,9 +1,26 @@
-import { createFileRoute } from "@tanstack/react-router";
+import { createFileRoute, linkOptions } from "@tanstack/react-router";
import { SshHostGroupDetailsByIDPage } from "./SshHostGroupDetailsByIDPage";
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/projects/$projectId/_project-layout/ssh/_ssh-layout/ssh-host-groups/$sshHostGroupId"
)({
- component: SshHostGroupDetailsByIDPage
+ component: SshHostGroupDetailsByIDPage,
+ beforeLoad: ({ context, params }) => {
+ return {
+ breadcrumbs: [
+ ...context.breadcrumbs,
+ {
+ label: "Hosts",
+ link: linkOptions({
+ to: "/projects/$projectId/ssh/overview",
+ params
+ })
+ },
+ {
+ label: "Host Group"
+ }
+ ]
+ };
+ }
});
diff --git a/frontend/src/pages/ssh/SshHostsPage/route.tsx b/frontend/src/pages/ssh/SshHostsPage/route.tsx
index 366545ee3b..2208a65cbe 100644
--- a/frontend/src/pages/ssh/SshHostsPage/route.tsx
+++ b/frontend/src/pages/ssh/SshHostsPage/route.tsx
@@ -5,5 +5,15 @@ import { SshHostsPage } from "./SshHostsPage";
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/projects/$projectId/_project-layout/ssh/_ssh-layout/overview"
)({
- component: SshHostsPage
+ component: SshHostsPage,
+ beforeLoad: ({ context }) => {
+ return {
+ breadcrumbs: [
+ ...context.breadcrumbs,
+ {
+ label: "Hosts"
+ }
+ ]
+ };
+ }
});
diff --git a/frontend/src/pages/ssh/layout.tsx b/frontend/src/pages/ssh/layout.tsx
index 0e05f8b383..8354500b13 100644
--- a/frontend/src/pages/ssh/layout.tsx
+++ b/frontend/src/pages/ssh/layout.tsx
@@ -5,10 +5,5 @@ import { SshLayout } from "@app/layouts/SshLayout";
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/projects/$projectId/_project-layout/ssh/_ssh-layout"
)({
- component: SshLayout,
- beforeLoad: async () => {
- return {
- breadcrumbs: []
- };
- }
+ component: SshLayout
});