fix: AlertCenter崩溃修复——字段名映射+notify_channels安全解析
- AlertRule接口与后端对齐(id:number/notify_channels:string) - 告警事件数据映射(rule_name→title, message→description, target→source) - notify_channels安全解析(JSON.parse+try-catch替代直接.map) - labels/annotations字符串转对象安全处理 - Header tab栏移除(侧边栏导航足够) - SQL审计API改为真实后端调用
This commit is contained in:
1 parent
b9f1e28319
commit
e4958feb1b
3 files changed
+87
-59
No files matched your search
@@ -524,13 +524,39 @@ export const auditApi = {
|
||||
|
||||
// ==================== SQL 审计 API(暂无后端,返回空结果优雅降级) ====================
|
||||
export const sqlAuditApi = {
|
||||
getRecords: async () => ({ data: [], total: 0 }),
|
||||
getRules: async () => ({ data: [], total: 0 }),
|
||||
analyzeSQL: async (_data: { sql: string }) => ({ data: { id: 0, riskLevel: 'low', rules: [] } }),
|
||||
approve: async (_id: string) => ({ success: true }),
|
||||
reject: async (_id: string) => ({ success: true }),
|
||||
execute: async (_id: string) => ({ success: true }),
|
||||
toggleRule: async (_ruleId: string, _enabled: boolean) => ({ success: true }),
|
||||
getRecords: async (params?: Record<string, string>) => {
|
||||
return http.get<ListResponse>('/sql-audit/records', params);
|
||||
},
|
||||
getRules: async () => {
|
||||
return http.get<ListResponse>('/sql-audit/rules');
|
||||
},
|
||||
analyzeSQL: async (data: { sql: string; database_name?: string; application?: string }) => {
|
||||
return http.post('/sql-audit/analyze', data);
|
||||
},
|
||||
approve: async (id: string | number) => {
|
||||
return http.post(`/sql-audit/records/${id}/approve`);
|
||||
},
|
||||
reject: async (id: string | number) => {
|
||||
return http.post(`/sql-audit/records/${id}/reject`);
|
||||
},
|
||||
execute: async (id: string | number) => {
|
||||
return http.post(`/sql-audit/records/${id}/execute`);
|
||||
},
|
||||
deleteRecord: async (id: string | number) => {
|
||||
return http.delete(`/sql-audit/records/${id}`);
|
||||
},
|
||||
createRule: async (data: any) => {
|
||||
return http.post('/sql-audit/rules', data);
|
||||
},
|
||||
updateRule: async (id: string | number, data: any) => {
|
||||
return http.put(`/sql-audit/rules/${id}`, data);
|
||||
},
|
||||
deleteRule: async (id: string | number) => {
|
||||
return http.delete(`/sql-audit/rules/${id}`);
|
||||
},
|
||||
toggleRule: async (ruleId: string | number) => {
|
||||
return http.post(`/sql-audit/rules/${ruleId}/toggle`);
|
||||
},
|
||||
};
|
||||
|
||||
// ==================== Ansible 自动化 API ====================
|
||||
|
||||
Reference in new issue
Block a user