Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
Comment on lines +23 to +25
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine if the feature is disabled you should not be able to see this... I don't think it's needed due to

menu: { advanced: true, mode: ['enterprise'] },
flag: 'releasePlans',
enterprise: true,
but 🤷


return (
<>
<PageContent
Expand All @@ -32,7 +40,7 @@ export const ReleaseManagement = () => {
}}
maxWidth='700px'
permission={CREATE_RELEASE_TEMPLATE}
disabled={false}
disabled={!isEnterprise()}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

>
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
Loading