1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-01 01:18:10 +02:00

fix: add checks to remove warnings on project settings (#5766)

This PR removes warning on the project settings by always making sure we
have the project before rendering the settings and do a conditional
check on the featureLimit number field.
This commit is contained in:
Fredrik Strand Oseberg 2024-01-05 09:23:12 +01:00 committed by GitHub
parent 769146fbd3
commit 46ecce49a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 2 deletions

View File

@ -12,6 +12,7 @@
"start": "vite",
"start:prod": "vite build && vite preview",
"start:sandbox": "UNLEASH_API=https://sandbox.getunleash.io/ospro yarn run start",
"start:sandbox:enterprise": "UNLEASH_API=https://sandbox.getunleash.io/ VITE_TEST_REDIRECT=true UNLEASH_BASE_PATH=/enterprise/ yarn run start",
"start:demo2": "UNLEASH_API=https://sandbox.getunleash.io/ UNLEASH_BASE_PATH=/demo2/ yarn run start",
"start:enterprise": "UNLEASH_API=https://unleash.herokuapp.com VITE_TEST_REDIRECT=true yarn run start",
"start:demo": "UNLEASH_BASE_PATH=/demo/ UNLEASH_API=https://app.unleash-hosted.com/ yarn run start",

View File

@ -111,7 +111,7 @@ const StyledButtons = styled('div')(({ theme }) => ({
padding: theme.spacing(3),
paddingRight: theme.spacing(6),
paddingLeft: theme.spacing(6),
backgroundColor: theme.palette.common.white,
backgroundColor: theme.palette.background.paper,
justifyContent: 'end',
borderTop: `1px solid ${theme.palette.divider}`,
}));

View File

@ -200,7 +200,12 @@ const ProjectForm: React.FC<IProjectForm> = ({
label={'Limit'}
name='value'
type={'number'}
value={featureLimit!}
value={
featureLimit === 'null' ||
featureLimit === undefined
? ''
: featureLimit
}
onChange={(e) =>
setFeatureLimit!(e.target.value)
}

View File

@ -22,6 +22,10 @@ const EditProject = () => {
const id = useRequiredPathParam('projectId');
const { project } = useProject(id);
if (!project.name) {
return null;
}
const accessDeniedAlert = !hasAccess(UPDATE_PROJECT, id) && (
<Alert severity='error' sx={{ mb: 4 }}>
You do not have the required permissions to edit this project.

View File

@ -14,6 +14,12 @@ const fallbackProject: IProject = {
favorite: false,
mode: 'open',
defaultStickiness: 'default',
featureLimit: 0,
featureNaming: {
description: 'asd',
example: 'A',
pattern: '[A-z]',
},
stats: {
archivedCurrentWindow: 0,
archivedPastWindow: 0,