Skip to content

Commit

Permalink
feat(graphQL): add ResolveGitUrl query for frontend and backend
Browse files Browse the repository at this point in the history
  • Loading branch information
antimonyGu committed Dec 11, 2024
1 parent 2761273 commit 04c17ec
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ee/tabby-schema/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ type Query {
userEvents(after: String, before: String, first: Int, last: Int, users: [ID!], start: DateTime!, end: DateTime!): UserEventConnection!
diskUsageStats: DiskUsageStats!
repositoryList: [Repository!]!
resolveGitUrl(gitUrl: String!): Repository
resolveGitUrl(gitUrl: String!): Boolean!
contextInfo: ContextInfo!
integrations(ids: [ID!], kind: IntegrationKind, after: String, before: String, first: Int, last: Int): IntegrationConnection!
integratedRepositories(ids: [ID!], kind: IntegrationKind, active: Boolean, after: String, before: String, first: Int, last: Int): ProvidedRepositoryConnection!
Expand Down
8 changes: 4 additions & 4 deletions ee/tabby-schema/src/schema/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,8 @@ impl Query {
.await
}

async fn resolve_git_url(ctx: &Context, git_url: String) -> Result<Option<Repository>> {
let user = check_user(ctx).await?;
async fn resolve_git_url(ctx: &Context, git_url: String) -> Result<bool> {
let user = check_user_and_auth_token(ctx).await?;

let repositorys = ctx
.locator
Expand All @@ -553,11 +553,11 @@ impl Query {

for repo in repositorys {
if repo.git_url == git_url {
return Ok(Some(repo));
return Ok(true);
}
}

Ok(None)
return Ok(false);
}

async fn context_info(ctx: &Context) -> Result<ContextInfo> {
Expand Down
1 change: 0 additions & 1 deletion ee/tabby-ui/lib/tabby/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ const client = new Client({
ServerInfo: () => null,
RepositorySearch: () => null,
RepositoryList: () => null,
// IsAvaileableWorkspace: () => null,
RepositoryGrep: () => null,
GrepLine: () => null,
GrepFile: () => null,
Expand Down
6 changes: 3 additions & 3 deletions ee/tabby-ui/lib/tabby/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,9 @@ export const repositoryListQuery = graphql(/* GraphQL */ `
}
`)

export const isAvaileableWorkspaceQuery = graphql(/* GraphQL */ `
query IsAvaileableWorkspace($gitUrl: String!) {
isAvaileableWorkspace(gitUrl: $gitUrl)
export const resolveGitUrlQuery = graphql(/* GraphQL */ `
query ResolveGitUrl($gitUrl: String!) {
resolveGitUrl(gitUrl: $gitUrl)
}
`)

Expand Down

0 comments on commit 04c17ec

Please sign in to comment.