From 203c4a6ff9f9d5302370f00d34776f00a9fc19da Mon Sep 17 00:00:00 2001 From: David Leek Date: Mon, 16 Dec 2024 10:54:28 +0100 Subject: [PATCH 1/3] fix: check for enterprise in the create/edit templates UI --- .../ReleasePlanTemplate/CreateReleasePlanTemplate.tsx | 4 ++-- .../releases/ReleasePlanTemplate/EditReleasePlanTemplate.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/component/releases/ReleasePlanTemplate/CreateReleasePlanTemplate.tsx b/frontend/src/component/releases/ReleasePlanTemplate/CreateReleasePlanTemplate.tsx index 8f7580bdedec..09cbeb82417b 100644 --- a/frontend/src/component/releases/ReleasePlanTemplate/CreateReleasePlanTemplate.tsx +++ b/frontend/src/component/releases/ReleasePlanTemplate/CreateReleasePlanTemplate.tsx @@ -24,7 +24,7 @@ const StyledCancelButton = styled(Button)(({ theme }) => ({ })); export const CreateReleasePlanTemplate = () => { - const { uiConfig } = useUiConfig(); + const { uiConfig, isEnterprise } = useUiConfig(); const releasePlansEnabled = useUiFlag('releasePlans'); const { setToastApiError, setToastData } = useToast(); const navigate = useNavigate(); @@ -75,7 +75,7 @@ export const CreateReleasePlanTemplate = () => { --header 'Content-Type: application/json' \\ --data-raw '${JSON.stringify(getTemplatePayload(), undefined, 2)}'`; - if (!releasePlansEnabled) { + if (!releasePlansEnabled || !isEnterprise()) { return null; } diff --git a/frontend/src/component/releases/ReleasePlanTemplate/EditReleasePlanTemplate.tsx b/frontend/src/component/releases/ReleasePlanTemplate/EditReleasePlanTemplate.tsx index 0445e8e2c08d..2da6c7207851 100644 --- a/frontend/src/component/releases/ReleasePlanTemplate/EditReleasePlanTemplate.tsx +++ b/frontend/src/component/releases/ReleasePlanTemplate/EditReleasePlanTemplate.tsx @@ -24,7 +24,7 @@ const StyledCancelButton = styled(Button)(({ theme }) => ({ })); export const EditReleasePlanTemplate = () => { - const { uiConfig } = useUiConfig(); + const { uiConfig, isEnterprise } = useUiConfig(); const releasePlansEnabled = useUiFlag('releasePlans'); const templateId = useRequiredPathParam('templateId'); const { template, loading, error, refetch } = @@ -82,7 +82,7 @@ export const EditReleasePlanTemplate = () => { --header 'Content-Type: application/json' \\ --data-raw '${JSON.stringify(getTemplatePayload(), undefined, 2)}'`; - if (!releasePlansEnabled) { + if (!releasePlansEnabled || !isEnterprise()) { return null; } From 3fdee31092cc7e3ca6112ca21f903d3b801a46b4 Mon Sep 17 00:00:00 2001 From: David Leek Date: Mon, 16 Dec 2024 11:17:02 +0100 Subject: [PATCH 2/3] fix: check for enterprise in overview page --- .../releases/ReleaseManagement/ReleaseManagement.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frontend/src/component/releases/ReleaseManagement/ReleaseManagement.tsx b/frontend/src/component/releases/ReleaseManagement/ReleaseManagement.tsx index 5962d7eaabb7..119fd9849331 100644 --- a/frontend/src/component/releases/ReleaseManagement/ReleaseManagement.tsx +++ b/frontend/src/component/releases/ReleaseManagement/ReleaseManagement.tsx @@ -10,12 +10,20 @@ import { useNavigate } from 'react-router-dom'; import { useReleasePlanTemplates } from 'hooks/api/getters/useReleasePlanTemplates/useReleasePlanTemplates'; import { EmptyTemplatesListMessage } from './EmptyTemplatesListMessage'; import { ReleasePlanTemplateList } from './ReleasePlanTemplateList'; +import { useUiFlag } from 'hooks/useUiFlag'; +import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; export const ReleaseManagement = () => { usePageTitle('Release management'); const navigate = useNavigate(); const data = useReleasePlanTemplates(); + const { isEnterprise } = useUiConfig(); + const releasePlansEnabled = useUiFlag('releasePlans'); + if (!releasePlansEnabled || !isEnterprise()) { + return null; + } + return ( <> Date: Mon, 16 Dec 2024 14:50:32 +0100 Subject: [PATCH 3/3] fix: reenable for pro but disable new template button --- .../releases/ReleaseManagement/ReleaseManagement.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/component/releases/ReleaseManagement/ReleaseManagement.tsx b/frontend/src/component/releases/ReleaseManagement/ReleaseManagement.tsx index 119fd9849331..1f3febae5d2d 100644 --- a/frontend/src/component/releases/ReleaseManagement/ReleaseManagement.tsx +++ b/frontend/src/component/releases/ReleaseManagement/ReleaseManagement.tsx @@ -20,7 +20,7 @@ export const ReleaseManagement = () => { const { isEnterprise } = useUiConfig(); const releasePlansEnabled = useUiFlag('releasePlans'); - if (!releasePlansEnabled || !isEnterprise()) { + if (!releasePlansEnabled) { return null; } @@ -40,7 +40,7 @@ export const ReleaseManagement = () => { }} maxWidth='700px' permission={CREATE_RELEASE_TEMPLATE} - disabled={false} + disabled={!isEnterprise()} > New template