feat: project settings hiding

This commit is contained in:
=
2024-12-13 21:38:42 +05:30
parent 0fd8274ff0
commit 24acb98978
2 changed files with 20 additions and 14 deletions
@@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
import { Tab } from "@headlessui/react"; import { Tab } from "@headlessui/react";
import { useWorkspace } from "@app/context"; import { useWorkspace } from "@app/context";
import { ProjectVersion } from "@app/hooks/api/workspace/types"; import { ProjectType, ProjectVersion } from "@app/hooks/api/workspace/types";
import { EncryptionTab } from "./components/EncryptionTab"; import { EncryptionTab } from "./components/EncryptionTab";
import { ProjectGeneralTab } from "./components/ProjectGeneralTab"; import { ProjectGeneralTab } from "./components/ProjectGeneralTab";
@@ -18,7 +18,9 @@ export const ProjectSettingsPage = () => {
{ {
name: "Encryption", name: "Encryption",
key: "tab-project-encryption", key: "tab-project-encryption",
isHidden: currentWorkspace?.version !== ProjectVersion.V3 isHidden:
currentWorkspace?.version !== ProjectVersion.V3 ||
currentWorkspace?.type !== ProjectType.SecretManager
}, },
{ name: "Workflow Integrations", key: "tab-workflow-integrations" }, { name: "Workflow Integrations", key: "tab-workflow-integrations" },
{ name: "Webhooks", key: "tab-project-webhooks" } { name: "Webhooks", key: "tab-project-webhooks" }
@@ -53,11 +55,12 @@ export const ProjectSettingsPage = () => {
<Tab.Panel> <Tab.Panel>
<ProjectGeneralTab /> <ProjectGeneralTab />
</Tab.Panel> </Tab.Panel>
{currentWorkspace?.version === ProjectVersion.V3 && ( {currentWorkspace?.version === ProjectVersion.V3 &&
<Tab.Panel> currentWorkspace?.type === ProjectType.SecretManager && (
<EncryptionTab /> <Tab.Panel>
</Tab.Panel> <EncryptionTab />
)} </Tab.Panel>
)}
<Tab.Panel> <Tab.Panel>
<WorkflowIntegrationTab /> <WorkflowIntegrationTab />
</Tab.Panel> </Tab.Panel>
@@ -1,5 +1,5 @@
import { useWorkspace } from "@app/context"; import { useWorkspace } from "@app/context";
import { ProjectVersion } from "@app/hooks/api/workspace/types"; import { ProjectType, ProjectVersion } from "@app/hooks/api/workspace/types";
import { AuditLogsRetentionSection } from "../AuditLogsRetentionSection"; import { AuditLogsRetentionSection } from "../AuditLogsRetentionSection";
import { AutoCapitalizationSection } from "../AutoCapitalizationSection"; import { AutoCapitalizationSection } from "../AutoCapitalizationSection";
@@ -13,17 +13,20 @@ import { SecretTagsSection } from "../SecretTagsSection";
export const ProjectGeneralTab = () => { export const ProjectGeneralTab = () => {
const { currentWorkspace } = useWorkspace(); const { currentWorkspace } = useWorkspace();
const isSecretManager = currentWorkspace?.type === ProjectType.SecretManager;
return ( return (
<div> <div>
<ProjectOverviewChangeSection /> <ProjectOverviewChangeSection />
<EnvironmentSection /> {isSecretManager && <EnvironmentSection />}
<SecretTagsSection /> {isSecretManager && <SecretTagsSection />}
<AutoCapitalizationSection /> {isSecretManager && <AutoCapitalizationSection />}
<PointInTimeVersionLimitSection /> {isSecretManager && <PointInTimeVersionLimitSection />}
<AuditLogsRetentionSection /> <AuditLogsRetentionSection />
<BackfillSecretReferenceSecretion /> {isSecretManager && <BackfillSecretReferenceSecretion />}
{currentWorkspace?.version !== ProjectVersion.V3 && <RebuildSecretIndicesSection />} {currentWorkspace?.version !== ProjectVersion.V3 && isSecretManager && (
<RebuildSecretIndicesSection />
)}
<DeleteProjectSection /> <DeleteProjectSection />
</div> </div>
); );