1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

chore: remove newProjectLayout flag (#4536)

This commit is contained in:
Jaanus Sellin 2023-08-21 13:55:04 +03:00 committed by GitHub
parent 2cfb99c768
commit 6cefb6021e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 50 additions and 153 deletions

View File

@ -94,11 +94,10 @@ const CreateFeature = () => {
navigate(GO_BACK);
};
const featureLimitReached =
isFeatureLimitReached(
projectInfo.featureLimit,
projectInfo.features.length
) && Boolean(uiConfig.flags.newProjectLayout);
const featureLimitReached = isFeatureLimitReached(
projectInfo.featureLimit,
projectInfo.features.length
);
return (
<FormTemplate
loading={loading}

View File

@ -194,49 +194,6 @@ export const Project = () => {
</PermissionIconButton>
}
/>
<ConditionallyRender
condition={
!isOss() &&
!Boolean(uiConfig.flags.newProjectLayout)
}
show={
<PermissionIconButton
permission={UPDATE_PROJECT}
projectId={projectId}
onClick={() =>
navigate(
`/projects/${projectId}/edit`
)
}
tooltipProps={{ title: 'Edit project' }}
data-loading
data-testid={NAVIGATE_TO_EDIT_PROJECT}
>
<Edit />
</PermissionIconButton>
}
/>
<ConditionallyRender
condition={
!isOss() &&
!Boolean(uiConfig.flags.newProjectLayout)
}
show={
<PermissionIconButton
permission={DELETE_PROJECT}
projectId={projectId}
onClick={() => {
setShowDelDialog(true);
}}
tooltipProps={{
title: 'Delete project',
}}
data-loading
>
<Delete />
</PermissionIconButton>
}
/>
</StyledDiv>
</StyledTopRow>
</StyledInnerContainer>

View File

@ -8,7 +8,6 @@ import { Box, styled, TextField } from '@mui/material';
import { CollaborationModeTooltip } from './CollaborationModeTooltip';
import Input from 'component/common/Input/Input';
import { FeatureTogglesLimitTooltip } from './FeatureTogglesLimitTooltip';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
interface IProjectForm {
projectId: string;
@ -107,7 +106,6 @@ const ProjectForm: React.FC<IProjectForm> = ({
validateProjectId,
clearErrors,
}) => {
const { uiConfig } = useUiConfig();
return (
<StyledForm onSubmit={handleSubmit}>
<StyledContainer>
@ -199,50 +197,42 @@ const ProjectForm: React.FC<IProjectForm> = ({
]}
></StyledSelect>
</>
<ConditionallyRender
condition={Boolean(uiConfig.flags.newProjectLayout)}
show={
<>
<Box
sx={{
display: 'flex',
alignItems: 'center',
marginBottom: 1,
gap: 1,
}}
>
<p>Feature toggles limit?</p>
<FeatureTogglesLimitTooltip />
</Box>
<StyledSubtitle>
Leave it empty if you dont want to add a limit
</StyledSubtitle>
<StyledInputContainer>
<StyledInput
label={'Limit'}
name="value"
type={'number'}
value={featureLimit}
onChange={e =>
setFeatureLimit(e.target.value)
}
/>
<ConditionallyRender
condition={
featureCount !== undefined &&
Boolean(featureLimit)
}
show={
<Box>
({featureCount} of {featureLimit}{' '}
used)
</Box>
}
/>
</StyledInputContainer>
</>
}
/>
<>
<Box
sx={{
display: 'flex',
alignItems: 'center',
marginBottom: 1,
gap: 1,
}}
>
<p>Feature toggles limit?</p>
<FeatureTogglesLimitTooltip />
</Box>
<StyledSubtitle>
Leave it empty if you dont want to add a limit
</StyledSubtitle>
<StyledInputContainer>
<StyledInput
label={'Limit'}
name="value"
type={'number'}
value={featureLimit}
onChange={e => setFeatureLimit(e.target.value)}
/>
<ConditionallyRender
condition={
featureCount !== undefined &&
Boolean(featureLimit)
}
show={
<Box>
({featureCount} of {featureLimit} used)
</Box>
}
/>
</StyledInputContainer>
</>
</StyledContainer>
<StyledButtonContainer>{children}</StyledButtonContainer>
</StyledForm>

View File

@ -25,14 +25,10 @@ export const ProjectSettings = () => {
const updatedNavigation = uiConfig.flags?.frontendNavigationUpdate;
const tabs: ITab[] = [
...(uiConfig.flags.newProjectLayout
? [
{
id: '',
label: 'Settings',
},
]
: []),
{
id: '',
label: 'Settings',
},
{
id: 'environments',
label: 'Environments',
@ -84,9 +80,7 @@ export const ProjectSettings = () => {
onChange={onChange}
>
<Routes>
{uiConfig.flags.newProjectLayout ? (
<Route path="/*" element={<Settings />} />
) : null}
<Route path="/*" element={<Settings />} />
<Route
path="environments/*"
element={<ProjectEnvironmentList />}

View File

@ -22,7 +22,6 @@ import {
StyledBox,
StyledH2Title,
StyledEditIcon,
StyledDeleteIcon,
StyledProjectIcon,
StyledDivInfo,
StyledDivInfoContainer,
@ -49,7 +48,7 @@ export const ProjectCard = ({
isFavorite = false,
}: IProjectCardProps) => {
const { hasAccess } = useContext(AccessContext);
const { isOss, uiConfig } = useUiConfig();
const { isOss } = useUiConfig();
const [anchorEl, setAnchorEl] = useState<Element | null>(null);
const [showDelDialog, setShowDelDialog] = useState(false);
const navigate = useNavigate();
@ -61,9 +60,6 @@ export const ProjectCard = ({
setAnchorEl(event.currentTarget);
};
const canDeleteProject =
hasAccess(DELETE_PROJECT, id) && id !== DEFAULT_PROJECT_ID;
const onFavorite = async (e: React.SyntheticEvent) => {
e.preventDefault();
if (isFavorite) {
@ -117,34 +113,12 @@ export const ProjectCard = ({
<MenuItem
onClick={e => {
e.preventDefault();
navigate(
getProjectEditPath(
id,
Boolean(uiConfig.flags.newProjectLayout)
)
);
navigate(getProjectEditPath(id));
}}
>
<StyledEditIcon />
Edit project
</MenuItem>
<ConditionallyRender
condition={!Boolean(uiConfig.flags.newProjectLayout)}
show={
<MenuItem
onClick={e => {
e.preventDefault();
setShowDelDialog(true);
}}
disabled={!canDeleteProject}
>
<StyledDeleteIcon />
{id === DEFAULT_PROJECT_ID && !canDeleteProject
? "You can't delete the default project"
: 'Delete project'}
</MenuItem>
}
/>
</Menu>
</StyledDivHeader>
<div data-loading>

View File

@ -52,7 +52,6 @@ export interface IFlags {
advancedPlayground?: boolean;
customRootRolesKillSwitch?: boolean;
strategyVariant?: boolean;
newProjectLayout?: boolean;
configurableFeatureTypeLifetimes?: boolean;
frontendNavigationUpdate?: boolean;
segmentChangeRequests?: boolean;

View File

@ -23,11 +23,6 @@ export const getCreateTogglePath = (
return path;
};
export const getProjectEditPath = (
projectId: string,
newProjectPath: boolean
) => {
return newProjectPath
? `/projects/${projectId}/settings`
: `/projects/${projectId}/edit`;
export const getProjectEditPath = (projectId: string) => {
return `/projects/${projectId}/settings`;
};

View File

@ -94,7 +94,6 @@ exports[`should create default config 1`] = `
},
},
"migrationLock": true,
"newProjectLayout": false,
"personalAccessTokensKillSwitch": false,
"proPlanAutoCharge": false,
"responseTimeWithAppNameKillSwitch": false,
@ -132,7 +131,6 @@ exports[`should create default config 1`] = `
},
},
"migrationLock": true,
"newProjectLayout": false,
"personalAccessTokensKillSwitch": false,
"proPlanAutoCharge": false,
"responseTimeWithAppNameKillSwitch": false,

View File

@ -1018,10 +1018,7 @@ class FeatureToggleService {
await this.validateName(value.name);
const exists = await this.projectStore.hasProject(projectId);
if (
this.flagResolver.isEnabled('newProjectLayout') &&
(await this.projectStore.isFeatureLimitReached(projectId))
) {
if (await this.projectStore.isFeatureLimitReached(projectId)) {
throw new InvalidOperationError(
'You have reached the maximum number of feature toggles for this project.',
);

View File

@ -21,7 +21,6 @@ export type IFlagKey =
| 'disableNotifications'
| 'advancedPlayground'
| 'strategyVariant'
| 'newProjectLayout'
| 'slackAppAddon'
| 'emitPotentiallyStaleEvents'
| 'configurableFeatureTypeLifetimes'
@ -99,10 +98,6 @@ const flags: IFlags = {
process.env.DISABLE_NOTIFICATIONS,
false,
),
newProjectLayout: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_NEW_PROJECT_LAYOUT,
false,
),
strategyVariant: parseEnvVarBoolean(
process.env.UNLEASH_STRATEGY_VARIANT,
false,

View File

@ -38,7 +38,6 @@ process.nextTick(async () => {
anonymiseEventLog: false,
responseTimeWithAppNameKillSwitch: false,
strategyVariant: true,
newProjectLayout: true,
emitPotentiallyStaleEvents: true,
slackAppAddon: true,
configurableFeatureTypeLifetimes: true,