feat(FN-007): add repository connection frontend UI
- Create RepositoryListPage with connection status display - Create RepositoryDetailPage with SSH key management - Add repository API methods to client - Update router with repository routes - Add Repository types to frontend
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { Config, ConfigCreate, Project, ProjectCreate, ProjectUpdate, Secret, SecretCreate, ToolDefinition, ToolInstance, User } from '../types/api.ts'
|
||||
import type { Config, ConfigCreate, Project, ProjectCreate, ProjectUpdate, Repository, RepositoryConnection, RepositoryConnectionCreate, RepositoryCreate, Secret, SecretCreate, ToolDefinition, ToolInstance, User } from '../types/api.ts'
|
||||
|
||||
const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:8000'
|
||||
|
||||
@@ -195,4 +195,54 @@ export const api = {
|
||||
method: 'DELETE',
|
||||
})
|
||||
},
|
||||
|
||||
getRepository: async (projectId: string, repoId: string): Promise<Repository> => {
|
||||
const response = await fetchWithAuth(`/projects/${projectId}/repositories/${repoId}`)
|
||||
return response.json()
|
||||
},
|
||||
|
||||
getRepositories: async (projectId: string): Promise<Repository[]> => {
|
||||
const response = await fetchWithAuth(`/projects/${projectId}/repositories`)
|
||||
return response.json()
|
||||
},
|
||||
|
||||
createRepository: async (projectId: string, data: RepositoryCreate): Promise<Repository> => {
|
||||
const response = await fetchWithAuth(`/projects/${projectId}/repositories`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
return response.json()
|
||||
},
|
||||
|
||||
deleteRepository: async (projectId: string, repoId: string): Promise<void> => {
|
||||
await fetchWithAuth(`/projects/${projectId}/repositories/${repoId}`, {
|
||||
method: 'DELETE',
|
||||
})
|
||||
},
|
||||
|
||||
getRepositoryConnections: async (projectId: string): Promise<RepositoryConnection[]> => {
|
||||
const response = await fetchWithAuth(`/projects/${projectId}/repository-connections`)
|
||||
return response.json()
|
||||
},
|
||||
|
||||
createRepositoryConnection: async (projectId: string, data: RepositoryConnectionCreate): Promise<RepositoryConnection> => {
|
||||
const response = await fetchWithAuth(`/projects/${projectId}/repository-connections`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
return response.json()
|
||||
},
|
||||
|
||||
deleteRepositoryConnection: async (projectId: string, connectionId: string): Promise<void> => {
|
||||
await fetchWithAuth(`/projects/${projectId}/repository-connections/${connectionId}`, {
|
||||
method: 'DELETE',
|
||||
})
|
||||
},
|
||||
|
||||
generateSshKey: async (projectId: string, connectionId: string): Promise<{ public_key: string }> => {
|
||||
const response = await fetchWithAuth(`/projects/${projectId}/repository-connections/${connectionId}/ssh-key`, {
|
||||
method: 'POST',
|
||||
})
|
||||
return response.json()
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user