removing feature flag IS_MORPH_RELATION_ENABLED (#15783)
releasing the morph feature for all workspaces
This commit is contained in:
+13
-46
@@ -11,18 +11,14 @@ import { useRelationSettingsFormInitialTargetObjectMetadatas } from '@/settings/
|
||||
|
||||
import { useFieldMetadataItemById } from '@/object-metadata/hooks/useFieldMetadataItemById';
|
||||
|
||||
import { useFilteredObjectMetadataItems } from '@/object-metadata/hooks/useFilteredObjectMetadataItems';
|
||||
import { isObjectMetadataAvailableForRelation } from '@/object-metadata/utils/isObjectMetadataAvailableForRelation';
|
||||
import { IconPicker } from '@/ui/input/components/IconPicker';
|
||||
import { Select } from '@/ui/input/components/Select';
|
||||
import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';
|
||||
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import styled from '@emotion/styled';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { useIcons } from 'twenty-ui/display';
|
||||
import { FeatureFlagKey, RelationType } from '~/generated-metadata/graphql';
|
||||
import { RelationType } from '~/generated-metadata/graphql';
|
||||
|
||||
const StyledSelectsContainer = styled.div<{ isMobile: boolean }>`
|
||||
display: grid;
|
||||
@@ -77,7 +73,7 @@ export const SettingsDataModelFieldRelationForm = ({
|
||||
const { t } = useLingui();
|
||||
const { control } =
|
||||
useFormContext<SettingsDataModelFieldMorphRelationFormValues>();
|
||||
const { getIcon } = useIcons();
|
||||
|
||||
const { fieldMetadataItem: existingFieldMetadataItem } =
|
||||
useFieldMetadataItemById(existingFieldMetadataId);
|
||||
|
||||
@@ -108,12 +104,6 @@ export const SettingsDataModelFieldRelationForm = ({
|
||||
);
|
||||
const isMobile = useIsMobile();
|
||||
|
||||
const isMorphRelationEnabled = useIsFeatureEnabled(
|
||||
FeatureFlagKey.IS_MORPH_RELATION_ENABLED,
|
||||
);
|
||||
|
||||
const { activeObjectMetadataItems } = useFilteredObjectMetadataItems();
|
||||
|
||||
return (
|
||||
<StyledContainer>
|
||||
<StyledSelectsContainer isMobile={isMobile}>
|
||||
@@ -138,40 +128,17 @@ export const SettingsDataModelFieldRelationForm = ({
|
||||
name="morphRelationObjectMetadataIds"
|
||||
control={control}
|
||||
defaultValue={initialMorphRelationsObjectMetadataIds}
|
||||
render={({ field: { onChange, value } }) =>
|
||||
isMorphRelationEnabled ? (
|
||||
<SettingsMorphRelationMultiSelect
|
||||
label={t`Object destination`}
|
||||
dropdownId="object-destination-select"
|
||||
fullWidth
|
||||
disabled={disableRelationEdition}
|
||||
selectedObjectMetadataIds={value}
|
||||
withSearchInput={true}
|
||||
onChange={onChange}
|
||||
/>
|
||||
) : (
|
||||
<Select
|
||||
label={t`Object destination`}
|
||||
dropdownId="object-destination-select"
|
||||
fullWidth
|
||||
disabled={disableRelationEdition}
|
||||
value={value[0]}
|
||||
options={activeObjectMetadataItems
|
||||
.filter(isObjectMetadataAvailableForRelation)
|
||||
.sort((item1, item2) =>
|
||||
item1.labelSingular.localeCompare(item2.labelSingular),
|
||||
)
|
||||
.map((objectMetadataItem) => ({
|
||||
label: objectMetadataItem.labelPlural,
|
||||
value: objectMetadataItem.id,
|
||||
Icon: getIcon(objectMetadataItem.icon),
|
||||
}))}
|
||||
onChange={(value) => {
|
||||
onChange([value]);
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
render={({ field: { onChange, value } }) => (
|
||||
<SettingsMorphRelationMultiSelect
|
||||
label={t`Object destination`}
|
||||
dropdownId="object-destination-select"
|
||||
fullWidth
|
||||
disabled={disableRelationEdition}
|
||||
selectedObjectMetadataIds={value}
|
||||
withSearchInput={true}
|
||||
onChange={onChange}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</StyledSelectsContainer>
|
||||
<StyledInputsLabel>{t`Field on destination`}</StyledInputsLabel>
|
||||
|
||||
Reference in New Issue
Block a user