diff --git a/packages/twenty-front/src/generated-metadata/gql.ts b/packages/twenty-front/src/generated-metadata/gql.ts index dfdadbd8f124..9b22fef87b88 100644 --- a/packages/twenty-front/src/generated-metadata/gql.ts +++ b/packages/twenty-front/src/generated-metadata/gql.ts @@ -13,9 +13,12 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/ * Therefore it is highly recommended to use the babel or swc plugin for production. */ const documents = { - "\n mutation createServer($input: CreateRemoteServerInput!) {\n createOneRemoteServer(input: $input) {\n id\n foreignDataWrapperId\n foreignDataWrapperOptions\n foreignDataWrapperType\n }\n }\n": types.CreateServerDocument, + "\n fragment RemoteServerFields on RemoteServer {\n id\n createdAt\n foreignDataWrapperId\n foreignDataWrapperOptions\n foreignDataWrapperType\n updatedAt\n }\n": types.RemoteServerFieldsFragmentDoc, + "\n \n mutation createServer($input: CreateRemoteServerInput!) {\n createOneRemoteServer(input: $input) {\n ...RemoteServerFields\n }\n }\n": types.CreateServerDocument, "\n mutation deleteServer($input: RemoteServerIdInput!) {\n deleteOneRemoteServer(input: $input) {\n id\n }\n }\n": types.DeleteServerDocument, - "\n query GetManyDatabaseConnections($input: RemoteServerTypeInput!) {\n findManyRemoteServersByType(input: $input) {\n id\n createdAt\n foreignDataWrapperId\n foreignDataWrapperOptions\n foreignDataWrapperType\n updatedAt\n }\n }\n": types.GetManyDatabaseConnectionsDocument, + "\n query GetManyDatabaseConnectionTables($input: RemoteServerIdInput!) {\n findAvailableRemoteTablesByServerId(input: $input) {\n name\n schema\n status\n }\n }\n": types.GetManyDatabaseConnectionTablesDocument, + "\n \n query GetManyDatabaseConnections($input: RemoteServerTypeInput!) {\n findManyRemoteServersByType(input: $input) {\n ...RemoteServerFields\n }\n }\n": types.GetManyDatabaseConnectionsDocument, + "\n \n query GetOneDatabaseConnection($input: RemoteServerIdInput!) {\n findOneRemoteServerById(input: $input) {\n ...RemoteServerFields\n }\n }\n": types.GetOneDatabaseConnectionDocument, "\n mutation CreateOneObjectMetadataItem($input: CreateOneObjectInput!) {\n createOneObject(input: $input) {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n createdAt\n updatedAt\n labelIdentifierFieldMetadataId\n imageIdentifierFieldMetadataId\n }\n }\n": types.CreateOneObjectMetadataItemDocument, "\n mutation CreateOneFieldMetadataItem($input: CreateOneFieldMetadataInput!) {\n createOneField(input: $input) {\n id\n type\n name\n label\n description\n icon\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n defaultValue\n options\n }\n }\n": types.CreateOneFieldMetadataItemDocument, "\n mutation CreateOneRelationMetadata($input: CreateOneRelationInput!) {\n createOneRelation(input: $input) {\n id\n relationType\n fromObjectMetadataId\n toObjectMetadataId\n fromFieldMetadataId\n toFieldMetadataId\n createdAt\n updatedAt\n }\n }\n": types.CreateOneRelationMetadataDocument, @@ -43,7 +46,11 @@ export function graphql(source: string): unknown; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n mutation createServer($input: CreateRemoteServerInput!) {\n createOneRemoteServer(input: $input) {\n id\n foreignDataWrapperId\n foreignDataWrapperOptions\n foreignDataWrapperType\n }\n }\n"): (typeof documents)["\n mutation createServer($input: CreateRemoteServerInput!) {\n createOneRemoteServer(input: $input) {\n id\n foreignDataWrapperId\n foreignDataWrapperOptions\n foreignDataWrapperType\n }\n }\n"]; +export function graphql(source: "\n fragment RemoteServerFields on RemoteServer {\n id\n createdAt\n foreignDataWrapperId\n foreignDataWrapperOptions\n foreignDataWrapperType\n updatedAt\n }\n"): (typeof documents)["\n fragment RemoteServerFields on RemoteServer {\n id\n createdAt\n foreignDataWrapperId\n foreignDataWrapperOptions\n foreignDataWrapperType\n updatedAt\n }\n"]; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql(source: "\n \n mutation createServer($input: CreateRemoteServerInput!) {\n createOneRemoteServer(input: $input) {\n ...RemoteServerFields\n }\n }\n"): (typeof documents)["\n \n mutation createServer($input: CreateRemoteServerInput!) {\n createOneRemoteServer(input: $input) {\n ...RemoteServerFields\n }\n }\n"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -51,7 +58,15 @@ export function graphql(source: "\n mutation deleteServer($input: RemoteServerI /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n query GetManyDatabaseConnections($input: RemoteServerTypeInput!) {\n findManyRemoteServersByType(input: $input) {\n id\n createdAt\n foreignDataWrapperId\n foreignDataWrapperOptions\n foreignDataWrapperType\n updatedAt\n }\n }\n"): (typeof documents)["\n query GetManyDatabaseConnections($input: RemoteServerTypeInput!) {\n findManyRemoteServersByType(input: $input) {\n id\n createdAt\n foreignDataWrapperId\n foreignDataWrapperOptions\n foreignDataWrapperType\n updatedAt\n }\n }\n"]; +export function graphql(source: "\n query GetManyDatabaseConnectionTables($input: RemoteServerIdInput!) {\n findAvailableRemoteTablesByServerId(input: $input) {\n name\n schema\n status\n }\n }\n"): (typeof documents)["\n query GetManyDatabaseConnectionTables($input: RemoteServerIdInput!) {\n findAvailableRemoteTablesByServerId(input: $input) {\n name\n schema\n status\n }\n }\n"]; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql(source: "\n \n query GetManyDatabaseConnections($input: RemoteServerTypeInput!) {\n findManyRemoteServersByType(input: $input) {\n ...RemoteServerFields\n }\n }\n"): (typeof documents)["\n \n query GetManyDatabaseConnections($input: RemoteServerTypeInput!) {\n findManyRemoteServersByType(input: $input) {\n ...RemoteServerFields\n }\n }\n"]; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql(source: "\n \n query GetOneDatabaseConnection($input: RemoteServerIdInput!) {\n findOneRemoteServerById(input: $input) {\n ...RemoteServerFields\n }\n }\n"): (typeof documents)["\n \n query GetOneDatabaseConnection($input: RemoteServerIdInput!) {\n findOneRemoteServerById(input: $input) {\n ...RemoteServerFields\n }\n }\n"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ diff --git a/packages/twenty-front/src/generated-metadata/graphql.ts b/packages/twenty-front/src/generated-metadata/graphql.ts index 24c52a1a1eeb..fb8a757309df 100644 --- a/packages/twenty-front/src/generated-metadata/graphql.ts +++ b/packages/twenty-front/src/generated-metadata/graphql.ts @@ -1190,12 +1190,14 @@ export type RelationEdge = { node: Relation; }; +export type RemoteServerFieldsFragment = { __typename?: 'RemoteServer', id: string, createdAt: any, foreignDataWrapperId: string, foreignDataWrapperOptions?: any | null, foreignDataWrapperType: string, updatedAt: any }; + export type CreateServerMutationVariables = Exact<{ input: CreateRemoteServerInput; }>; -export type CreateServerMutation = { __typename?: 'Mutation', createOneRemoteServer: { __typename?: 'RemoteServer', id: string, foreignDataWrapperId: string, foreignDataWrapperOptions?: any | null, foreignDataWrapperType: string } }; +export type CreateServerMutation = { __typename?: 'Mutation', createOneRemoteServer: { __typename?: 'RemoteServer', id: string, createdAt: any, foreignDataWrapperId: string, foreignDataWrapperOptions?: any | null, foreignDataWrapperType: string, updatedAt: any } }; export type DeleteServerMutationVariables = Exact<{ input: RemoteServerIdInput; @@ -1204,6 +1206,13 @@ export type DeleteServerMutationVariables = Exact<{ export type DeleteServerMutation = { __typename?: 'Mutation', deleteOneRemoteServer: { __typename?: 'RemoteServer', id: string } }; +export type GetManyDatabaseConnectionTablesQueryVariables = Exact<{ + input: RemoteServerIdInput; +}>; + + +export type GetManyDatabaseConnectionTablesQuery = { __typename?: 'Query', findAvailableRemoteTablesByServerId: Array<{ __typename?: 'RemoteTable', name: string, schema: string, status: RemoteTableStatus }> }; + export type GetManyDatabaseConnectionsQueryVariables = Exact<{ input: RemoteServerTypeInput; }>; @@ -1211,6 +1220,13 @@ export type GetManyDatabaseConnectionsQueryVariables = Exact<{ export type GetManyDatabaseConnectionsQuery = { __typename?: 'Query', findManyRemoteServersByType: Array<{ __typename?: 'RemoteServer', id: string, createdAt: any, foreignDataWrapperId: string, foreignDataWrapperOptions?: any | null, foreignDataWrapperType: string, updatedAt: any }> }; +export type GetOneDatabaseConnectionQueryVariables = Exact<{ + input: RemoteServerIdInput; +}>; + + +export type GetOneDatabaseConnectionQuery = { __typename?: 'Query', findOneRemoteServerById: { __typename?: 'RemoteServer', id: string, createdAt: any, foreignDataWrapperId: string, foreignDataWrapperOptions?: any | null, foreignDataWrapperType: string, updatedAt: any } }; + export type CreateOneObjectMetadataItemMutationVariables = Exact<{ input: CreateOneObjectInput; }>; @@ -1270,10 +1286,12 @@ export type ObjectMetadataItemsQueryVariables = Exact<{ export type ObjectMetadataItemsQuery = { __typename?: 'Query', objects: { __typename?: 'ObjectConnection', edges: Array<{ __typename?: 'objectEdge', node: { __typename?: 'object', id: string, dataSourceId: string, nameSingular: string, namePlural: string, labelSingular: string, labelPlural: string, description?: string | null, icon?: string | null, isCustom: boolean, isRemote: boolean, isActive: boolean, isSystem: boolean, createdAt: any, updatedAt: any, labelIdentifierFieldMetadataId?: string | null, imageIdentifierFieldMetadataId?: string | null, fields: { __typename?: 'ObjectFieldsConnection', edges: Array<{ __typename?: 'fieldEdge', node: { __typename?: 'field', id: string, type: FieldMetadataType, name: string, label: string, description?: string | null, icon?: string | null, isCustom?: boolean | null, isActive?: boolean | null, isSystem?: boolean | null, isNullable?: boolean | null, createdAt: any, updatedAt: any, defaultValue?: any | null, options?: any | null, fromRelationMetadata?: { __typename?: 'relation', id: string, relationType: RelationMetadataType, toFieldMetadataId: string, toObjectMetadata: { __typename?: 'object', id: string, dataSourceId: string, nameSingular: string, namePlural: string, isSystem: boolean } } | null, toRelationMetadata?: { __typename?: 'relation', id: string, relationType: RelationMetadataType, fromFieldMetadataId: string, fromObjectMetadata: { __typename?: 'object', id: string, dataSourceId: string, nameSingular: string, namePlural: string, isSystem: boolean } } | null, relationDefinition?: { __typename?: 'RelationDefinition', direction: RelationDefinitionType, sourceObjectMetadata: { __typename?: 'object', id: string, nameSingular: string, namePlural: string }, sourceFieldMetadata: { __typename?: 'field', id: string, name: string }, targetObjectMetadata: { __typename?: 'object', id: string, nameSingular: string, namePlural: string }, targetFieldMetadata: { __typename?: 'field', id: string, name: string } } | null } }>, pageInfo: { __typename?: 'PageInfo', hasNextPage?: boolean | null, hasPreviousPage?: boolean | null, startCursor?: any | null, endCursor?: any | null } } } }>, pageInfo: { __typename?: 'PageInfo', hasNextPage?: boolean | null, hasPreviousPage?: boolean | null, startCursor?: any | null, endCursor?: any | null } } }; - -export const CreateServerDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"createServer"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateRemoteServerInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createOneRemoteServer"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"foreignDataWrapperId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignDataWrapperOptions"}},{"kind":"Field","name":{"kind":"Name","value":"foreignDataWrapperType"}}]}}]}}]} as unknown as DocumentNode; +export const RemoteServerFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RemoteServerFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RemoteServer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"foreignDataWrapperId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignDataWrapperOptions"}},{"kind":"Field","name":{"kind":"Name","value":"foreignDataWrapperType"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode; +export const CreateServerDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"createServer"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateRemoteServerInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createOneRemoteServer"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RemoteServerFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RemoteServerFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RemoteServer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"foreignDataWrapperId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignDataWrapperOptions"}},{"kind":"Field","name":{"kind":"Name","value":"foreignDataWrapperType"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode; export const DeleteServerDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"deleteServer"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"RemoteServerIdInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteOneRemoteServer"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode; -export const GetManyDatabaseConnectionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetManyDatabaseConnections"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"RemoteServerTypeInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findManyRemoteServersByType"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"foreignDataWrapperId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignDataWrapperOptions"}},{"kind":"Field","name":{"kind":"Name","value":"foreignDataWrapperType"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]}}]} as unknown as DocumentNode; +export const GetManyDatabaseConnectionTablesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetManyDatabaseConnectionTables"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"RemoteServerIdInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findAvailableRemoteTablesByServerId"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"schema"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]}}]} as unknown as DocumentNode; +export const GetManyDatabaseConnectionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetManyDatabaseConnections"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"RemoteServerTypeInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findManyRemoteServersByType"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RemoteServerFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RemoteServerFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RemoteServer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"foreignDataWrapperId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignDataWrapperOptions"}},{"kind":"Field","name":{"kind":"Name","value":"foreignDataWrapperType"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode; +export const GetOneDatabaseConnectionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOneDatabaseConnection"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"RemoteServerIdInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findOneRemoteServerById"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"RemoteServerFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"RemoteServerFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RemoteServer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"foreignDataWrapperId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignDataWrapperOptions"}},{"kind":"Field","name":{"kind":"Name","value":"foreignDataWrapperType"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode; export const CreateOneObjectMetadataItemDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateOneObjectMetadataItem"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateOneObjectInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createOneObject"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"dataSourceId"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}},{"kind":"Field","name":{"kind":"Name","value":"labelSingular"}},{"kind":"Field","name":{"kind":"Name","value":"labelPlural"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"labelIdentifierFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"imageIdentifierFieldMetadataId"}}]}}]}}]} as unknown as DocumentNode; export const CreateOneFieldMetadataItemDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateOneFieldMetadataItem"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateOneFieldMetadataInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createOneField"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"isNullable"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"defaultValue"}},{"kind":"Field","name":{"kind":"Name","value":"options"}}]}}]}}]} as unknown as DocumentNode; export const CreateOneRelationMetadataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateOneRelationMetadata"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateOneRelationInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createOneRelation"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"relationType"}},{"kind":"Field","name":{"kind":"Name","value":"fromObjectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"toObjectMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"fromFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"toFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]}}]} as unknown as DocumentNode; diff --git a/packages/twenty-front/src/modules/databases/graphql/fragments/databaseConnectionFragment.ts b/packages/twenty-front/src/modules/databases/graphql/fragments/databaseConnectionFragment.ts new file mode 100644 index 000000000000..73b3c0c322a7 --- /dev/null +++ b/packages/twenty-front/src/modules/databases/graphql/fragments/databaseConnectionFragment.ts @@ -0,0 +1,12 @@ +import { gql } from '@apollo/client'; + +export const DATABASE_CONNECTION_FRAGMENT = gql` + fragment RemoteServerFields on RemoteServer { + id + createdAt + foreignDataWrapperId + foreignDataWrapperOptions + foreignDataWrapperType + updatedAt + } +`; diff --git a/packages/twenty-front/src/modules/databases/graphql/mutations/createOneDatabaseConnection.ts b/packages/twenty-front/src/modules/databases/graphql/mutations/createOneDatabaseConnection.ts index d64129e01510..4c77e0508eb3 100644 --- a/packages/twenty-front/src/modules/databases/graphql/mutations/createOneDatabaseConnection.ts +++ b/packages/twenty-front/src/modules/databases/graphql/mutations/createOneDatabaseConnection.ts @@ -1,12 +1,12 @@ import { gql } from '@apollo/client'; +import { DATABASE_CONNECTION_FRAGMENT } from '@/databases/graphql/fragments/databaseConnectionFragment'; + export const CREATE_ONE_DATABASE_CONNECTION = gql` + ${DATABASE_CONNECTION_FRAGMENT} mutation createServer($input: CreateRemoteServerInput!) { createOneRemoteServer(input: $input) { - id - foreignDataWrapperId - foreignDataWrapperOptions - foreignDataWrapperType + ...RemoteServerFields } } `; diff --git a/packages/twenty-front/src/modules/databases/graphql/queries/findManyDatabaseConnectionTables.ts b/packages/twenty-front/src/modules/databases/graphql/queries/findManyDatabaseConnectionTables.ts new file mode 100644 index 000000000000..3d8342129e67 --- /dev/null +++ b/packages/twenty-front/src/modules/databases/graphql/queries/findManyDatabaseConnectionTables.ts @@ -0,0 +1,11 @@ +import { gql } from '@apollo/client'; + +export const GET_MANY_DATABASE_CONNECTION_TABLES = gql` + query GetManyDatabaseConnectionTables($input: RemoteServerIdInput!) { + findAvailableRemoteTablesByServerId(input: $input) { + name + schema + status + } + } +`; diff --git a/packages/twenty-front/src/modules/databases/graphql/queries/findManyDatabaseConnections.ts b/packages/twenty-front/src/modules/databases/graphql/queries/findManyDatabaseConnections.ts index 90876e97a7ab..5b33e4f04400 100644 --- a/packages/twenty-front/src/modules/databases/graphql/queries/findManyDatabaseConnections.ts +++ b/packages/twenty-front/src/modules/databases/graphql/queries/findManyDatabaseConnections.ts @@ -1,14 +1,12 @@ import { gql } from '@apollo/client'; +import { DATABASE_CONNECTION_FRAGMENT } from '@/databases/graphql/fragments/databaseConnectionFragment'; + export const GET_MANY_DATABASE_CONNECTIONS = gql` + ${DATABASE_CONNECTION_FRAGMENT} query GetManyDatabaseConnections($input: RemoteServerTypeInput!) { findManyRemoteServersByType(input: $input) { - id - createdAt - foreignDataWrapperId - foreignDataWrapperOptions - foreignDataWrapperType - updatedAt + ...RemoteServerFields } } `; diff --git a/packages/twenty-front/src/modules/databases/graphql/queries/findOneDatabaseConnection.ts b/packages/twenty-front/src/modules/databases/graphql/queries/findOneDatabaseConnection.ts new file mode 100644 index 000000000000..4658e133b208 --- /dev/null +++ b/packages/twenty-front/src/modules/databases/graphql/queries/findOneDatabaseConnection.ts @@ -0,0 +1,12 @@ +import { gql } from '@apollo/client'; + +import { DATABASE_CONNECTION_FRAGMENT } from '@/databases/graphql/fragments/databaseConnectionFragment'; + +export const GET_ONE_DATABASE_CONNECTION = gql` + ${DATABASE_CONNECTION_FRAGMENT} + query GetOneDatabaseConnection($input: RemoteServerIdInput!) { + findOneRemoteServerById(input: $input) { + ...RemoteServerFields + } + } +`; diff --git a/packages/twenty-front/src/modules/databases/hooks/useGetDatabaseConnection.ts b/packages/twenty-front/src/modules/databases/hooks/useGetDatabaseConnection.ts new file mode 100644 index 000000000000..5d13777dfb8a --- /dev/null +++ b/packages/twenty-front/src/modules/databases/hooks/useGetDatabaseConnection.ts @@ -0,0 +1,47 @@ +import { useQuery } from '@apollo/client'; + +import { GET_ONE_DATABASE_CONNECTION } from '@/databases/graphql/queries/findOneDatabaseConnection'; +import { getForeignDataWrapperType } from '@/databases/utils/getForeignDataWrapperType'; +import { useApolloMetadataClient } from '@/object-metadata/hooks/useApolloMetadataClient'; +import { + GetOneDatabaseConnectionQuery, + GetOneDatabaseConnectionQueryVariables, +} from '~/generated-metadata/graphql'; + +type UseGetDatabaseConnectionParams = { + databaseKey: string; + connectionId: string; + skip?: boolean; +}; + +export const useGetDatabaseConnection = ({ + databaseKey, + connectionId, + skip, +}: UseGetDatabaseConnectionParams) => { + const apolloMetadataClient = useApolloMetadataClient(); + const foreignDataWrapperType = getForeignDataWrapperType(databaseKey); + + const { data, loading } = useQuery< + GetOneDatabaseConnectionQuery, + GetOneDatabaseConnectionQueryVariables + >(GET_ONE_DATABASE_CONNECTION, { + client: apolloMetadataClient ?? undefined, + skip: skip || !apolloMetadataClient || !foreignDataWrapperType, + variables: { + input: { + id: connectionId, + }, + }, + }); + + const connection = data?.findOneRemoteServerById ?? null; + + return { + connection: + connection?.foreignDataWrapperType === foreignDataWrapperType + ? connection + : null, + loading, + }; +}; diff --git a/packages/twenty-front/src/modules/databases/hooks/useGetDatabaseConnectionTables.ts b/packages/twenty-front/src/modules/databases/hooks/useGetDatabaseConnectionTables.ts new file mode 100644 index 000000000000..94171c16dc1d --- /dev/null +++ b/packages/twenty-front/src/modules/databases/hooks/useGetDatabaseConnectionTables.ts @@ -0,0 +1,37 @@ +import { useQuery } from '@apollo/client'; + +import { GET_MANY_DATABASE_CONNECTION_TABLES } from '@/databases/graphql/queries/findManyDatabaseConnectionTables'; +import { useApolloMetadataClient } from '@/object-metadata/hooks/useApolloMetadataClient'; +import { + GetManyDatabaseConnectionTablesQuery, + GetManyDatabaseConnectionTablesQueryVariables, +} from '~/generated-metadata/graphql'; + +type UseGetDatabaseConnectionTablesParams = { + connectionId: string; + skip?: boolean; +}; + +export const useGetDatabaseConnectionTables = ({ + connectionId, + skip, +}: UseGetDatabaseConnectionTablesParams) => { + const apolloMetadataClient = useApolloMetadataClient(); + + const { data } = useQuery< + GetManyDatabaseConnectionTablesQuery, + GetManyDatabaseConnectionTablesQueryVariables + >(GET_MANY_DATABASE_CONNECTION_TABLES, { + client: apolloMetadataClient ?? undefined, + skip: skip || !apolloMetadataClient, + variables: { + input: { + id: connectionId, + }, + }, + }); + + return { + tables: data?.findAvailableRemoteTablesByServerId || [], + }; +}; diff --git a/packages/twenty-front/src/modules/settings/integrations/components/SettingsIntegrationDatabaseConnectedTablesStatus.tsx b/packages/twenty-front/src/modules/settings/integrations/components/SettingsIntegrationDatabaseConnectedTablesStatus.tsx deleted file mode 100644 index a934efee3eaf..000000000000 --- a/packages/twenty-front/src/modules/settings/integrations/components/SettingsIntegrationDatabaseConnectedTablesStatus.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { Status } from '@/ui/display/status/components/Status'; - -type SettingsIntegrationDatabaseConnectedTablesStatusProps = { - connectedTablesCount: number; -}; - -export const SettingsIntegrationDatabaseConnectedTablesStatus = ({ - connectedTablesCount, -}: SettingsIntegrationDatabaseConnectedTablesStatusProps) => ( - -); diff --git a/packages/twenty-front/src/modules/settings/integrations/components/SettingsIntegrationDatabaseConnectionForm.tsx b/packages/twenty-front/src/modules/settings/integrations/components/SettingsIntegrationDatabaseConnectionForm.tsx index 1efcab86b562..22f389e14a03 100644 --- a/packages/twenty-front/src/modules/settings/integrations/components/SettingsIntegrationDatabaseConnectionForm.tsx +++ b/packages/twenty-front/src/modules/settings/integrations/components/SettingsIntegrationDatabaseConnectionForm.tsx @@ -41,8 +41,8 @@ export const SettingsIntegrationPostgreSQLConnectionForm = () => { { name: 'host' as const, label: 'Host' }, { name: 'port' as const, label: 'Port' }, { name: 'username' as const, label: 'Username' }, - { name: 'password' as const, label: 'Password' }, - ].map(({ name, label }) => ( + { name: 'password' as const, label: 'Password', type: 'password' }, + ].map(({ name, label, type }) => ( { value={value} onChange={onChange} fullWidth + type={type} /> )} /> diff --git a/packages/twenty-front/src/modules/settings/integrations/components/SettingsIntegrationDatabaseConnectionSyncStatus.tsx b/packages/twenty-front/src/modules/settings/integrations/components/SettingsIntegrationDatabaseConnectionSyncStatus.tsx new file mode 100644 index 000000000000..a13aede906dd --- /dev/null +++ b/packages/twenty-front/src/modules/settings/integrations/components/SettingsIntegrationDatabaseConnectionSyncStatus.tsx @@ -0,0 +1,33 @@ +import { useGetDatabaseConnectionTables } from '@/databases/hooks/useGetDatabaseConnectionTables'; +import { Status } from '@/ui/display/status/components/Status'; +import { RemoteTableStatus } from '~/generated-metadata/graphql'; + +type SettingsIntegrationDatabaseConnectionSyncStatusProps = { + connectionId: string; + skip?: boolean; +}; + +export const SettingsIntegrationDatabaseConnectionSyncStatus = ({ + connectionId, + skip, +}: SettingsIntegrationDatabaseConnectionSyncStatusProps) => { + const { tables } = useGetDatabaseConnectionTables({ + connectionId, + skip, + }); + + const syncedTables = tables.filter( + (table) => table.status === RemoteTableStatus.Synced, + ); + + return ( + + ); +}; diff --git a/packages/twenty-front/src/modules/settings/integrations/components/SettingsIntegrationDatabaseConnectionsListCard.tsx b/packages/twenty-front/src/modules/settings/integrations/components/SettingsIntegrationDatabaseConnectionsListCard.tsx index 3f397883fb0a..ecb425cd0997 100644 --- a/packages/twenty-front/src/modules/settings/integrations/components/SettingsIntegrationDatabaseConnectionsListCard.tsx +++ b/packages/twenty-front/src/modules/settings/integrations/components/SettingsIntegrationDatabaseConnectionsListCard.tsx @@ -3,11 +3,11 @@ import styled from '@emotion/styled'; import { IconChevronRight } from 'twenty-ui'; import { SettingsListCard } from '@/settings/components/SettingsListCard'; -import { SettingsIntegrationDatabaseConnectedTablesStatus } from '@/settings/integrations/components/SettingsIntegrationDatabaseConnectedTablesStatus'; +import { SettingsIntegrationDatabaseConnectionSyncStatus } from '@/settings/integrations/components/SettingsIntegrationDatabaseConnectionSyncStatus'; import { SettingsIntegration } from '@/settings/integrations/types/SettingsIntegration'; +import { getConnectionDbName } from '@/settings/integrations/utils/getConnectionDbName'; import { LightIconButton } from '@/ui/input/button/components/LightIconButton'; import { RemoteServer } from '~/generated-metadata/graphql'; -import { mockedRemoteObjectIntegrations } from '~/testing/mock-data/remoteObjectDatabases'; type SettingsIntegrationDatabaseConnectionsListCardProps = { integration: SettingsIntegration; @@ -38,14 +38,6 @@ export const SettingsIntegrationDatabaseConnectionsListCard = ({ }: SettingsIntegrationDatabaseConnectionsListCardProps) => { const navigate = useNavigate(); - // TODO: Use real remote database tables data from backend - const tables = mockedRemoteObjectIntegrations[0].connections[0].tables; - - const getConnectionDbName = (connection: RemoteServer) => - integration.from.key === 'postgresql' - ? connection.foreignDataWrapperOptions?.dbname - : ''; - return ( )} - RowRightComponent={({ item: _connection }) => ( + RowRightComponent={({ item: connection }) => ( - )} - onRowClick={(connection) => - navigate(`./${getConnectionDbName(connection)}`) + onRowClick={(connection) => navigate(`./${connection.id}`)} + getItemLabel={(connection) => + getConnectionDbName({ integration, connection }) } - getItemLabel={getConnectionDbName} hasFooter footerButtonLabel="Add connection" onFooterButtonClick={() => navigate('./new')} diff --git a/packages/twenty-front/src/modules/settings/integrations/components/SettingsIntegrationDatabaseTablesListCard.tsx b/packages/twenty-front/src/modules/settings/integrations/components/SettingsIntegrationDatabaseTablesListCard.tsx index 1581ecc3709d..1f17036f4685 100644 --- a/packages/twenty-front/src/modules/settings/integrations/components/SettingsIntegrationDatabaseTablesListCard.tsx +++ b/packages/twenty-front/src/modules/settings/integrations/components/SettingsIntegrationDatabaseTablesListCard.tsx @@ -4,9 +4,10 @@ import { z } from 'zod'; import { SettingsListCard } from '@/settings/components/SettingsListCard'; import { Toggle } from '@/ui/input/components/Toggle'; +import { RemoteTable, RemoteTableStatus } from '~/generated-metadata/graphql'; export const settingsIntegrationsDatabaseTablesSchema = z.object({ - syncedTablesById: z.record(z.boolean()), + syncedTablesByName: z.record(z.boolean()), }); export type SettingsIntegrationsDatabaseTablesFormValues = z.infer< @@ -14,7 +15,7 @@ export type SettingsIntegrationsDatabaseTablesFormValues = z.infer< >; type SettingsIntegrationDatabaseTablesListCardProps = { - tables: { id: string; name: string; isSynced?: boolean }[]; + tables: RemoteTable[]; }; const StyledRowRightContainer = styled.div` @@ -31,13 +32,13 @@ export const SettingsIntegrationDatabaseTablesListCard = ({ return ( ({ id: table.name, ...table }))} RowRightComponent={({ item: table }) => ( ( )} diff --git a/packages/twenty-front/src/modules/settings/integrations/utils/getConnectionDbName.ts b/packages/twenty-front/src/modules/settings/integrations/utils/getConnectionDbName.ts new file mode 100644 index 000000000000..084632b32db2 --- /dev/null +++ b/packages/twenty-front/src/modules/settings/integrations/utils/getConnectionDbName.ts @@ -0,0 +1,15 @@ +import { SettingsIntegration } from '@/settings/integrations/types/SettingsIntegration'; +import { RemoteServer } from '~/generated-metadata/graphql'; + +type GetConnectionDbNameParams = { + integration: SettingsIntegration; + connection: RemoteServer; +}; + +export const getConnectionDbName = ({ + integration, + connection, +}: GetConnectionDbNameParams) => + integration.from.key === 'postgresql' + ? connection.foreignDataWrapperOptions?.dbname + : ''; diff --git a/packages/twenty-front/src/modules/types/SettingsPath.ts b/packages/twenty-front/src/modules/types/SettingsPath.ts index f61394d4e552..656f57847b6c 100644 --- a/packages/twenty-front/src/modules/types/SettingsPath.ts +++ b/packages/twenty-front/src/modules/types/SettingsPath.ts @@ -22,7 +22,7 @@ export enum SettingsPath { DevelopersApiKeyDetail = 'api-keys/:apiKeyId', Integrations = 'integrations', IntegrationDatabase = 'integrations/:databaseKey', - IntegrationDatabaseConnection = 'integrations/:databaseKey/:connectionKey', + IntegrationDatabaseConnection = 'integrations/:databaseKey/:connectionId', IntegrationNewDatabaseConnection = 'integrations/:databaseKey/new', DevelopersNewWebhook = 'webhooks/new', DevelopersNewWebhookDetail = 'webhooks/:webhookId', diff --git a/packages/twenty-front/src/pages/settings/integrations/SettingsIntegrationDatabaseConnection.tsx b/packages/twenty-front/src/pages/settings/integrations/SettingsIntegrationDatabaseConnection.tsx index 7043594d91dd..b219f8e4d283 100644 --- a/packages/twenty-front/src/pages/settings/integrations/SettingsIntegrationDatabaseConnection.tsx +++ b/packages/twenty-front/src/pages/settings/integrations/SettingsIntegrationDatabaseConnection.tsx @@ -5,6 +5,8 @@ import { zodResolver } from '@hookform/resolvers/zod'; import { IconSettings } from 'twenty-ui'; import { useDeleteOneDatabaseConnection } from '@/databases/hooks/useDeleteOneDatabaseConnection'; +import { useGetDatabaseConnection } from '@/databases/hooks/useGetDatabaseConnection'; +import { useGetDatabaseConnectionTables } from '@/databases/hooks/useGetDatabaseConnectionTables'; import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer'; import { SettingsIntegrationDatabaseTablesListCard, @@ -12,6 +14,7 @@ import { settingsIntegrationsDatabaseTablesSchema, } from '@/settings/integrations/components/SettingsIntegrationDatabaseTablesListCard'; import { useSettingsIntegrationCategories } from '@/settings/integrations/hooks/useSettingsIntegrationCategories'; +import { getConnectionDbName } from '@/settings/integrations/utils/getConnectionDbName'; import { getSettingsPagePath } from '@/settings/utils/getSettingsPagePath'; import { AppPath } from '@/types/AppPath'; import { SettingsPath } from '@/types/SettingsPath'; @@ -21,10 +24,9 @@ import { Section } from '@/ui/layout/section/components/Section'; import { Breadcrumb } from '@/ui/navigation/bread-crumb/components/Breadcrumb'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { SettingsIntegrationDatabaseConnectionSummaryCard } from '~/pages/settings/integrations/SettingsIntegrationDatabaseConnectionSummaryCard'; -import { mockedRemoteObjectIntegrations } from '~/testing/mock-data/remoteObjectDatabases'; export const SettingsIntegrationDatabaseConnection = () => { - const { databaseKey = '', connectionKey = '' } = useParams(); + const { databaseKey = '', connectionId = '' } = useParams(); const navigate = useNavigate(); const [integrationCategoryAll] = useSettingsIntegrationCategories(); @@ -43,11 +45,11 @@ export const SettingsIntegrationDatabaseConnection = () => { ((databaseKey === 'airtable' && isAirtableIntegrationEnabled) || (databaseKey === 'postgresql' && isPostgresqlIntegrationEnabled)); - const connections = - mockedRemoteObjectIntegrations.find( - ({ key }) => key === integration?.from.key, - )?.connections || []; - const connection = connections.find(({ key }) => key === connectionKey); + const { connection, loading } = useGetDatabaseConnection({ + databaseKey, + connectionId, + skip: !isIntegrationAvailable, + }); const { deleteOneDatabaseConnection } = useDeleteOneDatabaseConnection(); @@ -60,10 +62,22 @@ export const SettingsIntegrationDatabaseConnection = () => { }; useEffect(() => { - if (!isIntegrationAvailable || !connection) { + if (!isIntegrationAvailable || (!loading && !connection)) { navigate(AppPath.NotFound); } - }, [integration, databaseKey, navigate, isIntegrationAvailable, connection]); + }, [ + integration, + databaseKey, + navigate, + isIntegrationAvailable, + connection, + loading, + ]); + + const { tables } = useGetDatabaseConnectionTables({ + connectionId, + skip: !isIntegrationAvailable || !connection, + }); const formConfig = useForm({ mode: 'onTouched', @@ -76,7 +90,7 @@ export const SettingsIntegrationDatabaseConnection = () => { SettingsPath.Integrations, ); - const tables = mockedRemoteObjectIntegrations[0].connections[0].tables; + const connectionName = getConnectionDbName({ integration, connection }); return ( // eslint-disable-next-line react/jsx-props-no-spreading @@ -93,15 +107,15 @@ export const SettingsIntegrationDatabaseConnection = () => { children: integration.text, href: `${settingsIntegrationsPagePath}/${databaseKey}`, }, - { children: connection.name }, + { children: connectionName }, ]} />
diff --git a/packages/twenty-front/src/pages/settings/integrations/SettingsIntegrationDatabaseConnectionSummaryCard.tsx b/packages/twenty-front/src/pages/settings/integrations/SettingsIntegrationDatabaseConnectionSummaryCard.tsx index 4d2dd3084024..5c3bddb24f8c 100644 --- a/packages/twenty-front/src/pages/settings/integrations/SettingsIntegrationDatabaseConnectionSummaryCard.tsx +++ b/packages/twenty-front/src/pages/settings/integrations/SettingsIntegrationDatabaseConnectionSummaryCard.tsx @@ -2,7 +2,7 @@ import styled from '@emotion/styled'; import { IconDotsVertical, IconTrash } from 'twenty-ui'; import { SettingsSummaryCard } from '@/settings/components/SettingsSummaryCard'; -import { SettingsIntegrationDatabaseConnectedTablesStatus } from '@/settings/integrations/components/SettingsIntegrationDatabaseConnectedTablesStatus'; +import { SettingsIntegrationDatabaseConnectionSyncStatus } from '@/settings/integrations/components/SettingsIntegrationDatabaseConnectionSyncStatus'; import { LightIconButton } from '@/ui/input/button/components/LightIconButton'; import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown'; import { DropdownMenu } from '@/ui/layout/dropdown/components/DropdownMenu'; @@ -11,8 +11,8 @@ import { MenuItem } from '@/ui/navigation/menu-item/components/MenuItem'; type SettingsIntegrationDatabaseConnectionSummaryCardProps = { databaseLogoUrl: string; + connectionId: string; connectionName: string; - connectedTablesNb: number; onRemove: () => void; }; @@ -30,8 +30,8 @@ const StyledDatabaseLogo = styled.img` export const SettingsIntegrationDatabaseConnectionSummaryCard = ({ databaseLogoUrl, + connectionId, connectionName, - connectedTablesNb, onRemove, }: SettingsIntegrationDatabaseConnectionSummaryCardProps) => { const dropdownId = @@ -49,8 +49,8 @@ export const SettingsIntegrationDatabaseConnectionSummaryCard = ({ } rightComponent={ <> - = { routePath: getSettingsPagePath(SettingsPath.IntegrationDatabaseConnection), routeParams: { ':databaseKey': 'postgresql', - ':connectionKey': 'twenty_postgres', + ':connectionId': '67cbfd35-8dd4-4591-b9d4-c1906281a5da', }, }, parameters: { diff --git a/packages/twenty-front/src/testing/mock-data/remoteObjectDatabases.ts b/packages/twenty-front/src/testing/mock-data/remoteObjectDatabases.ts index 5369b9316076..09c5bde31b5b 100644 --- a/packages/twenty-front/src/testing/mock-data/remoteObjectDatabases.ts +++ b/packages/twenty-front/src/testing/mock-data/remoteObjectDatabases.ts @@ -1,3 +1,5 @@ +import { RemoteTableStatus } from '~/generated-metadata/graphql'; + export const mockedRemoteObjectIntegrations = [ { id: '5b717911-dc75-4876-bf33-dfdc994c88cd', @@ -5,19 +7,17 @@ export const mockedRemoteObjectIntegrations = [ connections: [ { id: '67cbfd35-8dd4-4591-b9d4-c1906281a5da', - key: 'twenty_postgres', name: 'Twenty_postgres', tables: [ - { id: 'invoices', name: 'Invoices' }, - { id: 'quotes', name: 'Quotes', isSynced: true }, - { id: 'customers', name: 'Customers', isSynced: false }, - { id: 'subscriptions', name: 'Subscriptions', isSynced: true }, - { id: 'payments', name: 'Payments' }, + { name: 'Invoices', status: RemoteTableStatus.NotSynced }, + { name: 'Quotes', status: RemoteTableStatus.Synced }, + { name: 'Customers', status: RemoteTableStatus.NotSynced }, + { name: 'Subscriptions', status: RemoteTableStatus.Synced }, + { name: 'Payments', status: RemoteTableStatus.NotSynced }, ], }, { id: '3740cd85-7a1e-45b5-8b0d-47e1921d01f3', - key: 'image_postgres', name: 'Image_postgres', tables: [], },