Remove flag relation select (#3588)

* Remove feature flag on relation and select

* Move packages back to twenty-server to enable smaller build without using nx

* Fix package.json
This commit is contained in:
Charles Bochet 2024-01-23 09:59:00 +01:00 committed by GitHub
parent 6aad59d0be
commit a7265fa3b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 172 additions and 135 deletions

11
nx.json
View File

@ -2,9 +2,7 @@
"targetDefaults": {
"build": {
"cache": true,
"dependsOn": [
"^build"
]
"dependsOn": ["^build"]
},
"lint": {
"cache": true
@ -17,11 +15,7 @@
},
"@nx/jest:jest": {
"cache": true,
"inputs": [
"default",
"^default",
"{workspaceRoot}/jest.preset.js"
],
"inputs": ["default", "^default", "{workspaceRoot}/jest.preset.js"],
"options": {
"passWithNoTests": true
},
@ -40,4 +34,3 @@
"defaultBase": "main"
}
}

View File

@ -8,9 +8,11 @@ COPY ./.yarnrc.yml .
COPY ./.yarn/releases /app/.yarn/releases
COPY ./tools/eslint-rules /app/tools/eslint-rules
COPY ./packages/twenty-server /app/packages/twenty-server
RUN yarn
RUN yarn nx build twenty-server
WORKDIR /app/packages/twenty-server
RUN yarn workspaces focus
RUN yarn build
WORKDIR /app/packages/twenty-server

View File

@ -6,7 +6,6 @@ import { useFavorites } from '@/favorites/hooks/useFavorites';
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
import { formatFieldMetadataItemAsColumnDefinition } from '@/object-metadata/utils/formatFieldMetadataItemAsColumnDefinition';
import { isObjectMetadataAvailableForRelation } from '@/object-metadata/utils/isObjectMetadataAvailableForRelation';
import { parseFieldRelationType } from '@/object-metadata/utils/parseFieldRelationType';
import { parseFieldType } from '@/object-metadata/utils/parseFieldType';
import {
FieldContext,
@ -33,7 +32,6 @@ import { ShowPageSummaryCard } from '@/ui/layout/show-page/components/ShowPageSu
import { ShowPageRecoilScopeContext } from '@/ui/layout/states/ShowPageRecoilScopeContext';
import { PageTitle } from '@/ui/utilities/page-title/PageTitle';
import { RecoilScope } from '@/ui/utilities/recoil-scope/components/RecoilScope';
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import {
FieldMetadataType,
FileFolder,
@ -145,10 +143,6 @@ export const RecordShowPage = () => {
});
};
const isRelationFieldCardEnabled = useIsFeatureEnabled(
'IS_RELATION_FIELD_CARD_ENABLED',
);
const availableFieldMetadataItems = objectMetadataItem.fields
.filter(
(fieldMetadataItem) =>
@ -161,9 +155,7 @@ export const RecordShowPage = () => {
const inlineFieldMetadataItems = availableFieldMetadataItems.filter(
(fieldMetadataItem) =>
fieldMetadataItem.type !== FieldMetadataType.Relation ||
(!isRelationFieldCardEnabled &&
parseFieldRelationType(fieldMetadataItem) === 'TO_ONE_OBJECT'),
fieldMetadataItem.type !== FieldMetadataType.Relation,
);
const relationFieldMetadataItems = availableFieldMetadataItems.filter(
@ -280,42 +272,40 @@ export const RecordShowPage = () => {
),
)}
</PropertyBox>
{isRelationFieldCardEnabled &&
relationFieldMetadataItems
.filter((item) => {
const relationObjectMetadataItem =
item.toRelationMetadata
? item.toRelationMetadata.fromObjectMetadata
: item.fromRelationMetadata?.toObjectMetadata;
{relationFieldMetadataItems
.filter((item) => {
const relationObjectMetadataItem = item.toRelationMetadata
? item.toRelationMetadata.fromObjectMetadata
: item.fromRelationMetadata?.toObjectMetadata;
if (!relationObjectMetadataItem) {
return false;
}
if (!relationObjectMetadataItem) {
return false;
}
return isObjectMetadataAvailableForRelation(
relationObjectMetadataItem,
);
})
.map((fieldMetadataItem, index) => (
<FieldContext.Provider
key={record.id + fieldMetadataItem.id}
value={{
entityId: record.id,
recoilScopeId: record.id + fieldMetadataItem.id,
isLabelIdentifier: false,
fieldDefinition:
formatFieldMetadataItemAsColumnDefinition({
field: fieldMetadataItem,
position: index,
objectMetadataItem,
}),
useUpdateRecord: useUpdateOneObjectRecordMutation,
hotkeyScope: InlineCellHotkeyScope.InlineCell,
}}
>
<RecordRelationFieldCardSection />
</FieldContext.Provider>
))}
return isObjectMetadataAvailableForRelation(
relationObjectMetadataItem,
);
})
.map((fieldMetadataItem, index) => (
<FieldContext.Provider
key={record.id + fieldMetadataItem.id}
value={{
entityId: record.id,
recoilScopeId: record.id + fieldMetadataItem.id,
isLabelIdentifier: false,
fieldDefinition:
formatFieldMetadataItemAsColumnDefinition({
field: fieldMetadataItem,
position: index,
objectMetadataItem,
}),
useUpdateRecord: useUpdateOneObjectRecordMutation,
hotkeyScope: InlineCellHotkeyScope.InlineCell,
}}
>
<RecordRelationFieldCardSection />
</FieldContext.Provider>
))}
</>
)}
</ShowPageLeftContainer>

View File

@ -1,7 +1,4 @@
export type FeatureFlagKey =
| 'IS_MESSAGING_ENABLED'
| 'IS_QUICK_ACTIONS_ENABLED'
| 'IS_RATING_FIELD_TYPE_ENABLED'
| 'IS_RELATION_FIELD_CARD_ENABLED'
| 'IS_RELATION_FIELD_TYPE_ENABLED'
| 'IS_SELECT_FIELD_TYPE_ENABLED';
| 'IS_RATING_FIELD_TYPE_ENABLED';

View File

@ -40,14 +40,6 @@ export const SettingsObjectNewFieldStep2 = () => {
findActiveObjectMetadataItemBySlug(objectSlug);
const { createMetadataField } = useFieldMetadataItem();
const isRelationFieldTypeEnabled = useIsFeatureEnabled(
'IS_RELATION_FIELD_TYPE_ENABLED',
);
const isSelectFieldTypeEnabled = useIsFeatureEnabled(
'IS_SELECT_FIELD_TYPE_ENABLED',
);
const isRatingFieldTypeEnabled = useIsFeatureEnabled(
'IS_RATING_FIELD_TYPE_ENABLED',
);
@ -272,14 +264,6 @@ export const SettingsObjectNewFieldStep2 = () => {
FieldMetadataType.Uuid,
];
if (!isRelationFieldTypeEnabled) {
excludedFieldTypes.push(FieldMetadataType.Relation);
}
if (!isSelectFieldTypeEnabled) {
excludedFieldTypes.push(FieldMetadataType.Select);
}
if (!isRatingFieldTypeEnabled) {
excludedFieldTypes.push(FieldMetadataType.Rating);
}

View File

@ -29,15 +29,7 @@ export const mockDefaultWorkspace: Workspace = {
logo: workspaceLogoUrl,
allowImpersonation: true,
subscriptionStatus: 'active',
featureFlags: [
{
id: '0eada9a3-ccf4-4fcc-b25c-0c5d746e0fac',
key: 'IS_RELATION_FIELD_TYPE_ENABLED',
value: true,
workspaceId: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
__typename: 'FeatureFlag',
},
],
featureFlags: [],
createdAt: '2023-04-26T10:23:42.33625+00:00',
updatedAt: '2023-04-26T10:23:42.33625+00:00',
};

View File

@ -34,11 +34,77 @@
"queue:work": "node dist/src/queue-worker"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.363.0",
"@aws-sdk/credential-providers": "^3.363.0",
"@graphql-yoga/nestjs": "patch:@graphql-yoga/nestjs@2.1.0#./patches/@graphql-yoga+nestjs+2.1.0.patch",
"@nestjs/apollo": "^11.0.5",
"@nestjs/axios": "^3.0.1",
"@nestjs/cli": "^9.0.0",
"@nestjs/common": "^9.0.0",
"@nestjs/config": "^2.3.2",
"@nestjs/core": "^9.0.0",
"@nestjs/graphql": "patch:@nestjs/graphql@12.0.8#./patches/@nestjs+graphql+12.0.8.patch",
"@nestjs/jwt": "^10.0.3",
"@nestjs/passport": "^9.0.3",
"@nestjs/platform-express": "^9.0.0",
"@nestjs/schematics": "^9.0.0",
"@nestjs/serve-static": "^3.0.0",
"@nestjs/terminus": "^9.2.2",
"@nestjs/testing": "^9.0.0",
"@nestjs/typeorm": "^10.0.0",
"@ptc-org/nestjs-query-core": "^4.2.0",
"@ptc-org/nestjs-query-graphql": "patch:@ptc-org/nestjs-query-graphql@4.2.0#./patches/@ptc-org+nestjs-query-graphql+4.2.0.patch",
"@ptc-org/nestjs-query-typeorm": "4.2.1-alpha.2",
"@react-email/components": "0.0.12",
"@react-email/render": "0.0.10",
"@sentry/node": "^7.66.0",
"@sentry/profiling-node": "^1.3.4",
"axios": "^1.6.2",
"bcrypt": "^5.1.1",
"bullmq": "^4.14.0",
"class-transformer": "^0.5.1",
"class-validator": "patch:class-validator@^0.14.0#./patches/class-validator+0.14.0.patch",
"twenty-emails": "workspace:*"
"date-fns": "^2.30.0",
"file-type": "16.5.4",
"googleapis": "105",
"graphql": "^16.8.1",
"graphql-fields": "^2.0.3",
"graphql-subscriptions": "2.0.0",
"graphql-tag": "^2.12.6",
"graphql-type-json": "^0.3.2",
"graphql-upload": "^13.0.0",
"graphql-yoga": "^4.0.4",
"lodash.camelcase": "^4.3.0",
"lodash.isempty": "^4.4.0",
"lodash.isobject": "^3.0.2",
"lodash.kebabcase": "^4.1.1",
"lodash.snakecase": "^4.1.1",
"lodash.upperfirst": "^4.3.1",
"mailparser": "^3.6.5",
"microdiff": "^1.3.2",
"nest-commander": "^3.12.0",
"nodemailer": "^6.9.8",
"openapi-types": "^12.1.3",
"passport": "^0.6.0",
"passport-google-oauth20": "^2.0.0",
"passport-jwt": "^4.0.1",
"passport-local": "^1.0.0",
"pg": "^8.11.3",
"pg-boss": "^9.0.3",
"react": "^18.2.0",
"rimraf": "^3.0.2",
"sharp": "^0.32.1",
"twenty-emails": "workspace:*",
"type-fest": "^4.1.0",
"typeorm": "^0.3.17"
},
"devDependencies": {
"@types/lodash.isempty": "^4.4.7",
"@types/lodash.isobject": "^3.0.7",
"@types/lodash.snakecase": "^4.1.7",
"@types/lodash.upperfirst": "^4.3.7",
"@types/react": "^18.2.39",
"jest": "29.7.0"
},
"engines": {
"node": "^18.17.1",

View File

@ -14,9 +14,7 @@ import { IDField } from '@ptc-org/nestjs-query-graphql';
import { Workspace } from 'src/core/workspace/workspace.entity';
export enum FeatureFlagKeys {
IsRelationFieldTypeEnabled = 'IS_RELATION_FIELD_TYPE_ENABLED',
IsMessagingEnabled = 'IS_MESSAGING_ENABLED',
IsSelectFieldTypeEnabled = 'IS_SELECT_FIELD_TYPE_ENABLED',
IsRatingFieldTypeEnabled = 'IS_RATING_FIELD_TYPE_ENABLED',
IsWorkspaceCleanable = 'IS_WORKSPACE_CLEANABLE',
}

View File

@ -15,26 +15,11 @@ export const seedFeatureFlags = async (
.into(`${schemaName}.${tableName}`, ['key', 'workspaceId', 'value'])
.orIgnore()
.values([
{
key: FeatureFlagKeys.IsRelationFieldTypeEnabled,
workspaceId: workspaceId,
value: true,
},
{
key: FeatureFlagKeys.IsSelectFieldTypeEnabled,
workspaceId: workspaceId,
value: true,
},
{
key: FeatureFlagKeys.IsRatingFieldTypeEnabled,
workspaceId: workspaceId,
value: false,
},
{
key: 'IS_RELATION_FIELD_CARD_ENABLED',
workspaceId: workspaceId,
value: false,
},
])
.execute();
};

View File

@ -15,21 +15,11 @@ export const seedFeatureFlags = async (
.into(`${schemaName}.${tableName}`, ['key', 'workspaceId', 'value'])
.orIgnore()
.values([
{
key: FeatureFlagKeys.IsRelationFieldTypeEnabled,
workspaceId: workspaceId,
value: true,
},
{
key: FeatureFlagKeys.IsMessagingEnabled,
workspaceId: workspaceId,
value: true,
},
{
key: FeatureFlagKeys.IsSelectFieldTypeEnabled,
workspaceId: workspaceId,
value: true,
},
{
key: FeatureFlagKeys.IsRatingFieldTypeEnabled,
workspaceId: workspaceId,
@ -40,11 +30,6 @@ export const seedFeatureFlags = async (
workspaceId: workspaceId,
value: true,
},
{
key: 'IS_RELATION_FIELD_CARD_ENABLED',
workspaceId: workspaceId,
value: true,
},
])
.execute();
};

View File

@ -1,17 +0,0 @@
import { PrismaClient, Prisma } from '@prisma/client';
import { camelCase } from 'src/utils/camel-case';
const prisma = new PrismaClient();
export default async () => {
const models = Prisma.dmmf.datamodel.models;
const modelNames = models.map((model) => model.name);
const entities = modelNames.map((modelName) => camelCase(modelName));
await prisma.$transaction(
entities.map((entity) => {
return prisma[entity].deleteMany();
}),
);
};

View File

@ -1,5 +1,3 @@
import resetDb from './reset-db';
global.beforeEach(() => {
// resetDb();
});

View File

@ -42383,11 +42383,75 @@ __metadata:
version: 0.0.0-use.local
resolution: "twenty-server@workspace:packages/twenty-server"
dependencies:
"@aws-sdk/client-s3": "npm:^3.363.0"
"@aws-sdk/credential-providers": "npm:^3.363.0"
"@graphql-yoga/nestjs": "patch:@graphql-yoga/nestjs@2.1.0#./patches/@graphql-yoga+nestjs+2.1.0.patch"
"@nestjs/apollo": "npm:^11.0.5"
"@nestjs/axios": "npm:^3.0.1"
"@nestjs/cli": "npm:^9.0.0"
"@nestjs/common": "npm:^9.0.0"
"@nestjs/config": "npm:^2.3.2"
"@nestjs/core": "npm:^9.0.0"
"@nestjs/graphql": "patch:@nestjs/graphql@12.0.8#./patches/@nestjs+graphql+12.0.8.patch"
"@nestjs/jwt": "npm:^10.0.3"
"@nestjs/passport": "npm:^9.0.3"
"@nestjs/platform-express": "npm:^9.0.0"
"@nestjs/schematics": "npm:^9.0.0"
"@nestjs/serve-static": "npm:^3.0.0"
"@nestjs/terminus": "npm:^9.2.2"
"@nestjs/testing": "npm:^9.0.0"
"@nestjs/typeorm": "npm:^10.0.0"
"@ptc-org/nestjs-query-core": "npm:^4.2.0"
"@ptc-org/nestjs-query-graphql": "patch:@ptc-org/nestjs-query-graphql@4.2.0#./patches/@ptc-org+nestjs-query-graphql+4.2.0.patch"
"@ptc-org/nestjs-query-typeorm": "npm:4.2.1-alpha.2"
"@react-email/components": "npm:0.0.12"
"@react-email/render": "npm:0.0.10"
"@sentry/node": "npm:^7.66.0"
"@sentry/profiling-node": "npm:^1.3.4"
"@types/lodash.isempty": "npm:^4.4.7"
"@types/lodash.isobject": "npm:^3.0.7"
"@types/lodash.snakecase": "npm:^4.1.7"
"@types/lodash.upperfirst": "npm:^4.3.7"
"@types/react": "npm:^18.2.39"
axios: "npm:^1.6.2"
bcrypt: "npm:^5.1.1"
bullmq: "npm:^4.14.0"
class-transformer: "npm:^0.5.1"
class-validator: "patch:class-validator@^0.14.0#./patches/class-validator+0.14.0.patch"
date-fns: "npm:^2.30.0"
file-type: "npm:16.5.4"
googleapis: "npm:105"
graphql: "npm:^16.8.1"
graphql-fields: "npm:^2.0.3"
graphql-subscriptions: "npm:2.0.0"
graphql-tag: "npm:^2.12.6"
graphql-type-json: "npm:^0.3.2"
graphql-upload: "npm:^13.0.0"
graphql-yoga: "npm:^4.0.4"
jest: "npm:29.7.0"
lodash.camelcase: "npm:^4.3.0"
lodash.isempty: "npm:^4.4.0"
lodash.isobject: "npm:^3.0.2"
lodash.kebabcase: "npm:^4.1.1"
lodash.snakecase: "npm:^4.1.1"
lodash.upperfirst: "npm:^4.3.1"
mailparser: "npm:^3.6.5"
microdiff: "npm:^1.3.2"
nest-commander: "npm:^3.12.0"
nodemailer: "npm:^6.9.8"
openapi-types: "npm:^12.1.3"
passport: "npm:^0.6.0"
passport-google-oauth20: "npm:^2.0.0"
passport-jwt: "npm:^4.0.1"
passport-local: "npm:^1.0.0"
pg: "npm:^8.11.3"
pg-boss: "npm:^9.0.3"
react: "npm:^18.2.0"
rimraf: "npm:^3.0.2"
sharp: "npm:^0.32.1"
twenty-emails: "workspace:*"
type-fest: "npm:^4.1.0"
typeorm: "npm:^0.3.17"
languageName: unknown
linkType: soft