Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
liangfung committed Apr 27, 2024
1 parent 3cd825d commit 09f6059
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion ee/tabby-ui/lib/tabby/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -110,7 +112,8 @@ const client = new Client({
Query: {
invitations: relayPagination(),
repositories: relayPagination(),
githubRepositories: relayPagination()
githubRepositories: relayPagination(),
gitlabRepositories: relayPagination()
}
},
updates: {
Expand Down Expand Up @@ -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
}
)
})
}
}
}
}
Expand Down

0 comments on commit 09f6059

Please sign in to comment.