1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-28 17:55:15 +02:00

feat: hide project settings for OSS (#4662)

This commit is contained in:
Jaanus Sellin 2023-09-12 09:39:55 +03:00 committed by GitHub
parent 1cd0edb11a
commit 980461ef18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 11 deletions

View File

@ -2,9 +2,9 @@ import { SelectProjectInput } from './SelectProjectInput/SelectProjectInput';
import { TokenType } from '../../../../../interfaces/token'; import { TokenType } from '../../../../../interfaces/token';
import React from 'react'; import React from 'react';
import { StyledInputDescription } from '../ApiTokenForm.styles'; import { StyledInputDescription } from '../ApiTokenForm.styles';
import useProjects from '../../../../../hooks/api/getters/useProjects/useProjects'; import useProjects from 'hooks/api/getters/useProjects/useProjects';
import { ApiTokenFormErrorType } from '../useApiTokenForm'; import { ApiTokenFormErrorType } from '../useApiTokenForm';
import { useOptionalPathParam } from '../../../../../hooks/useOptionalPathParam'; import { useOptionalPathParam } from 'hooks/useOptionalPathParam';
interface IProjectSelectorProps { interface IProjectSelectorProps {
type: string; type: string;

View File

@ -98,6 +98,11 @@ const PremiumFeatures = {
url: 'https://docs.getunleash.io/reference/rbac#user-group-sso-integration', url: 'https://docs.getunleash.io/reference/rbac#user-group-sso-integration',
label: 'Single Sign-On', label: 'Single Sign-On',
}, },
'project-settings': {
plan: FeaturePlan.PRO,
url: 'https://docs.getunleash.io/reference/projects',
label: 'Project settings',
},
}; };
type PremiumFeatureType = keyof typeof PremiumFeatures; type PremiumFeatureType = keyof typeof PremiumFeatures;

View File

@ -102,7 +102,7 @@ export const Project = () => {
}, },
{ {
title: 'Project settings', title: 'Project settings',
path: `${basePath}/settings`, path: `${basePath}/settings${isOss() ? '/environments' : ''}`,
name: 'settings', name: 'settings',
flag: undefined, flag: undefined,
new: false, new: false,

View File

@ -23,16 +23,12 @@ export const ProjectSettings = () => {
const navigate = useNavigate(); const navigate = useNavigate();
const tabs: ITab[] = [ const tabs: ITab[] = [
{
id: '',
label: 'Settings',
},
{
id: 'environments',
label: 'Environments',
},
...(isPro() || isEnterprise() ...(isPro() || isEnterprise()
? [ ? [
{
id: '',
label: 'Settings',
},
{ {
id: 'access', id: 'access',
label: 'Access', label: 'Access',
@ -52,6 +48,10 @@ export const ProjectSettings = () => {
}, },
] ]
: []), : []),
{
id: 'environments',
label: 'Environments',
},
{ {
id: 'api-access', id: 'api-access',
label: 'API access', label: 'API access',

View File

@ -8,13 +8,27 @@ import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
import { usePageTitle } from 'hooks/usePageTitle'; import { usePageTitle } from 'hooks/usePageTitle';
import { useProjectNameOrId } from 'hooks/api/getters/useProject/useProject'; import { useProjectNameOrId } from 'hooks/api/getters/useProject/useProject';
import EditProject from './EditProject'; import EditProject from './EditProject';
import { PremiumFeature } from 'component/common/PremiumFeature/PremiumFeature';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
export const Settings = () => { export const Settings = () => {
const projectId = useRequiredPathParam('projectId'); const projectId = useRequiredPathParam('projectId');
const projectName = useProjectNameOrId(projectId); const projectName = useProjectNameOrId(projectId);
const { hasAccess } = useContext(AccessContext); const { hasAccess } = useContext(AccessContext);
const { isOss } = useUiConfig();
usePageTitle(`Project configuration ${projectName}`); usePageTitle(`Project configuration ${projectName}`);
if (isOss()) {
return (
<PageContent
header={<PageHeader title="Access" />}
sx={{ justifyContent: 'center' }}
>
<PremiumFeature feature="project-settings" />
</PageContent>
);
}
if (!hasAccess(UPDATE_PROJECT, projectId)) { if (!hasAccess(UPDATE_PROJECT, projectId)) {
return ( return (
<PageContent header={<PageHeader title="Access" />}> <PageContent header={<PageHeader title="Access" />}>