1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

fix: set admin permission (#736)

This commit is contained in:
Fredrik Strand Oseberg 2022-02-23 13:47:32 +01:00 committed by GitHub
parent 9e0eec10ba
commit 38c26ec052
3 changed files with 8 additions and 2 deletions

View File

@ -19,6 +19,8 @@ import EnvironmentListItem from './EnvironmentListItem/EnvironmentListItem';
import { mutate } from 'swr'; import { mutate } from 'swr';
import EnvironmentToggleConfirm from './EnvironmentToggleConfirm/EnvironmentToggleConfirm'; import EnvironmentToggleConfirm from './EnvironmentToggleConfirm/EnvironmentToggleConfirm';
import useProjectRolePermissions from '../../../hooks/api/getters/useProjectRolePermissions/useProjectRolePermissions'; import useProjectRolePermissions from '../../../hooks/api/getters/useProjectRolePermissions/useProjectRolePermissions';
import { ADMIN } from 'component/providers/AccessProvider/permissions';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
const EnvironmentList = () => { const EnvironmentList = () => {
const defaultEnv = { const defaultEnv = {
@ -30,6 +32,7 @@ const EnvironmentList = () => {
protected: false, protected: false,
}; };
const { environments, refetch } = useEnvironments(); const { environments, refetch } = useEnvironments();
const { uiConfig } = useUiConfig();
const { refetch: refetchProjectRolePermissions } = const { refetch: refetchProjectRolePermissions } =
useProjectRolePermissions(); useProjectRolePermissions();
@ -161,7 +164,6 @@ const EnvironmentList = () => {
const navigateToCreateEnvironment = () => { const navigateToCreateEnvironment = () => {
history.push('/environments/create'); history.push('/environments/create');
}; };
return ( return (
<PageContent <PageContent
headerContent={ headerContent={
@ -174,6 +176,8 @@ const EnvironmentList = () => {
maxWidth="700px" maxWidth="700px"
tooltip="Add environment" tooltip="Add environment"
Icon={Add} Icon={Add}
permission={ADMIN}
disabled={!Boolean(uiConfig.flags.EEA)}
> >
Add Environment Add Environment
</ResponsiveButton> </ResponsiveButton>

View File

@ -5,7 +5,7 @@ export const defaultValue = {
version: '3.x', version: '3.x',
environment: '', environment: '',
slogan: 'The enterprise ready feature toggle service.', slogan: 'The enterprise ready feature toggle service.',
flags: { P: false, C: false, E: false, RE: false }, flags: { P: false, C: false, E: false, RE: false, EEA: false },
links: [ links: [
{ {
value: 'Documentation', value: 'Documentation',

View File

@ -24,6 +24,8 @@ export interface IFlags {
P: boolean; P: boolean;
E: boolean; E: boolean;
RE: boolean; RE: boolean;
EEA?: boolean;
OIDC?: boolean;
} }
export interface IVersionInfo { export interface IVersionInfo {