feat: add feature flag to activate Links field creation (#5535)
Related issue: #3607
This commit is contained in:
@ -4,4 +4,5 @@ export type FeatureFlagKey =
|
||||
| 'IS_EVENT_OBJECT_ENABLED'
|
||||
| 'IS_AIRTABLE_INTEGRATION_ENABLED'
|
||||
| 'IS_POSTGRESQL_INTEGRATION_ENABLED'
|
||||
| 'IS_STRIPE_INTEGRATION_ENABLED';
|
||||
| 'IS_STRIPE_INTEGRATION_ENABLED'
|
||||
| 'IS_LINKS_FIELD_ENABLED';
|
||||
|
||||
@ -31,7 +31,9 @@ import { Section } from '@/ui/layout/section/components/Section';
|
||||
import { Breadcrumb } from '@/ui/navigation/bread-crumb/components/Breadcrumb';
|
||||
import { View } from '@/views/types/View';
|
||||
import { ViewType } from '@/views/types/ViewType';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
||||
|
||||
type SettingsDataModelNewFieldFormValues = z.infer<
|
||||
@ -109,6 +111,8 @@ export const SettingsObjectNewFieldStep2 = () => {
|
||||
const { createOneRelationMetadataItem: createOneRelationMetadata } =
|
||||
useCreateOneRelationMetadataItem();
|
||||
|
||||
const isLinksFieldEnabled = useIsFeatureEnabled('IS_LINKS_FIELD_ENABLED');
|
||||
|
||||
if (!activeObjectMetadataItem) return null;
|
||||
|
||||
const canSave =
|
||||
@ -263,16 +267,18 @@ export const SettingsObjectNewFieldStep2 = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const excludedFieldTypes: SettingsSupportedFieldType[] = [
|
||||
FieldMetadataType.Email,
|
||||
FieldMetadataType.FullName,
|
||||
FieldMetadataType.Link,
|
||||
FieldMetadataType.Links,
|
||||
FieldMetadataType.Numeric,
|
||||
FieldMetadataType.Probability,
|
||||
FieldMetadataType.Uuid,
|
||||
FieldMetadataType.Phone,
|
||||
];
|
||||
const excludedFieldTypes: SettingsSupportedFieldType[] = (
|
||||
[
|
||||
FieldMetadataType.Email,
|
||||
FieldMetadataType.FullName,
|
||||
FieldMetadataType.Link,
|
||||
isLinksFieldEnabled ? undefined : FieldMetadataType.Links,
|
||||
FieldMetadataType.Numeric,
|
||||
FieldMetadataType.Probability,
|
||||
FieldMetadataType.Uuid,
|
||||
FieldMetadataType.Phone,
|
||||
] as const
|
||||
).filter(isDefined);
|
||||
|
||||
return (
|
||||
// eslint-disable-next-line react/jsx-props-no-spreading
|
||||
|
||||
@ -50,6 +50,12 @@ export const mockDefaultWorkspace: Workspace = {
|
||||
value: true,
|
||||
workspaceId: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6w',
|
||||
},
|
||||
{
|
||||
id: '1492de61-5018-4368-8923-4f1eeaf988c7',
|
||||
key: 'IS_LINKS_FIELD_ENABLED',
|
||||
value: true,
|
||||
workspaceId: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6w',
|
||||
},
|
||||
],
|
||||
createdAt: '2023-04-26T10:23:42.33625+00:00',
|
||||
updatedAt: '2023-04-26T10:23:42.33625+00:00',
|
||||
|
||||
Reference in New Issue
Block a user