Sync table from frontend (#4894)

This PR:
- separates the existing updateSyncStatus endpoint into 2 endpoints
- creates mutations and hooks that will call those endpoints
- trigger the hook on toggle
- removes form logic and add a separated component for toggling

---------

Co-authored-by: Thomas Trompette <thomast@twenty.com>
This commit is contained in:
Thomas Trompette
2024-04-11 11:51:49 +02:00
committed by GitHub
parent bea6d4173c
commit aecf8783a0
20 changed files with 372 additions and 149 deletions

View File

@ -0,0 +1,9 @@
import { gql } from '@apollo/client';
export const REMOTE_TABLE_FRAGMENT = gql`
fragment RemoteTableFields on RemoteTable {
name
schema
status
}
`;

View File

@ -0,0 +1,12 @@
import { gql } from '@apollo/client';
import { REMOTE_TABLE_FRAGMENT } from '@/databases/graphql/fragments/remoteTableFragment';
export const SYNC_REMOTE_TABLE = gql`
${REMOTE_TABLE_FRAGMENT}
mutation syncRemoteTable($input: RemoteTableInput!) {
syncRemoteTable(input: $input) {
...RemoteTableFields
}
}
`;

View File

@ -0,0 +1,12 @@
import { gql } from '@apollo/client';
import { REMOTE_TABLE_FRAGMENT } from '@/databases/graphql/fragments/remoteTableFragment';
export const UNSYNC_REMOTE_TABLE = gql`
${REMOTE_TABLE_FRAGMENT}
mutation unsyncRemoteTable($input: RemoteTableInput!) {
unsyncRemoteTable(input: $input) {
...RemoteTableFields
}
}
`;

View File

@ -1,11 +0,0 @@
import { gql } from '@apollo/client';
export const GET_MANY_DATABASE_CONNECTION_TABLES = gql`
query GetManyDatabaseConnectionTables($input: RemoteServerIdInput!) {
findAvailableRemoteTablesByServerId(input: $input) {
name
schema
status
}
}
`;

View File

@ -0,0 +1,12 @@
import { gql } from '@apollo/client';
import { REMOTE_TABLE_FRAGMENT } from '@/databases/graphql/fragments/remoteTableFragment';
export const GET_MANY_REMOTE_TABLES = gql`
${REMOTE_TABLE_FRAGMENT}
query GetManyRemoteTables($input: RemoteServerIdInput!) {
findAvailableRemoteTablesByServerId(input: $input) {
...RemoteTableFields
}
}
`;