feat: 接入成员权限与 Agent 配置页面
- src/views/MembersView.vue: 新增成员、项目权限和密码消息管理 - src/views/SettingsView.vue: 接入 Agent 配置读取、保存和连接测试 - src/services/devopsApi.ts: 补齐成员、消息和 Agent 配置真实接口 - src/views/AgentView.vue: 移除旧独立 Agent 页面,保留顶部右侧抽屉入口
This commit is contained in:
@@ -3,12 +3,15 @@
|
||||
*/
|
||||
import type {
|
||||
AgentCard,
|
||||
AgentConfigSummary,
|
||||
AgentConnectionTestResult,
|
||||
AgentInvocation,
|
||||
AuthenticatedUser,
|
||||
AuditLogEntry,
|
||||
ChangePasswordPayload,
|
||||
CreateAgentInvocationPayload,
|
||||
CreateDeployRunPayload,
|
||||
CreateMemberPayload,
|
||||
DashboardSummary,
|
||||
EnvironmentName,
|
||||
HealthState,
|
||||
@@ -20,13 +23,18 @@ import type {
|
||||
JenkinsSyncSummary,
|
||||
LoginPayload,
|
||||
LoginResult,
|
||||
MemberSummary,
|
||||
PipelineStep,
|
||||
PlatformMessageSummary,
|
||||
ProjectConfig,
|
||||
ProjectRefs,
|
||||
ReleaseRun,
|
||||
ReleaseStatus,
|
||||
SaveAgentConfigPayload,
|
||||
StepStatus,
|
||||
SystemSetting,
|
||||
UpdateMemberPermissionsPayload,
|
||||
UpdateMemberStatusPayload,
|
||||
} from '../types/devops'
|
||||
import { http } from './http'
|
||||
|
||||
@@ -243,6 +251,66 @@ export const devopsApi = {
|
||||
lastDataSource = 'backend'
|
||||
},
|
||||
|
||||
async getMembers(): Promise<MemberSummary[]> {
|
||||
const { data } = await http.get<MemberSummary[]>('/members')
|
||||
lastDataSource = 'backend'
|
||||
return Array.isArray(data) ? data : []
|
||||
},
|
||||
|
||||
async createMember(payload: CreateMemberPayload): Promise<MemberSummary> {
|
||||
const { data } = await http.post<MemberSummary>('/members', payload)
|
||||
lastDataSource = 'backend'
|
||||
return data
|
||||
},
|
||||
|
||||
async updateMemberPermissions(
|
||||
memberId: string,
|
||||
payload: UpdateMemberPermissionsPayload,
|
||||
): Promise<MemberSummary> {
|
||||
const { data } = await http.patch<MemberSummary>(
|
||||
`/members/${memberId}/permissions`,
|
||||
payload,
|
||||
)
|
||||
lastDataSource = 'backend'
|
||||
return data
|
||||
},
|
||||
|
||||
async resetMemberPassword(memberId: string): Promise<MemberSummary> {
|
||||
const { data } = await http.post<MemberSummary>(
|
||||
`/members/${memberId}/reset-password`,
|
||||
)
|
||||
lastDataSource = 'backend'
|
||||
return data
|
||||
},
|
||||
|
||||
async updateMemberStatus(
|
||||
memberId: string,
|
||||
payload: UpdateMemberStatusPayload,
|
||||
): Promise<MemberSummary> {
|
||||
const { data } = await http.patch<MemberSummary>(
|
||||
`/members/${memberId}/status`,
|
||||
payload,
|
||||
)
|
||||
lastDataSource = 'backend'
|
||||
return data
|
||||
},
|
||||
|
||||
async deleteMember(memberId: string): Promise<void> {
|
||||
await http.delete(`/members/${memberId}`)
|
||||
lastDataSource = 'backend'
|
||||
},
|
||||
|
||||
async getMessages(): Promise<PlatformMessageSummary[]> {
|
||||
const { data } = await http.get<PlatformMessageSummary[]>('/messages')
|
||||
lastDataSource = 'backend'
|
||||
return Array.isArray(data) ? data : []
|
||||
},
|
||||
|
||||
async markMessageHandled(messageId: string): Promise<void> {
|
||||
await http.post(`/messages/${messageId}/handled`)
|
||||
lastDataSource = 'backend'
|
||||
},
|
||||
|
||||
async getDashboard(): Promise<DashboardSummary> {
|
||||
const [health, backendProjects, backendRuns, integrationConfig] = await Promise.all([
|
||||
fetchHealth(),
|
||||
@@ -343,6 +411,28 @@ export const devopsApi = {
|
||||
return fetchIntegrationConfigStatus()
|
||||
},
|
||||
|
||||
async getAgentConfig(): Promise<AgentConfigSummary> {
|
||||
const { data } = await http.get<AgentConfigSummary>('/agent/config')
|
||||
lastDataSource = 'backend'
|
||||
return data
|
||||
},
|
||||
|
||||
async saveAgentConfig(
|
||||
payload: SaveAgentConfigPayload,
|
||||
): Promise<AgentConfigSummary> {
|
||||
const { data } = await http.put<AgentConfigSummary>('/agent/config', payload)
|
||||
lastDataSource = 'backend'
|
||||
return data
|
||||
},
|
||||
|
||||
async testAgentConfig(): Promise<AgentConnectionTestResult> {
|
||||
const { data } = await http.post<AgentConnectionTestResult>(
|
||||
'/agent/config/test',
|
||||
)
|
||||
lastDataSource = 'backend'
|
||||
return data
|
||||
},
|
||||
|
||||
async getReleaseProcessXml(): Promise<string> {
|
||||
const { data } = await http.get<BackendProcessDefinition>(
|
||||
'/process-definitions/release',
|
||||
|
||||
Reference in New Issue
Block a user