feat: Add feature flags to Select & Rating custom fields (#3037)

* Add feature flag key for select and rating

* Use feature flag boolean to decide if select & rating are enabled

* Enable select and rating in demo & core
This commit is contained in:
Deepak Kumar
2023-12-18 13:08:25 +05:30
committed by GitHub
parent 65f05ff43a
commit 2507da1b25
4 changed files with 39 additions and 3 deletions

View File

@ -1,4 +1,6 @@
export type FeatureFlagKey =
| 'IS_MESSAGING_ENABLED'
| 'IS_NOTE_CREATE_IMAGES_ENABLED'
| 'IS_RELATION_FIELD_TYPE_ENABLED';
| 'IS_RELATION_FIELD_TYPE_ENABLED'
| 'IS_SELECT_FIELD_TYPE_ENABLED'
| 'IS_RATING_FIELD_TYPE_ENABLED';

View File

@ -42,6 +42,14 @@ export const SettingsObjectNewFieldStep2 = () => {
'IS_RELATION_FIELD_TYPE_ENABLED',
);
const isSelectFieldTypeEnabled = useIsFeatureEnabled(
'IS_SELECT_FIELD_TYPE_ENABLED',
);
const isRatingFieldTypeEnabled = useIsFeatureEnabled(
'IS_RATING_FIELD_TYPE_ENABLED',
);
const {
formValues,
handleFormChange,
@ -256,8 +264,6 @@ export const SettingsObjectNewFieldStep2 = () => {
FieldMetadataType.Numeric,
FieldMetadataType.Phone,
FieldMetadataType.Probability,
FieldMetadataType.Rating,
FieldMetadataType.Select,
FieldMetadataType.Uuid,
];
@ -265,6 +271,14 @@ export const SettingsObjectNewFieldStep2 = () => {
excludedFieldTypes.push(FieldMetadataType.Relation);
}
if (!isSelectFieldTypeEnabled) {
excludedFieldTypes.push(FieldMetadataType.Select);
}
if (!isRatingFieldTypeEnabled) {
excludedFieldTypes.push(FieldMetadataType.Rating);
}
return (
<SubMenuTopBarContainer Icon={IconSettings} title="Settings">
<SettingsPageContainer>

View File

@ -18,6 +18,16 @@ export const seedFeatureFlags = async (
workspaceId: workspaceId,
value: true,
},
{
key: 'IS_SELECT_FIELD_TYPE_ENABLED',
workspaceId: workspaceId,
value: true,
},
{
key: 'IS_RATING_FIELD_TYPE_ENABLED',
workspaceId: workspaceId,
value: true,
},
])
.execute();
};

View File

@ -28,6 +28,16 @@ export const seedFeatureFlags = async (
workspaceId: workspaceId,
value: true,
},
{
key: 'IS_SELECT_FIELD_TYPE_ENABLED',
workspaceId: workspaceId,
value: true,
},
{
key: 'IS_RATING_FIELD_TYPE_ENABLED',
workspaceId: workspaceId,
value: true,
},
])
.execute();
};