feat: project settings hiding

This commit is contained in:
=
2024-12-11 22:59:39 +05:30
parent 0fd8274ff0
commit 24acb98978
2 changed files with 20 additions and 14 deletions

View File

@@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
import { Tab } from "@headlessui/react";
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 { ProjectGeneralTab } from "./components/ProjectGeneralTab";
@@ -18,7 +18,9 @@ export const ProjectSettingsPage = () => {
{
name: "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: "Webhooks", key: "tab-project-webhooks" }
@@ -53,11 +55,12 @@ export const ProjectSettingsPage = () => {
<Tab.Panel>
<ProjectGeneralTab />
</Tab.Panel>
{currentWorkspace?.version === ProjectVersion.V3 && (
<Tab.Panel>
<EncryptionTab />
</Tab.Panel>
)}
{currentWorkspace?.version === ProjectVersion.V3 &&
currentWorkspace?.type === ProjectType.SecretManager && (
<Tab.Panel>
<EncryptionTab />
</Tab.Panel>
)}
<Tab.Panel>
<WorkflowIntegrationTab />
</Tab.Panel>

View File

@@ -1,5 +1,5 @@
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 { AutoCapitalizationSection } from "../AutoCapitalizationSection";
@@ -13,17 +13,20 @@ import { SecretTagsSection } from "../SecretTagsSection";
export const ProjectGeneralTab = () => {
const { currentWorkspace } = useWorkspace();
const isSecretManager = currentWorkspace?.type === ProjectType.SecretManager;
return (
<div>
<ProjectOverviewChangeSection />
<EnvironmentSection />
<SecretTagsSection />
<AutoCapitalizationSection />
<PointInTimeVersionLimitSection />
{isSecretManager && <EnvironmentSection />}
{isSecretManager && <SecretTagsSection />}
{isSecretManager && <AutoCapitalizationSection />}
{isSecretManager && <PointInTimeVersionLimitSection />}
<AuditLogsRetentionSection />
<BackfillSecretReferenceSecretion />
{currentWorkspace?.version !== ProjectVersion.V3 && <RebuildSecretIndicesSection />}
{isSecretManager && <BackfillSecretReferenceSecretion />}
{currentWorkspace?.version !== ProjectVersion.V3 && isSecretManager && (
<RebuildSecretIndicesSection />
)}
<DeleteProjectSection />
</div>
);