1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-31 13:47:02 +02: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); navigate(GO_BACK);
}; };
const featureLimitReached = const featureLimitReached = isFeatureLimitReached(
isFeatureLimitReached( projectInfo.featureLimit,
projectInfo.featureLimit, projectInfo.features.length
projectInfo.features.length );
) && Boolean(uiConfig.flags.newProjectLayout);
return ( return (
<FormTemplate <FormTemplate
loading={loading} loading={loading}

View File

@ -194,49 +194,6 @@ export const Project = () => {
</PermissionIconButton> </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> </StyledDiv>
</StyledTopRow> </StyledTopRow>
</StyledInnerContainer> </StyledInnerContainer>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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