Skip to content

Commit

Permalink
chore: don't prevent users from entering the env form when they're at…
Browse files Browse the repository at this point in the history
… the limit (#7549)

This change reverts the changes related to the button in particular
that were introduced in #7500. The button is now always enabled, and
the actual resource warning and creation blocking happens in the form,
courtesy of #7548.
  • Loading branch information
thomasheartman authored Jul 5, 2024
1 parent 1d7cd2e commit 94926b7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 67 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,18 @@ import Add from '@mui/icons-material/Add';
import { ADMIN } from 'component/providers/AccessProvider/permissions';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
import { useNavigate } from 'react-router-dom';
import { useEnvironments } from 'hooks/api/getters/useEnvironments/useEnvironments';

export const CreateEnvironmentButton = () => {
const { uiConfig } = useUiConfig();
const { environments } = useEnvironments();
const environmentLimit = uiConfig.resourceLimits.environments;
const navigate = useNavigate();

const limitReached = environments.length >= environmentLimit;

return (
<ResponsiveButton
tooltipProps={{
arrow: true,
title: limitReached
? `You have reached the limit of environments you can create (${environmentLimit}).`
: undefined,
}}
onClick={() => navigate('/environments/create')}
maxWidth='700px'
Icon={Add}
permission={ADMIN}
disabled={limitReached || !uiConfig.flags.EEA}
disabled={!uiConfig.flags.EEA}
>
New environment
</ResponsiveButton>
Expand Down

0 comments on commit 94926b7

Please sign in to comment.