Skip to content

Commit

Permalink
fix: check for enterprise in the create/edit templates UI (#8985)
Browse files Browse the repository at this point in the history
  • Loading branch information
daveleek authored Dec 16, 2024
1 parent 3696420 commit 37b55ef
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -32,7 +40,7 @@ export const ReleaseManagement = () => {
}}
maxWidth='700px'
permission={CREATE_RELEASE_TEMPLATE}
disabled={false}
disabled={!isEnterprise()}
>
New template
</ResponsiveButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 } =
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 37b55ef

Please sign in to comment.