1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00

fix: check for enterprise in the create/edit templates UI (#8985)

This commit is contained in:
David Leek 2024-12-16 15:09:34 +01:00 committed by GitHub
parent 3696420c51
commit 37b55eff5a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 5 deletions

View File

@ -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) {
return null;
}
return (
<>
<PageContent
@ -32,7 +40,7 @@ export const ReleaseManagement = () => {
}}
maxWidth='700px'
permission={CREATE_RELEASE_TEMPLATE}
disabled={false}
disabled={!isEnterprise()}
>
New template
</ResponsiveButton>

View File

@ -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;
}

View File

@ -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;
}