Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
wsxiaoys committed Apr 26, 2024
1 parent d9dbf71 commit 57b7a03
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
15 changes: 14 additions & 1 deletion ee/tabby-webserver/graphql/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
type Repository {
id: ID!
name: String!
kind: RepositoryKind!
}

input UpdateRepositoryProviderInput {
id: ID!
displayName: String!
Expand Down Expand Up @@ -283,7 +289,7 @@ type Query {
networkSetting: NetworkSetting!
securitySetting: SecuritySetting!
gitRepositories(after: String, before: String, first: Int, last: Int): RepositoryConnection!
repositorySearch(repositoryName: String!, pattern: String!): [FileEntrySearchResult!]!
repositorySearch(kind: RepositoryKind!, id: ID!, pattern: String!): [FileEntrySearchResult!]!
oauthCredential(provider: OAuthProvider!): OAuthCredential
oauthCallbackUrl(provider: OAuthProvider!): String!
serverInfo: ServerInfo!
Expand All @@ -293,6 +299,7 @@ type Query {
dailyStats(start: DateTimeUtc!, end: DateTimeUtc!, users: [ID!], languages: [Language!]): [CompletionStats!]!
userEvents(after: String, before: String, first: Int, last: Int, users: [ID!], start: DateTimeUtc!, end: DateTimeUtc!): UserEventConnection!
diskUsageStats: DiskUsageStats!
repositoryList: [Repository!]!
}

input NetworkSettingInput {
Expand Down Expand Up @@ -336,6 +343,12 @@ type RepositoryConnection {
pageInfo: PageInfo!
}

enum RepositoryKind {
GIT
GITHUB
GITLAB
}

input EmailSettingInput {
smtpUsername: String!
fromAddress: String!
Expand Down
8 changes: 4 additions & 4 deletions ee/tabby-webserver/src/schema/repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ impl From<FileSearch> for FileEntrySearchResult {
#[serde(rename_all = "lowercase")]
pub enum RepositoryKind {
Git,
GitHub,
GitLab,
Github,
Gitlab,
}

#[derive(GraphQLObject)]
Expand Down Expand Up @@ -66,7 +66,7 @@ impl From<GithubProvidedRepository> for Repository {
Self {
id: value.id,
name: value.name,
kind: RepositoryKind::GitHub,
kind: RepositoryKind::Github,
dir: RepositoryConfig::new(value.git_url).dir(),
}
}
Expand All @@ -77,7 +77,7 @@ impl From<GitlabProvidedRepository> for Repository {
Self {
id: value.id,
name: value.name,
kind: RepositoryKind::GitLab,
kind: RepositoryKind::Gitlab,
dir: RepositoryConfig::new(value.git_url).dir(),
}
}
Expand Down
4 changes: 2 additions & 2 deletions ee/tabby-webserver/src/service/repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ impl RepositoryService for RepositoryServiceImpl {
async fn get(&self, kind: &RepositoryKind, id: &ID) -> Result<Repository> {
match kind {
RepositoryKind::Git => self.git().get_repository(id).await,
RepositoryKind::GitHub => self.github().get_repository(id).await,
RepositoryKind::GitLab => self.gitlab().get_repository(id).await,
RepositoryKind::Github => self.github().get_repository(id).await,
RepositoryKind::Gitlab => self.gitlab().get_repository(id).await,
}
}

Expand Down

0 comments on commit 57b7a03

Please sign in to comment.