diff --git a/ee/tabby-ui/lib/tabby/gql.ts b/ee/tabby-ui/lib/tabby/gql.ts index 2f80cf911253..789989693190 100644 --- a/ee/tabby-ui/lib/tabby/gql.ts +++ b/ee/tabby-ui/lib/tabby/gql.ts @@ -18,11 +18,13 @@ import { import { GitRepositoriesQueryVariables, ListGithubRepositoriesQueryVariables, + ListGitlabRepositoriesQueryVariables, ListInvitationsQueryVariables } from '../gql/generates/graphql' import { refreshTokenMutation } from './auth' import { listGithubRepositories, + listGitlabRepositories, listInvitations, listRepositories } from './query' @@ -110,7 +112,8 @@ const client = new Client({ Query: { invitations: relayPagination(), repositories: relayPagination(), - githubRepositories: relayPagination() + githubRepositories: relayPagination(), + gitlabRepositories: relayPagination() } }, updates: { @@ -197,6 +200,40 @@ const client = new Client({ ) }) } + }, + updateGitlabProvidedRepositoryActive(result, args, cache, info) { + if (result.updateGithubProvidedRepositoryActive) { + cache + .inspectFields('Query') + .filter(field => field.fieldName === 'gitlabRepositories') + .forEach(field => { + cache.updateQuery( + { + query: listGitlabRepositories, + variables: + field.arguments as ListGitlabRepositoriesQueryVariables + }, + data => { + if (data?.gitlabRepositories?.edges?.length) { + data.gitlabRepositories.edges = + data.gitlabRepositories.edges.map(edge => { + if (edge.node.id === args.id) { + return { + ...edge, + node: { + ...edge.node, + active: args.active as boolean + } + } + } + return edge + }) + } + return data + } + ) + }) + } } } }