1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01: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 React from 'react';
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 { useOptionalPathParam } from '../../../../../hooks/useOptionalPathParam';
import { useOptionalPathParam } from 'hooks/useOptionalPathParam';
interface IProjectSelectorProps {
type: string;

View File

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

View File

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

View File

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

View File

@ -8,13 +8,27 @@ import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
import { usePageTitle } from 'hooks/usePageTitle';
import { useProjectNameOrId } from 'hooks/api/getters/useProject/useProject';
import EditProject from './EditProject';
import { PremiumFeature } from 'component/common/PremiumFeature/PremiumFeature';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
export const Settings = () => {
const projectId = useRequiredPathParam('projectId');
const projectName = useProjectNameOrId(projectId);
const { hasAccess } = useContext(AccessContext);
const { isOss } = useUiConfig();
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)) {
return (
<PageContent header={<PageHeader title="Access" />}>