diff --git a/app/client/src/git/components/OpsModal/OpsModalView.tsx b/app/client/src/git/components/OpsModal/OpsModalView.tsx index 54bd0c8047..a81a5c1914 100644 --- a/app/client/src/git/components/OpsModal/OpsModalView.tsx +++ b/app/client/src/git/components/OpsModal/OpsModalView.tsx @@ -15,7 +15,7 @@ import styled from "styled-components"; // import ReconnectSSHError from "../components/ReconnectSSHError"; import { GitOpsTab } from "git/constants/enums"; import noop from "lodash/noop"; -import isGitTaggingEnabled from "git/helpers/isGitTaggingEnabled"; +import isTaggingEnabled from "git/helpers/isTaggingEnabled"; import type { GitArtifactDef } from "git/types"; import TabRelease from "./TabRelease"; import { OPS_MODAL } from "git/ee/constants/messages"; @@ -49,7 +49,7 @@ function OpsModalView({ repoName = null, toggleOpsModal = noop, }: OpsModalViewProps) { - const isTaggingEnabled = isGitTaggingEnabled(artifactDef); + const showReleaseTab = isTaggingEnabled(artifactDef); useEffect( function fetchStatusOnMountEffect() { @@ -99,7 +99,7 @@ function OpsModalView({ > {createMessage(MERGE)} - {isTaggingEnabled && ( + {showReleaseTab && ( {opsModalTab === GitOpsTab.Deploy && } {opsModalTab === GitOpsTab.Merge && } - {isTaggingEnabled && opsModalTab === GitOpsTab.Release && ( + {showReleaseTab && opsModalTab === GitOpsTab.Release && ( )} diff --git a/app/client/src/git/components/SettingsModal/SettingsModalView.tsx b/app/client/src/git/components/SettingsModal/SettingsModalView.tsx index b361789b7d..ccef6ca8fc 100644 --- a/app/client/src/git/components/SettingsModal/SettingsModalView.tsx +++ b/app/client/src/git/components/SettingsModal/SettingsModalView.tsx @@ -40,6 +40,8 @@ interface SettingsModalViewProps { isManageProtectedBranchesPermitted: boolean; isSettingsModalOpen: boolean; settingsModalTab: keyof typeof GitSettingsTab; + showBranchTab: boolean; + showCDTab: boolean; toggleSettingsModal: ( open: boolean, tab?: keyof typeof GitSettingsTab, @@ -53,11 +55,10 @@ function SettingsModalView({ isManageProtectedBranchesPermitted = false, isSettingsModalOpen = false, settingsModalTab = GitSettingsTab.General, + showBranchTab = false, + showCDTab = false, toggleSettingsModal = noop, }: SettingsModalViewProps) { - const showBranchTab = - isManageDefaultBranchPermitted || isManageProtectedBranchesPermitted; - const handleTabKeyChange = useCallback( (tabKey: string) => { toggleSettingsModal(true, tabKey as GitSettingsTab); @@ -85,12 +86,14 @@ function SettingsModalView({ {createMessage(BRANCH)} )} - - {createMessage(CONTINUOUS_DELIVERY)} - + {showCDTab && ( + + {createMessage(CONTINUOUS_DELIVERY)} + + )} diff --git a/app/client/src/git/components/SettingsModal/index.tsx b/app/client/src/git/components/SettingsModal/index.tsx index 9553e03d7b..968d297e4b 100644 --- a/app/client/src/git/components/SettingsModal/index.tsx +++ b/app/client/src/git/components/SettingsModal/index.tsx @@ -3,8 +3,10 @@ import SettingsModalView from "./SettingsModalView"; import useSettings from "git/hooks/useSettings"; import { GitSettingsTab } from "git/constants/enums"; import { useGitContext } from "../GitContextProvider"; +import isContinuousDeliveryEnabled from "git/helpers/isContinuousDeliveryEnabled"; function SettingsModal() { + const { artifactDef } = useGitContext(); const { isConnectPermitted, @@ -15,6 +17,12 @@ function SettingsModal() { const { isSettingsModalOpen, settingsModalTab, toggleSettingsModal } = useSettings(); + const showBranchTab = + isManageDefaultBranchPermitted || isManageProtectedBranchesPermitted; + const showCDTab = artifactDef + ? isContinuousDeliveryEnabled(artifactDef) + : false; + return ( ); diff --git a/app/client/src/git/helpers/isAutocommitEnabled.ts b/app/client/src/git/helpers/isAutocommitEnabled.ts index fdd689134e..b5c1fae963 100644 --- a/app/client/src/git/helpers/isAutocommitEnabled.ts +++ b/app/client/src/git/helpers/isAutocommitEnabled.ts @@ -1,7 +1,6 @@ import { GitArtifactType } from "git/constants/enums"; import type { GitArtifactDef } from "git/types"; -// ? Temporary, will be removed when the feature is supported in packages function isAutocommitEnabled(artifactDef: GitArtifactDef) { if (artifactDef.artifactType === GitArtifactType.Application) { return true; diff --git a/app/client/src/git/helpers/isContinuousDeliveryEnabled.ts b/app/client/src/git/helpers/isContinuousDeliveryEnabled.ts new file mode 100644 index 0000000000..68c63bab68 --- /dev/null +++ b/app/client/src/git/helpers/isContinuousDeliveryEnabled.ts @@ -0,0 +1,12 @@ +import { GitArtifactType } from "git/constants/enums"; +import type { GitArtifactDef } from "git/types"; + +function isContinuousDeliveryEnabled(artifactDef: GitArtifactDef) { + if (artifactDef.artifactType === GitArtifactType.Application) { + return true; + } + + return false; +} + +export default isContinuousDeliveryEnabled; diff --git a/app/client/src/git/helpers/isProtectedBranchesEnabled.ts b/app/client/src/git/helpers/isProtectedBranchesEnabled.ts index 3cd81cd387..8f547a6310 100644 --- a/app/client/src/git/helpers/isProtectedBranchesEnabled.ts +++ b/app/client/src/git/helpers/isProtectedBranchesEnabled.ts @@ -1,7 +1,6 @@ import { GitArtifactType } from "git/constants/enums"; import type { GitArtifactDef } from "git/types"; -// ? Temporary, will be removed when the feature is supported in packages function isProtectedBranchesEnabled(artifactDef: GitArtifactDef) { if (artifactDef.artifactType === GitArtifactType.Application) { return true; diff --git a/app/client/src/git/helpers/isGitTaggingEnabled.ts b/app/client/src/git/helpers/isTaggingEnabled.ts similarity index 66% rename from app/client/src/git/helpers/isGitTaggingEnabled.ts rename to app/client/src/git/helpers/isTaggingEnabled.ts index a800954cc8..ca391b46cb 100644 --- a/app/client/src/git/helpers/isGitTaggingEnabled.ts +++ b/app/client/src/git/helpers/isTaggingEnabled.ts @@ -1,7 +1,7 @@ import { GitArtifactType } from "git/constants/enums"; import type { GitArtifactDef } from "git/types"; -function isGitTaggingEnabled(artifactDef: GitArtifactDef | null) { +function isTaggingEnabled(artifactDef: GitArtifactDef | null) { if (artifactDef?.artifactType === GitArtifactType.Package) { return true; } @@ -9,4 +9,4 @@ function isGitTaggingEnabled(artifactDef: GitArtifactDef | null) { return false; } -export default isGitTaggingEnabled; +export default isTaggingEnabled;