1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-08-23 13:46:45 +02:00
Includes https://github.com/Unleash/unleash/pull/5317

---------

Co-authored-by: sjaanus <sellinjaanus@gmail.com>
This commit is contained in:
Nuno Góis 2023-11-10 11:40:45 +00:00 committed by GitHub
parent 4c02a377f6
commit 2787ec0e08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 16 deletions

View File

@ -184,8 +184,8 @@ const ProjectForm: React.FC<IProjectForm> = ({
}
/>
<ConditionallyRender
condition={mode === 'Edit' && Boolean(setFeatureLimit)}
show={
condition={mode === 'Edit'}
show={() => (
<>
<Box
sx={{
@ -202,17 +202,15 @@ const ProjectForm: React.FC<IProjectForm> = ({
Leave it empty if you dont want to add a limit
</StyledSubtitle>
<StyledInputContainer>
{featureLimit && setFeatureLimit && (
<StyledInput
label={'Limit'}
name='value'
type={'number'}
value={featureLimit}
onChange={(e) =>
setFeatureLimit(e.target.value)
}
/>
)}
<StyledInput
label={'Limit'}
name='value'
type={'number'}
value={featureLimit!}
onChange={(e) =>
setFeatureLimit!(e.target.value)
}
/>
<ConditionallyRender
condition={
featureCount !== undefined &&
@ -226,7 +224,7 @@ const ProjectForm: React.FC<IProjectForm> = ({
/>
</StyledInputContainer>
</>
}
)}
/>
<ConditionallyRender
condition={mode === 'Create' && isEnterprise()}

View File

@ -82,7 +82,7 @@ const useProjectForm = (
const getFeatureLimitAsNumber = () => {
if (featureLimit === '') {
return undefined;
return null;
}
return Number(featureLimit);
};

View File

@ -244,8 +244,9 @@ class ProjectStore implements IProjectStore {
const settingsRow = await this.db(SETTINGS_TABLE)
.insert({
project: project.id,
project_mode: project.mode,
default_stickiness: project.defaultStickiness,
feature_limit: project.featureLimit,
project_mode: project.mode,
})
.returning('*');
return this.mapRow({ ...row[0], ...settingsRow[0] });
@ -265,6 +266,7 @@ class ProjectStore implements IProjectStore {
await this.db(TABLE)
.where({ id: data.id })
.update(this.fieldToRow(data));
if (
data.defaultStickiness !== undefined ||
data.featureLimit !== undefined