feat: fetch database connection tables in Settings/Integrations/Datab… (#4882)
…ase/Connection Closes #4758 --------- Co-authored-by: Thomas Trompette <thomast@twenty.com>
This commit is contained in:
@ -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.
|
||||
*/
|
||||
|
||||
@ -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<CreateServerMutation, CreateServerMutationVariables>;
|
||||
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<RemoteServerFieldsFragment, unknown>;
|
||||
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<CreateServerMutation, CreateServerMutationVariables>;
|
||||
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<DeleteServerMutation, DeleteServerMutationVariables>;
|
||||
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<GetManyDatabaseConnectionsQuery, GetManyDatabaseConnectionsQueryVariables>;
|
||||
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<GetManyDatabaseConnectionTablesQuery, GetManyDatabaseConnectionTablesQueryVariables>;
|
||||
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<GetManyDatabaseConnectionsQuery, GetManyDatabaseConnectionsQueryVariables>;
|
||||
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<GetOneDatabaseConnectionQuery, GetOneDatabaseConnectionQueryVariables>;
|
||||
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<CreateOneObjectMetadataItemMutation, CreateOneObjectMetadataItemMutationVariables>;
|
||||
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<CreateOneFieldMetadataItemMutation, CreateOneFieldMetadataItemMutationVariables>;
|
||||
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<CreateOneRelationMetadataMutation, CreateOneRelationMetadataMutationVariables>;
|
||||
|
||||
@ -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
|
||||
}
|
||||
`;
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -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,
|
||||
};
|
||||
};
|
||||
@ -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 || [],
|
||||
};
|
||||
};
|
||||
@ -1,18 +0,0 @@
|
||||
import { Status } from '@/ui/display/status/components/Status';
|
||||
|
||||
type SettingsIntegrationDatabaseConnectedTablesStatusProps = {
|
||||
connectedTablesCount: number;
|
||||
};
|
||||
|
||||
export const SettingsIntegrationDatabaseConnectedTablesStatus = ({
|
||||
connectedTablesCount,
|
||||
}: SettingsIntegrationDatabaseConnectedTablesStatusProps) => (
|
||||
<Status
|
||||
color="green"
|
||||
text={
|
||||
connectedTablesCount === 1
|
||||
? `1 tracked table`
|
||||
: `${connectedTablesCount} tracked tables`
|
||||
}
|
||||
/>
|
||||
);
|
||||
@ -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 }) => (
|
||||
<Controller
|
||||
key={name}
|
||||
name={name}
|
||||
@ -53,6 +53,7 @@ export const SettingsIntegrationPostgreSQLConnectionForm = () => {
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
fullWidth
|
||||
type={type}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
@ -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 (
|
||||
<Status
|
||||
color="green"
|
||||
text={
|
||||
syncedTables.length === 1
|
||||
? `1 tracked table`
|
||||
: `${syncedTables.length} tracked tables`
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@ -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 (
|
||||
<SettingsListCard
|
||||
items={connections}
|
||||
@ -54,18 +46,18 @@ export const SettingsIntegrationDatabaseConnectionsListCard = ({
|
||||
<StyledDatabaseLogo alt="" src={integration.from.image} />
|
||||
</StyledDatabaseLogoContainer>
|
||||
)}
|
||||
RowRightComponent={({ item: _connection }) => (
|
||||
RowRightComponent={({ item: connection }) => (
|
||||
<StyledRowRightContainer>
|
||||
<SettingsIntegrationDatabaseConnectedTablesStatus
|
||||
connectedTablesCount={tables.length}
|
||||
<SettingsIntegrationDatabaseConnectionSyncStatus
|
||||
connectionId={connection.id}
|
||||
/>
|
||||
<LightIconButton Icon={IconChevronRight} accent="tertiary" />
|
||||
</StyledRowRightContainer>
|
||||
)}
|
||||
onRowClick={(connection) =>
|
||||
navigate(`./${getConnectionDbName(connection)}`)
|
||||
onRowClick={(connection) => navigate(`./${connection.id}`)}
|
||||
getItemLabel={(connection) =>
|
||||
getConnectionDbName({ integration, connection })
|
||||
}
|
||||
getItemLabel={getConnectionDbName}
|
||||
hasFooter
|
||||
footerButtonLabel="Add connection"
|
||||
onFooterButtonClick={() => navigate('./new')}
|
||||
|
||||
@ -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 (
|
||||
<SettingsListCard
|
||||
items={tables}
|
||||
items={tables.map((table) => ({ id: table.name, ...table }))}
|
||||
RowRightComponent={({ item: table }) => (
|
||||
<StyledRowRightContainer>
|
||||
<Controller
|
||||
name={`syncedTablesById.${table.id}`}
|
||||
name={`syncedTablesByName.${table.name}`}
|
||||
control={control}
|
||||
defaultValue={!!table.isSynced}
|
||||
defaultValue={table.status === RemoteTableStatus.Synced}
|
||||
render={({ field: { onChange, value } }) => (
|
||||
<Toggle value={value} onChange={onChange} />
|
||||
)}
|
||||
|
||||
@ -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
|
||||
: '';
|
||||
@ -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',
|
||||
|
||||
@ -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<SettingsIntegrationsDatabaseTablesFormValues>({
|
||||
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 },
|
||||
]}
|
||||
/>
|
||||
<Section>
|
||||
<H2Title title="About" description="About this remote object" />
|
||||
<SettingsIntegrationDatabaseConnectionSummaryCard
|
||||
databaseLogoUrl={integration.from.image}
|
||||
connectionName={connection.name}
|
||||
connectedTablesNb={tables.length}
|
||||
connectionId={connectionId}
|
||||
connectionName={connectionName}
|
||||
onRemove={deleteConnection}
|
||||
/>
|
||||
</Section>
|
||||
|
||||
@ -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={
|
||||
<>
|
||||
<SettingsIntegrationDatabaseConnectedTablesStatus
|
||||
connectedTablesCount={connectedTablesNb}
|
||||
<SettingsIntegrationDatabaseConnectionSyncStatus
|
||||
connectionId={connectionId}
|
||||
/>
|
||||
<Dropdown
|
||||
dropdownId={dropdownId}
|
||||
|
||||
@ -41,7 +41,7 @@ const createRemoteServerInputSchema = newConnectionSchema
|
||||
},
|
||||
userMappingOptions: {
|
||||
password: values.password,
|
||||
user: values.username,
|
||||
username: values.username,
|
||||
},
|
||||
}));
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ const meta: Meta<PageDecoratorArgs> = {
|
||||
routePath: getSettingsPagePath(SettingsPath.IntegrationDatabaseConnection),
|
||||
routeParams: {
|
||||
':databaseKey': 'postgresql',
|
||||
':connectionKey': 'twenty_postgres',
|
||||
':connectionId': '67cbfd35-8dd4-4591-b9d4-c1906281a5da',
|
||||
},
|
||||
},
|
||||
parameters: {
|
||||
|
||||
@ -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: [],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user