feat: 去 mock 化 —— 全模块接入真实数据 (参考 jianmu/opsx-jenkins/aiops)
后端(35+ 新路由): - AES-256-GCM 字段加密(enc:v1:),密钥自动生成 data/encryption.key - 新模型:Host/K8sCluster/Credential/BuildNode/DeployTool/WebhookEndpoint/ JenkinsServer/SystemSetting;Pipeline 扩展触发器/变量/缓存列, PipelineRun 扩展 buildNumber/externalUrl - 资源 CRUD + 真实测试端点:主机/集群/构建节点 TCP 拨号、 工具真实执行版本检测(保守安装策略)、Webhook HMAC-SHA256 签名发送、 入站流水线触发 /api/hooks/pipeline/:id - Jenkins 完整集成(移植 opsx-jenkins 生产客户端):crumb/BasicAuth/ buildWithParameters/Location 队列/progressiveText 增量控制台, 服务器 CRUD+测试、Job 树拉取(folder 压平)、导入为流水线、 jenkins 类型流水线真实执行回传日志 - 流水线列表附带 lastRun、运行重试、summary 统计、系统设置单行表 - 运行结束触发出站 Webhook 通知;GitOps 同步状态真实推进 前端(14 页全部去 mock): - 流水线列表/发布记录/批量发布/环境/凭证/构建节点/工具/Webhook/ 系统设置/Jenkins 导入/GitOps(资源树+差异) 全部接入真实 API - 编辑器 4 Tab 持久化(基本信息/触发设置含真实 Webhook URL/变量缓存/发布历史) - TopBar 真实流水线切换 + 仅保存/保存并运行 - Sidebar 徽标真实统计;删除未使用组件与 mock 数据文件
This commit is contained in:
1 parent
04d1342b27
commit
26341c3e8a
37 files changed
+5702
-4683
No files matched your search
+54
-1
@@ -64,10 +64,15 @@ export interface PipelineRunDTO {
|
||||
pipelineName: string
|
||||
branch: string
|
||||
env: string
|
||||
status: 'pending' | 'running' | 'success' | 'failed' | 'cancelled'
|
||||
status: string
|
||||
durationMs: number
|
||||
triggerBy?: string
|
||||
triggerType?: string
|
||||
startedAt: string
|
||||
completedAt?: string
|
||||
buildNumber?: number
|
||||
externalRunId?: string
|
||||
externalUrl?: string
|
||||
}
|
||||
|
||||
export const apiClient = {
|
||||
@@ -92,4 +97,52 @@ export const apiClient = {
|
||||
return api<PipelineRunDTO[]>(`/api/runs${qs ? `?${qs}` : ''}`)
|
||||
},
|
||||
getRun: (runId: string) => api<any>(`/api/runs/${runId}`),
|
||||
retryRun: (runId: string) => api<PipelineRunDTO>(`/api/runs/${runId}/retry`, { method: 'POST' }),
|
||||
// 摘要/设置
|
||||
getSummary: () => api<any>('/api/summary'),
|
||||
getSettings: () => api<any>('/api/settings'),
|
||||
updateSettings: (body: any) => api('/api/settings', { method: 'PUT', body: JSON.stringify(body) }),
|
||||
// 主机
|
||||
listHosts: () => api<any[]>('/api/hosts'),
|
||||
createHost: (b: any) => api('/api/hosts', { method: 'POST', body: JSON.stringify(b) }),
|
||||
updateHost: (id: any, b: any) => api(`/api/hosts/${id}`, { method: 'PUT', body: JSON.stringify(b) }),
|
||||
deleteHost: (id: any) => api(`/api/hosts/${id}`, { method: 'DELETE' }),
|
||||
testHost: (id: any) => api<any>(`/api/hosts/${id}/test`, { method: 'POST' }),
|
||||
// 集群
|
||||
listClusters: () => api<any[]>('/api/clusters'),
|
||||
createCluster: (b: any) => api('/api/clusters', { method: 'POST', body: JSON.stringify(b) }),
|
||||
updateCluster: (id: any, b: any) => api(`/api/clusters/${id}`, { method: 'PUT', body: JSON.stringify(b) }),
|
||||
deleteCluster: (id: any) => api(`/api/clusters/${id}`, { method: 'DELETE' }),
|
||||
testCluster: (id: any) => api<any>(`/api/clusters/${id}/test`, { method: 'POST' }),
|
||||
// 凭证
|
||||
listCredentials: (type?: string) => api<any[]>(`/api/credentials${type && type !== 'all' ? `?type=${type}` : ''}`),
|
||||
createCredential: (b: any) => api('/api/credentials', { method: 'POST', body: JSON.stringify(b) }),
|
||||
updateCredential: (id: any, b: any) => api(`/api/credentials/${id}`, { method: 'PUT', body: JSON.stringify(b) }),
|
||||
deleteCredential: (id: any) => api(`/api/credentials/${id}`, { method: 'DELETE' }),
|
||||
// 构建节点
|
||||
listBuildNodes: () => api<any[]>('/api/build-nodes'),
|
||||
createBuildNode: (b: any) => api('/api/build-nodes', { method: 'POST', body: JSON.stringify(b) }),
|
||||
updateBuildNode: (id: any, b: any) => api(`/api/build-nodes/${id}`, { method: 'PUT', body: JSON.stringify(b) }),
|
||||
deleteBuildNode: (id: any) => api(`/api/build-nodes/${id}`, { method: 'DELETE' }),
|
||||
testBuildNode: (id: any) => api<any>(`/api/build-nodes/${id}/test`, { method: 'POST' }),
|
||||
// 工具
|
||||
listTools: () => api<any[]>('/api/tools'),
|
||||
updateTool: (id: any, b: any) => api(`/api/tools/${id}`, { method: 'PUT', body: JSON.stringify(b) }),
|
||||
checkTool: (id: any) => api<any>(`/api/tools/${id}/check`, { method: 'POST' }),
|
||||
installTool: (id: any) => api<any>(`/api/tools/${id}/install`, { method: 'POST' }),
|
||||
// Webhook
|
||||
listWebhooks: () => api<any[]>('/api/webhooks'),
|
||||
createWebhook: (b: any) => api('/api/webhooks', { method: 'POST', body: JSON.stringify(b) }),
|
||||
updateWebhook: (id: any, b: any) => api(`/api/webhooks/${id}`, { method: 'PUT', body: JSON.stringify(b) }),
|
||||
deleteWebhook: (id: any) => api(`/api/webhooks/${id}`, { method: 'DELETE' }),
|
||||
testWebhook: (id: any) => api<any>(`/api/webhooks/${id}/test`, { method: 'POST' }),
|
||||
// Jenkins
|
||||
listJenkinsServers: () => api<any[]>('/api/jenkins-servers'),
|
||||
createJenkinsServer: (b: any) => api('/api/jenkins-servers', { method: 'POST', body: JSON.stringify(b) }),
|
||||
updateJenkinsServer: (id: any, b: any) => api(`/api/jenkins-servers/${id}`, { method: 'PUT', body: JSON.stringify(b) }),
|
||||
deleteJenkinsServer: (id: any) => api(`/api/jenkins-servers/${id}`, { method: 'DELETE' }),
|
||||
testJenkinsServer: (id: any) => api<any>(`/api/jenkins-servers/${id}/test`, { method: 'POST' }),
|
||||
listJenkinsJobs: (id: any) => api<any[]>(`/api/jenkins-servers/${id}/jobs`),
|
||||
importJenkinsJobs: (id: any, jobs: string[]) =>
|
||||
api<any>(`/api/jenkins-servers/${id}/import`, { method: 'POST', body: JSON.stringify({ jobs }) }),
|
||||
}
|
||||
Reference in new issue
Block a user