任务执行1-19
This commit is contained in:
@@ -35,6 +35,7 @@ export interface Document {
|
||||
tags: string
|
||||
attachments: string | null
|
||||
related_docs: string | null
|
||||
detection_point_ids: string | null
|
||||
metadata: string | null
|
||||
keywords: string
|
||||
remarks: string
|
||||
@@ -66,6 +67,7 @@ export interface CreateDocumentParams {
|
||||
sub_category?: string
|
||||
keywords?: string
|
||||
tags?: string
|
||||
detection_point_ids?: string
|
||||
remarks?: string
|
||||
}
|
||||
|
||||
@@ -80,6 +82,7 @@ export interface UpdateDocumentParams {
|
||||
sub_category?: string
|
||||
keywords?: string
|
||||
tags?: string
|
||||
detection_point_ids?: string
|
||||
remarks?: string
|
||||
}
|
||||
|
||||
|
||||
68
src/api/kb/knowledge.ts
Normal file
68
src/api/kb/knowledge.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
import { request } from '@/api/request'
|
||||
|
||||
export interface DetectionPoint {
|
||||
id: number
|
||||
resource_category: string
|
||||
metric_code: string
|
||||
alert_rule_id: number
|
||||
fault_type: string
|
||||
knowledge_type: 'document' | 'faq'
|
||||
knowledge_id: number
|
||||
knowledge_title: string
|
||||
enabled: boolean
|
||||
remarks: string
|
||||
}
|
||||
|
||||
export interface KnowledgeRecommendation {
|
||||
knowledge_type: 'document' | 'faq'
|
||||
knowledge_id: number
|
||||
title: string
|
||||
status: string
|
||||
resource_category: string
|
||||
metric_code: string
|
||||
alert_rule_id: number
|
||||
fault_type: string
|
||||
detection_point_id: number
|
||||
score: number
|
||||
reason: string
|
||||
}
|
||||
|
||||
export interface IncidentKnowledgeRelation {
|
||||
id: number
|
||||
incident_id: number
|
||||
ticket_id: number
|
||||
knowledge_type: 'document' | 'faq'
|
||||
knowledge_id: number
|
||||
knowledge_title: string
|
||||
relation_type: string
|
||||
source: string
|
||||
score: number
|
||||
reason: string
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export const fetchKnowledgeRecommendations = (params: {
|
||||
resource_category?: string
|
||||
metric_code?: string
|
||||
alert_rule_id?: number
|
||||
fault_type?: string
|
||||
limit?: number
|
||||
}) => request.get('/Kb/v1/knowledge/recommend', { params })
|
||||
|
||||
export const fetchIncidentKnowledge = (incidentId: number) => request.get(`/Kb/v1/knowledge/incidents/${incidentId}/relations`)
|
||||
|
||||
export const fetchTicketKnowledge = (ticketId: number) => request.get('/Kb/v1/knowledge/relations', { params: { ticket_id: ticketId } })
|
||||
|
||||
export const relateIncidentKnowledge = (data: {
|
||||
incident_id?: number
|
||||
ticket_id?: number
|
||||
knowledge_type: 'document' | 'faq'
|
||||
knowledge_id: number
|
||||
knowledge_title?: string
|
||||
relation_type?: string
|
||||
source?: string
|
||||
score?: number
|
||||
reason?: string
|
||||
}) => request.post('/Kb/v1/knowledge/relations', data)
|
||||
|
||||
export const createPostmortemDraft = (data: Record<string, any>) => request.post('/Kb/v1/knowledge/postmortem/draft', data)
|
||||
@@ -1,4 +1,5 @@
|
||||
import axios from 'axios'
|
||||
import { request } from '@/api/request'
|
||||
|
||||
export interface MessageRecord {
|
||||
id: number
|
||||
@@ -10,19 +11,89 @@ export interface MessageRecord {
|
||||
time: string
|
||||
status: 0 | 1
|
||||
messageType?: number
|
||||
deliveryStatus?: string
|
||||
channelType?: string
|
||||
attemptCount?: number
|
||||
lastError?: string
|
||||
incidentId?: number
|
||||
alertRecordId?: number
|
||||
nextRetryAt?: string
|
||||
}
|
||||
export type MessageListType = MessageRecord[]
|
||||
|
||||
export function queryMessageList() {
|
||||
return axios.post<MessageListType>('/api/message/list')
|
||||
interface ApiResponse<T> {
|
||||
code?: number
|
||||
message?: string
|
||||
data?: T
|
||||
details?: T
|
||||
}
|
||||
|
||||
/** 通知投递历史 */
|
||||
export interface NotificationDeliveryRecord {
|
||||
id: number
|
||||
incident_id: number
|
||||
alert_record_id: number
|
||||
channel_id: number
|
||||
channel_type: string
|
||||
target: string
|
||||
subject: string
|
||||
content: string
|
||||
status: string
|
||||
attempt_count: number
|
||||
next_retry_at?: string
|
||||
last_error?: string
|
||||
trace_id?: string
|
||||
delivered_at?: string
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
}
|
||||
|
||||
/** 投递历史查询参数 */
|
||||
export interface NotificationDeliveryQuery {
|
||||
page?: number
|
||||
page_size?: number
|
||||
keyword?: string
|
||||
incident_id?: number
|
||||
status?: string
|
||||
channel_type?: string
|
||||
}
|
||||
|
||||
/** 分页结果 */
|
||||
export interface PageResult<T> {
|
||||
total: number
|
||||
page: number
|
||||
page_size: number
|
||||
data: T[]
|
||||
}
|
||||
|
||||
function unwrapData<T>(response: ApiResponse<T> | T): T {
|
||||
const wrapped = response as ApiResponse<T>
|
||||
return (wrapped.details ?? wrapped.data ?? response) as T
|
||||
}
|
||||
|
||||
/** 查询站内消息列表 */
|
||||
export async function queryMessageList() {
|
||||
const response = await request.get<ApiResponse<MessageListType>>('/Alert/v1/message/list')
|
||||
return { data: unwrapData<MessageListType>(response) || [] }
|
||||
}
|
||||
|
||||
interface MessageStatus {
|
||||
ids: number[]
|
||||
}
|
||||
|
||||
/** 标记站内消息已读 */
|
||||
export function setMessageStatus(data: MessageStatus) {
|
||||
return axios.post<MessageListType>('/api/message/read', data)
|
||||
return request.post<ApiResponse<boolean>>('/Alert/v1/message/read', data)
|
||||
}
|
||||
|
||||
/** 查询通知投递历史 */
|
||||
export function queryNotificationDeliveryHistory(params?: NotificationDeliveryQuery) {
|
||||
return request.get<ApiResponse<PageResult<NotificationDeliveryRecord>>>('/Alert/v1/notification/deliveries', { params: params || {} })
|
||||
}
|
||||
|
||||
/** 人工补发通知 */
|
||||
export function resendNotificationDelivery(id: number) {
|
||||
return request.post<ApiResponse<{ delivery_id: number; status: string }>>(`/Alert/v1/notification/deliveries/${id}/resend`)
|
||||
}
|
||||
|
||||
export interface ChatRecord {
|
||||
|
||||
@@ -105,6 +105,11 @@ export const createAsset = (data: AssetForm) => {
|
||||
return request.post('/Assets/v1/asset/create', data)
|
||||
}
|
||||
|
||||
/** 批量导入资产 */
|
||||
export const bulkImportAssets = (data: { dry_run?: boolean; items: any[] }) => {
|
||||
return request.post('/Assets/v1/asset/bulk_import', data)
|
||||
}
|
||||
|
||||
/** 更新资产 */
|
||||
export const updateAsset = (data: AssetForm) => {
|
||||
return request.put('/Assets/v1/asset/update', data)
|
||||
@@ -146,3 +151,25 @@ export const fetchFloorOptions = (datacenterId: number) => {
|
||||
export const fetchRackOptions = (params?: { datacenter_id?: number; floor_id?: number }) => {
|
||||
return request.post('/Assets/v1/rack/list', params || {})
|
||||
}
|
||||
|
||||
/** 绑定资产和监控资源 */
|
||||
export const linkAssetResource = (data: {
|
||||
asset_id: number
|
||||
resource_uid: string
|
||||
display_name?: string
|
||||
business_system_id?: number
|
||||
health_status?: string
|
||||
alert_status?: string
|
||||
}) => {
|
||||
return request.post('/Assets/v1/asset/resource/link', data)
|
||||
}
|
||||
|
||||
/** 查询资产绑定的监控资源 */
|
||||
export const fetchAssetResourceBindings = (assetId: number) => {
|
||||
return request.get(`/Assets/v1/asset/resource/${assetId}`)
|
||||
}
|
||||
|
||||
/** 解除资产和监控资源绑定 */
|
||||
export const unlinkAssetResource = (assetId: number, resourceUid: string) => {
|
||||
return request.delete(`/Assets/v1/asset/resource/${assetId}`, { params: { resource_uid: resourceUid } })
|
||||
}
|
||||
|
||||
87
src/api/ops/automation.ts
Normal file
87
src/api/ops/automation.ts
Normal file
@@ -0,0 +1,87 @@
|
||||
import { request } from '@/api/request'
|
||||
|
||||
export interface AutomationScript {
|
||||
id: number
|
||||
name: string
|
||||
resource_category: string
|
||||
command_template: string
|
||||
approval_level: string
|
||||
rollback_command?: string
|
||||
rollback_required: boolean
|
||||
description?: string
|
||||
status: string
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
}
|
||||
|
||||
export interface AutomationExecution {
|
||||
id: number
|
||||
script_id: number
|
||||
mode: string
|
||||
status: string
|
||||
resource_uid: string
|
||||
rendered_command: string
|
||||
incident_id?: number
|
||||
ticket_id?: number
|
||||
approval_level: string
|
||||
approved_by?: string
|
||||
approved_at?: string
|
||||
operator?: string
|
||||
started_at?: string
|
||||
finished_at?: string
|
||||
timeout_sec?: number
|
||||
stdout?: string
|
||||
stderr?: string
|
||||
exit_code?: number
|
||||
error?: string
|
||||
audit_trail?: string
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
}
|
||||
|
||||
export interface AutomationRunRequest {
|
||||
resource_uid: string
|
||||
incident_id?: number
|
||||
ticket_id?: number
|
||||
operator?: string
|
||||
approver?: string
|
||||
approved?: boolean
|
||||
mode?: 'execute' | 'rollback'
|
||||
variables?: Record<string, string>
|
||||
}
|
||||
|
||||
export interface PageResponse<T> {
|
||||
total: number
|
||||
page: number
|
||||
page_size: number
|
||||
data: T[]
|
||||
}
|
||||
|
||||
export const fetchAutomationScripts = (params?: Record<string, any>) =>
|
||||
request.get<{ details: PageResponse<AutomationScript> }>('/DC-Control/v1/automation/scripts', { params })
|
||||
|
||||
export const createAutomationScript = (data: Partial<AutomationScript>) =>
|
||||
request.post<{ details: AutomationScript }>('/DC-Control/v1/automation/scripts', data)
|
||||
|
||||
export const updateAutomationScript = (id: number, data: Partial<AutomationScript>) =>
|
||||
request.put(`/DC-Control/v1/automation/scripts/${id}`, data)
|
||||
|
||||
export const deleteAutomationScript = (id: number) => request.delete(`/DC-Control/v1/automation/scripts/${id}`)
|
||||
|
||||
export const dryRunAutomationScript = (id: number, data: AutomationRunRequest) =>
|
||||
request.post<{ details: AutomationExecution }>(`/DC-Control/v1/automation/scripts/${id}/dry-run`, data)
|
||||
|
||||
export const requestAutomationExecution = (id: number, data: AutomationRunRequest) =>
|
||||
request.post<{ details: AutomationExecution }>(`/DC-Control/v1/automation/scripts/${id}/executions`, data)
|
||||
|
||||
export const executeAutomationScript = (id: number, data: AutomationRunRequest) =>
|
||||
request.post<{ details: AutomationExecution }>(`/DC-Control/v1/automation/scripts/${id}/execute`, data)
|
||||
|
||||
export const rollbackAutomationScript = (id: number, data: AutomationRunRequest) =>
|
||||
request.post<{ details: AutomationExecution }>(`/DC-Control/v1/automation/scripts/${id}/rollback`, data)
|
||||
|
||||
export const fetchAutomationExecutions = (params?: Record<string, any>) =>
|
||||
request.get<{ details: PageResponse<AutomationExecution> }>('/DC-Control/v1/automation/executions', { params })
|
||||
|
||||
export const approveAutomationExecution = (id: number, data: { approver: string; operator?: string }) =>
|
||||
request.post<{ details: AutomationExecution }>(`/DC-Control/v1/automation/executions/${id}/approve`, data)
|
||||
104
src/api/ops/bigScreen.ts
Normal file
104
src/api/ops/bigScreen.ts
Normal file
@@ -0,0 +1,104 @@
|
||||
import { request } from '@/api/request'
|
||||
|
||||
export interface ApiResponse<T = any> {
|
||||
code: number
|
||||
data?: T
|
||||
details?: T
|
||||
message?: string
|
||||
}
|
||||
|
||||
export interface BigScreen {
|
||||
id: number
|
||||
name: string
|
||||
description?: string
|
||||
thumbnail?: string
|
||||
group_id?: number
|
||||
goview_project_id?: string
|
||||
width: number
|
||||
height: number
|
||||
status: number
|
||||
publish_status: 'draft' | 'published' | 'offline' | string
|
||||
is_public?: boolean
|
||||
creator_name?: string
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
}
|
||||
|
||||
export interface BigScreenGroup {
|
||||
id: number
|
||||
name: string
|
||||
description?: string
|
||||
sort_order: number
|
||||
status: number
|
||||
}
|
||||
|
||||
export interface BigScreenPublish {
|
||||
id: number
|
||||
screen_id: number
|
||||
goview_project_id: string
|
||||
version: string
|
||||
publish_type: number
|
||||
status: number
|
||||
publisher_name?: string
|
||||
created_at?: string
|
||||
}
|
||||
|
||||
export interface BigScreenCarousel {
|
||||
id: number
|
||||
name: string
|
||||
screen_ids: Record<string, any>
|
||||
interval_seconds: number
|
||||
enabled: boolean
|
||||
}
|
||||
|
||||
export interface BigScreenSnapshot {
|
||||
id: number
|
||||
screen_id: number
|
||||
publish_id?: number
|
||||
file_name: string
|
||||
file_path: string
|
||||
file_size: number
|
||||
checksum?: string
|
||||
exporter_name?: string
|
||||
created_at?: string
|
||||
}
|
||||
|
||||
export interface PageResult<T> {
|
||||
total: number
|
||||
page: number
|
||||
page_size: number
|
||||
data: T[]
|
||||
}
|
||||
|
||||
export const fetchBigScreens = (params?: { page?: number; page_size?: number; keyword?: string }) =>
|
||||
request.get<ApiResponse<PageResult<BigScreen>>>('/Mgt/v1/screen', { params })
|
||||
|
||||
export const createBigScreen = (data: Partial<BigScreen>) =>
|
||||
request.post<ApiResponse<BigScreen>>('/Mgt/v1/screen', data)
|
||||
|
||||
export const updateBigScreen = (id: number, data: Partial<BigScreen>) =>
|
||||
request.put<ApiResponse<BigScreen>>(`/Mgt/v1/screen/${id}`, data)
|
||||
|
||||
export const publishBigScreen = (data: { screen_id: number; publish_type: 1 | 2; change_log?: string }) =>
|
||||
request.post<ApiResponse<BigScreenPublish>>('/Mgt/v1/publish', data)
|
||||
|
||||
export const fetchBigScreenPublishes = (params: { screen_id: number; page?: number; page_size?: number }) =>
|
||||
request.get<ApiResponse<PageResult<BigScreenPublish>>>('/Mgt/v1/publish', { params })
|
||||
|
||||
export const fetchBigScreenGroups = () =>
|
||||
request.get<ApiResponse<BigScreenGroup[]>>('/Mgt/v1/big-screen/groups')
|
||||
|
||||
export const createBigScreenGroup = (data: Partial<BigScreenGroup>) =>
|
||||
request.post<ApiResponse<BigScreenGroup>>('/Mgt/v1/big-screen/groups', data)
|
||||
|
||||
export const fetchBigScreenCarousels = () =>
|
||||
request.get<ApiResponse<BigScreenCarousel[]>>('/Mgt/v1/big-screen/carousels')
|
||||
|
||||
export const createBigScreenCarousel = (data: Partial<BigScreenCarousel>) =>
|
||||
request.post<ApiResponse<BigScreenCarousel>>('/Mgt/v1/big-screen/carousels', data)
|
||||
|
||||
export const fetchBigScreenSnapshots = (params?: { screen_id?: number }) =>
|
||||
request.get<ApiResponse<BigScreenSnapshot[]>>('/Mgt/v1/big-screen/snapshots', { params })
|
||||
|
||||
export const createBigScreenSnapshot = (data: Partial<BigScreenSnapshot>) =>
|
||||
request.post<ApiResponse<BigScreenSnapshot>>('/Mgt/v1/big-screen/snapshots', data)
|
||||
201
src/api/ops/businessSystem.ts
Normal file
201
src/api/ops/businessSystem.ts
Normal file
@@ -0,0 +1,201 @@
|
||||
import { request } from '@/api/request'
|
||||
|
||||
/** 业务系统基础信息 */
|
||||
export interface BusinessSystemItem {
|
||||
id: number
|
||||
code: string
|
||||
name: string
|
||||
system_type: string
|
||||
owner_user_id?: number
|
||||
department_id?: number
|
||||
description?: string
|
||||
status: string
|
||||
is_builtin: boolean
|
||||
health_score?: number
|
||||
health_level?: string
|
||||
resource_count?: number
|
||||
active_incident_count?: number
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
}
|
||||
|
||||
/** 分页响应 */
|
||||
export interface PageResult<T> {
|
||||
total: number
|
||||
page: number
|
||||
page_size: number
|
||||
data: T[]
|
||||
}
|
||||
|
||||
/** 业务系统列表查询参数 */
|
||||
export interface BusinessSystemListParams {
|
||||
page?: number
|
||||
size?: number
|
||||
keyword?: string
|
||||
status?: string
|
||||
}
|
||||
|
||||
/** 健康分扣分明细 */
|
||||
export interface BusinessHealthFactor {
|
||||
key: string
|
||||
label: string
|
||||
score_delta: number
|
||||
status: string
|
||||
description: string
|
||||
}
|
||||
|
||||
/** 业务健康摘要 */
|
||||
export interface BusinessHealth {
|
||||
business_system_id: number
|
||||
health: {
|
||||
score: number
|
||||
level: string
|
||||
deductions: Record<string, number>
|
||||
}
|
||||
signal_counts: {
|
||||
resources: number
|
||||
url_probes: number
|
||||
active_incidents: number
|
||||
sla_status: string
|
||||
}
|
||||
}
|
||||
|
||||
/** 业务系统资源成员 */
|
||||
export interface BusinessResourceMember {
|
||||
id: number
|
||||
resource_uid: string
|
||||
resource_id?: number
|
||||
role: string
|
||||
criticality: string
|
||||
weight: number
|
||||
description?: string
|
||||
}
|
||||
|
||||
/** 业务拓扑节点 */
|
||||
export interface BusinessTopologyNode {
|
||||
id?: number
|
||||
node_id: string
|
||||
resource_uid: string
|
||||
label: string
|
||||
type: string
|
||||
status: string
|
||||
}
|
||||
|
||||
/** 业务拓扑边 */
|
||||
export interface BusinessTopologyEdge {
|
||||
id?: number
|
||||
source_node_id: string
|
||||
target_node_id: string
|
||||
topology_id?: number
|
||||
}
|
||||
|
||||
/** 业务系统依赖关系 */
|
||||
export interface BusinessDependency {
|
||||
id: number
|
||||
business_system_id: number
|
||||
depends_on_business_system_id: number
|
||||
dependency_type: string
|
||||
criticality: string
|
||||
description?: string
|
||||
}
|
||||
|
||||
/** 业务拓扑 */
|
||||
export interface BusinessTopology {
|
||||
business_system_id: number
|
||||
resources: unknown[]
|
||||
dependencies: BusinessDependency[]
|
||||
nodes: BusinessTopologyNode[]
|
||||
links: BusinessTopologyEdge[]
|
||||
}
|
||||
|
||||
/** 业务时间线项 */
|
||||
export interface BusinessTimelineItem {
|
||||
source: 'raw_event' | 'alert' | 'incident' | 'ticket' | 'note' | 'document'
|
||||
source_id: string
|
||||
occurred_at: string
|
||||
title: string
|
||||
message: string
|
||||
severity?: string
|
||||
status?: string
|
||||
metadata?: Record<string, any>
|
||||
}
|
||||
|
||||
/** 业务笔记 */
|
||||
export interface BusinessNote {
|
||||
id: number
|
||||
business_system_id: number
|
||||
title?: string
|
||||
content: string
|
||||
author_user_id?: number
|
||||
author_name?: string
|
||||
visibility: string
|
||||
occurred_at: string
|
||||
created_at: string
|
||||
}
|
||||
|
||||
/** 关联知识或文档 */
|
||||
export interface BusinessDocumentLink {
|
||||
id: number
|
||||
business_system_id: number
|
||||
title: string
|
||||
url: string
|
||||
link_type: string
|
||||
description?: string
|
||||
created_at: string
|
||||
}
|
||||
|
||||
/** 列表响应 */
|
||||
export interface ListResult<T> {
|
||||
list: T[]
|
||||
count: number
|
||||
}
|
||||
|
||||
/** 获取业务系统列表 */
|
||||
export const fetchBusinessSystems = (params?: BusinessSystemListParams) =>
|
||||
request.get<{ code?: number; details?: PageResult<BusinessSystemItem>; message?: string }>('/DC-Control/v1/business-systems', { params })
|
||||
|
||||
/** 获取业务系统详情 */
|
||||
export const fetchBusinessSystemDetail = (id: number) =>
|
||||
request.get<{ code?: number; details?: BusinessSystemItem; message?: string }>(`/DC-Control/v1/business-systems/${id}`)
|
||||
|
||||
/** 获取业务健康摘要 */
|
||||
export const fetchBusinessHealth = (id: number) =>
|
||||
request.get<{ code?: number; details?: BusinessHealth; message?: string }>(`/DC-Control/v1/business-systems/${id}/health`)
|
||||
|
||||
/** 获取业务资源成员 */
|
||||
export const fetchBusinessMembers = (id: number) =>
|
||||
request.get<{ code?: number; details?: ListResult<BusinessResourceMember>; message?: string }>(`/DC-Control/v1/business-systems/${id}/resources`)
|
||||
|
||||
/** 获取业务拓扑 */
|
||||
export const fetchBusinessTopology = (id: number) =>
|
||||
request.get<{ code?: number; details?: BusinessTopology; message?: string }>(`/DC-Control/v1/business-systems/${id}/topology`)
|
||||
|
||||
/** 获取业务系统依赖 */
|
||||
export const fetchBusinessDependencies = (id: number) =>
|
||||
request.get<{ code?: number; details?: ListResult<BusinessDependency>; message?: string }>(`/DC-Control/v1/business-systems/${id}/dependencies`)
|
||||
|
||||
/** 创建业务系统依赖 */
|
||||
export const createBusinessDependency = (id: number, data: Partial<BusinessDependency>) =>
|
||||
request.post<{ code?: number; details?: BusinessDependency; message?: string }>(`/DC-Control/v1/business-systems/${id}/dependencies`, data)
|
||||
|
||||
/** 获取业务时间线 */
|
||||
export const fetchBusinessTimeline = (id: number, params?: { limit?: number }) =>
|
||||
request.get<{ code?: number; details?: ListResult<BusinessTimelineItem>; message?: string }>(`/DC-Control/v1/business-systems/${id}/timeline`, {
|
||||
params,
|
||||
})
|
||||
|
||||
/** 获取业务笔记 */
|
||||
export const fetchBusinessNotes = (id: number) =>
|
||||
request.get<{ code?: number; details?: ListResult<BusinessNote>; message?: string }>(`/DC-Control/v1/business-systems/${id}/notes`)
|
||||
|
||||
/** 创建业务笔记 */
|
||||
export const createBusinessNote = (id: number, data: { title: string; content: string }) =>
|
||||
request.post<{ code?: number; details?: BusinessNote; message?: string }>(`/DC-Control/v1/business-systems/${id}/notes`, data)
|
||||
|
||||
/** 获取业务文档链接 */
|
||||
export const fetchBusinessDocumentLinks = (id: number) =>
|
||||
request.get<{ code?: number; details?: ListResult<BusinessDocumentLink>; message?: string }>(`/DC-Control/v1/business-systems/${id}/documents`)
|
||||
|
||||
/** 新增业务文档链接 */
|
||||
export const createBusinessDocumentLink = (id: number, data: Partial<BusinessDocumentLink>) =>
|
||||
request.post<{ code?: number; details?: BusinessDocumentLink; message?: string }>(`/DC-Control/v1/business-systems/${id}/documents`, data)
|
||||
@@ -27,6 +27,11 @@ export const createDatacenter = (data: any) => {
|
||||
return request.post('/Assets/v1/datacenter/create', data)
|
||||
}
|
||||
|
||||
/** 批量导入数据中心 */
|
||||
export const bulkImportDatacenters = (data: { dry_run?: boolean; items: any[] }) => {
|
||||
return request.post('/Assets/v1/datacenter/bulk_import', data)
|
||||
}
|
||||
|
||||
/** 更新数据中心 */
|
||||
export const updateDatacenter = (data: any) => {
|
||||
return request.put('/Assets/v1/datacenter/update', data)
|
||||
@@ -56,3 +61,8 @@ export const fetchDatacenterByCity = (cityId: number) => {
|
||||
export const fetchDatacenterTree = () => {
|
||||
return request.get('/Assets/v1/datacenter/tree')
|
||||
}
|
||||
|
||||
/** 获取3D机房后端导出契约数据 */
|
||||
export const fetchDatacenterThreeDExport = (params?: { datacenter_ids?: string; room_ids?: string }) => {
|
||||
return request.get('/Assets/v1/three-d/export', { params })
|
||||
}
|
||||
|
||||
@@ -40,3 +40,179 @@ export const fetchCollectorStatistics = () => request.get('/DC-Control/v1/statis
|
||||
|
||||
/** 获取 许可证信息 */
|
||||
export const fetchLicenseInfo = () => request.get<{ code?: number; data?: LicenceConfig; message?: string }>('/DC-Control/v1/license')
|
||||
|
||||
export interface PageResult<T> {
|
||||
total: number
|
||||
page: number
|
||||
page_size: number
|
||||
data: T[]
|
||||
}
|
||||
|
||||
export interface OptionItem {
|
||||
id?: number
|
||||
label: string
|
||||
value: string
|
||||
}
|
||||
|
||||
export interface ControlResource {
|
||||
id: number
|
||||
resource_uid: string
|
||||
resource_category: string
|
||||
service_identity: string
|
||||
display_name: string
|
||||
description?: string
|
||||
status: string
|
||||
business_system_id?: number
|
||||
owner_user_id?: number
|
||||
department_id?: number
|
||||
asset_id?: number
|
||||
datacenter_id?: number
|
||||
room_id?: number
|
||||
rack_id?: number
|
||||
unit_start?: number
|
||||
unit_end?: number
|
||||
location_ref?: string
|
||||
tags?: string
|
||||
source_service?: string
|
||||
source_table?: string
|
||||
source_id?: number
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
}
|
||||
|
||||
export interface ControlResourceType {
|
||||
id: number
|
||||
resource_category: string
|
||||
display_name: string
|
||||
metric_template?: string
|
||||
supported_collect_method?: string
|
||||
description?: string
|
||||
enabled: boolean
|
||||
}
|
||||
|
||||
export interface ControlMetricDefinition {
|
||||
id: number
|
||||
metric_code: string
|
||||
metric_name: string
|
||||
resource_category: string
|
||||
unit?: string
|
||||
threshold_suggestion?: string
|
||||
collect_method?: string
|
||||
description?: string
|
||||
enabled: boolean
|
||||
}
|
||||
|
||||
export interface ControlMetricSeries {
|
||||
id: number
|
||||
resource_uid: string
|
||||
metric_code: string
|
||||
collection_task_id?: string
|
||||
storage_driver: string
|
||||
database_name?: string
|
||||
table_name?: string
|
||||
series_key?: string
|
||||
retention_policy?: string
|
||||
enabled: boolean
|
||||
}
|
||||
|
||||
export interface ControlBusinessSystem {
|
||||
id: number
|
||||
code: string
|
||||
name: string
|
||||
system_type: string
|
||||
owner_user_id?: number
|
||||
department_id?: number
|
||||
description?: string
|
||||
status: string
|
||||
is_builtin: boolean
|
||||
}
|
||||
|
||||
export interface ControlCollectionStatus {
|
||||
id: number
|
||||
resource_uid: string
|
||||
resource_category: string
|
||||
service_identity: string
|
||||
collect_method: string
|
||||
schedule_interval: number
|
||||
retry_policy?: string
|
||||
last_status: string
|
||||
last_error?: string
|
||||
last_sample_time?: string
|
||||
trace_id?: string
|
||||
source_service?: string
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
}
|
||||
|
||||
export interface ResourceListParams {
|
||||
page?: number
|
||||
size?: number
|
||||
keyword?: string
|
||||
resource_category?: string
|
||||
business_system_id?: number
|
||||
}
|
||||
|
||||
export interface MetricSeriesListParams {
|
||||
page?: number
|
||||
size?: number
|
||||
keyword?: string
|
||||
resource_uid?: string
|
||||
}
|
||||
|
||||
export const fetchControlResources = (params?: ResourceListParams) =>
|
||||
request.get<{ code?: number; details?: PageResult<ControlResource>; message?: string }>('/DC-Control/v1/resources', { params })
|
||||
|
||||
export const fetchControlResourceOptions = (params?: { resource_category?: string }) =>
|
||||
request.get<{ code?: number; details?: { list: OptionItem[]; count: number }; message?: string }>('/DC-Control/v1/resources/options', { params })
|
||||
|
||||
export const createControlResource = (data: Partial<ControlResource>) =>
|
||||
request.post<{ code?: number; details?: ControlResource; message?: string }>('/DC-Control/v1/resources', data)
|
||||
|
||||
export const updateControlResource = (id: number, data: Partial<ControlResource>) =>
|
||||
request.put<{ code?: number; details?: ControlResource; message?: string }>(`/DC-Control/v1/resources/${id}`, data)
|
||||
|
||||
export const deleteControlResource = (id: number) =>
|
||||
request.delete<{ code?: number; details?: { message: string }; message?: string }>(`/DC-Control/v1/resources/${id}`)
|
||||
|
||||
export const backfillControlResources = () =>
|
||||
request.post<{ code?: number; details?: { message: string }; message?: string }>('/DC-Control/v1/resources/backfill')
|
||||
|
||||
export const fetchControlResourceTypes = (params?: { page?: number; size?: number; keyword?: string }) =>
|
||||
request.get<{ code?: number; details?: PageResult<ControlResourceType>; message?: string }>('/DC-Control/v1/resource-types', { params })
|
||||
|
||||
export const fetchControlResourceTypeOptions = () =>
|
||||
request.get<{ code?: number; details?: { list: OptionItem[]; count: number }; message?: string }>('/DC-Control/v1/resource-types/options')
|
||||
|
||||
export const fetchControlMetricDefinitions = (params?: { page?: number; size?: number; keyword?: string; resource_category?: string }) =>
|
||||
request.get<{ code?: number; details?: PageResult<ControlMetricDefinition>; message?: string }>(
|
||||
'/DC-Control/v1/metric-definitions',
|
||||
{ params }
|
||||
)
|
||||
|
||||
export const fetchControlMetricDefinitionOptions = (params?: { resource_category?: string }) =>
|
||||
request.get<{ code?: number; details?: { list: OptionItem[]; count: number }; message?: string }>(
|
||||
'/DC-Control/v1/metric-definitions/options',
|
||||
{ params }
|
||||
)
|
||||
|
||||
export const fetchControlMetricSeries = (params?: MetricSeriesListParams) =>
|
||||
request.get<{ code?: number; details?: PageResult<ControlMetricSeries>; message?: string }>('/DC-Control/v1/metric-series', { params })
|
||||
|
||||
export const fetchControlBusinessSystems = (params?: { page?: number; size?: number; keyword?: string; status?: string }) =>
|
||||
request.get<{ code?: number; details?: PageResult<ControlBusinessSystem>; message?: string }>('/DC-Control/v1/business-systems', { params })
|
||||
|
||||
export const fetchControlBusinessSystemOptions = () =>
|
||||
request.get<{ code?: number; details?: { list: OptionItem[]; count: number }; message?: string }>('/DC-Control/v1/business-systems/options')
|
||||
|
||||
export const fetchCollectionStatus = (params?: {
|
||||
page?: number
|
||||
size?: number
|
||||
keyword?: string
|
||||
resource_category?: string
|
||||
resource_uid?: string
|
||||
status?: string
|
||||
}) =>
|
||||
request.get<{ code?: number; details?: PageResult<ControlCollectionStatus>; message?: string }>(
|
||||
'/DC-Control/v1/collection/status',
|
||||
{ params }
|
||||
)
|
||||
|
||||
@@ -67,6 +67,9 @@ export const fetchFeedbackTickets = (data?: {
|
||||
creator_id?: number
|
||||
assignee_id?: number
|
||||
category_id?: number
|
||||
incident_id?: number
|
||||
resource_uid?: string
|
||||
business_system_id?: number
|
||||
keyword?: string
|
||||
/** 格式 YYYY-MM-DD HH:MM:SS */
|
||||
start_time?: string
|
||||
@@ -147,3 +150,6 @@ export const deleteFeedbackTicketRelation = (relationId: number) => request.dele
|
||||
|
||||
/** 获取 工单统计数据 */
|
||||
export const fetchFeedbackTicketStatistics = () => request.get('/Feedback/v1/tickets/statistics')
|
||||
|
||||
/** 获取 工单 SLA/SLO 统计数据 */
|
||||
export const fetchFeedbackTicketSLAStatistics = () => request.get('/Feedback/v1/tickets/sla/statistics')
|
||||
|
||||
81
src/api/ops/governance.ts
Normal file
81
src/api/ops/governance.ts
Normal file
@@ -0,0 +1,81 @@
|
||||
import { request } from '@/api/request'
|
||||
|
||||
export interface AlertQualityScore {
|
||||
rule_id: number
|
||||
resource_uid: string
|
||||
business_system_id: number
|
||||
window_start: string
|
||||
window_end: string
|
||||
score: number
|
||||
repeat_count: number
|
||||
notify_count: number
|
||||
avg_ack_seconds: number
|
||||
avg_resolve_seconds: number
|
||||
reopen_rate: number
|
||||
factors: string[]
|
||||
}
|
||||
|
||||
export interface NoiseBucket {
|
||||
rule_id: number
|
||||
resource_uid: string
|
||||
business_system_id: number
|
||||
window_start: string
|
||||
window_end: string
|
||||
alert_count: number
|
||||
notify_count: number
|
||||
noise_score: number
|
||||
}
|
||||
|
||||
export interface RuleSuggestion {
|
||||
type: string
|
||||
priority: string
|
||||
rule_id: number
|
||||
resource_uid?: string
|
||||
business_system_id?: number
|
||||
reason: string
|
||||
action: string
|
||||
}
|
||||
|
||||
export interface CapacityRisk {
|
||||
resource_uid: string
|
||||
metric_code: string
|
||||
unit: string
|
||||
current_value: number
|
||||
threshold: number
|
||||
slope_per_hour: number
|
||||
risk_level: string
|
||||
predicted_at?: string
|
||||
sample_count: number
|
||||
}
|
||||
|
||||
export interface SloDashboardBucket {
|
||||
total: number
|
||||
response_breached: number
|
||||
resolve_breached: number
|
||||
breached: number
|
||||
breach_rate: number
|
||||
}
|
||||
|
||||
export interface SloDashboard {
|
||||
total_closed: number
|
||||
response_breached: number
|
||||
resolve_breached: number
|
||||
overall_breached: number
|
||||
breach_rate: number
|
||||
by_business_system: Record<string, SloDashboardBucket>
|
||||
by_resource_category: Record<string, SloDashboardBucket>
|
||||
}
|
||||
|
||||
export const fetchAlertQualityScores = (params?: { hours?: number }) =>
|
||||
request.get<AlertQualityScore[]>('/Alert/v1/governance/quality', { params })
|
||||
|
||||
export const fetchAlertNoise = (params?: { hours?: number }) =>
|
||||
request.get<NoiseBucket[]>('/Alert/v1/governance/noise', { params })
|
||||
|
||||
export const fetchRuleSuggestions = (params?: { hours?: number }) =>
|
||||
request.get<RuleSuggestion[]>('/Alert/v1/governance/suggestions', { params })
|
||||
|
||||
export const fetchCapacityRisk = (params?: { resource_uid?: string; metric_code?: string }) =>
|
||||
request.get<CapacityRisk>('/DC-Control/v1/risk/capacity', { params })
|
||||
|
||||
export const fetchSloDashboard = () => request.get<SloDashboard>('/Feedback/v1/tickets/slo/dashboard')
|
||||
52
src/api/ops/incident.ts
Normal file
52
src/api/ops/incident.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import { request } from '@/api/request'
|
||||
|
||||
export interface Incident {
|
||||
id: number
|
||||
created_at: string
|
||||
updated_at: string
|
||||
incident_no: string
|
||||
dedup_key: string
|
||||
status: string
|
||||
severity: string
|
||||
resource_uid: string
|
||||
business_system_id: number
|
||||
owner_user_id: number
|
||||
summary: string
|
||||
description: string
|
||||
labels: string
|
||||
annotations: string
|
||||
raw_event_id: number
|
||||
latest_alert_record_id: number
|
||||
alert_count: number
|
||||
suppressed: boolean
|
||||
suppression_reason: string
|
||||
opened_at: string
|
||||
assigned_at?: string
|
||||
in_progress_at?: string
|
||||
suspended_at?: string
|
||||
resolved_at?: string
|
||||
closed_at?: string
|
||||
}
|
||||
|
||||
export const fetchIncidents = (params: {
|
||||
page?: number
|
||||
page_size?: number
|
||||
keyword?: string
|
||||
status?: string
|
||||
severity?: string
|
||||
resource_uid?: string
|
||||
business_system_id?: number
|
||||
owner_user_id?: number
|
||||
suppressed?: boolean
|
||||
sort?: string
|
||||
order?: string
|
||||
}) => request.get('/Alert/v1/incidents/list', { params })
|
||||
|
||||
export const fetchIncidentDetail = (id: number) => request.get(`/Alert/v1/incidents/get/${id}`)
|
||||
|
||||
export const fetchIncidentAlerts = (id: number) => request.get(`/Alert/v1/incidents/${id}/alerts`)
|
||||
|
||||
export const fetchIncidentTimeline = (id: number) => request.get(`/Alert/v1/incidents/${id}/timeline`)
|
||||
|
||||
export const transitionIncident = (id: number, data: { status: string; comment?: string; operator?: string }) =>
|
||||
request.post(`/Alert/v1/incidents/${id}/transition`, data)
|
||||
@@ -53,6 +53,8 @@ export interface IPAddressItem {
|
||||
source_type: SourceType
|
||||
owner_type: string
|
||||
owner_id: number
|
||||
resource_uid?: string
|
||||
asset_id?: number
|
||||
remark: string
|
||||
tags: string
|
||||
created_at: string
|
||||
@@ -90,6 +92,8 @@ export interface IPAddressFormData {
|
||||
source_type?: SourceType
|
||||
owner_type?: string
|
||||
owner_id?: number
|
||||
resource_uid?: string
|
||||
asset_id?: number
|
||||
remark?: string
|
||||
tags?: string
|
||||
}
|
||||
@@ -133,6 +137,8 @@ export interface IPSubnetItem {
|
||||
group_name?: string
|
||||
gateway: string
|
||||
vlan: string
|
||||
resource_uid?: string
|
||||
asset_id?: number
|
||||
total: number
|
||||
used: number
|
||||
available: number
|
||||
@@ -147,6 +153,8 @@ export interface IPSubnetListParams {
|
||||
page?: number
|
||||
size?: number
|
||||
group_id?: number
|
||||
resource_uid?: string
|
||||
asset_id?: number
|
||||
keyword?: string
|
||||
}
|
||||
|
||||
@@ -165,6 +173,8 @@ export interface IPSubnetFormData {
|
||||
group_id?: number
|
||||
gateway?: string
|
||||
vlan?: string
|
||||
resource_uid?: string
|
||||
asset_id?: number
|
||||
reserved_ranges_json?: string
|
||||
description?: string
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ export interface LogEvent {
|
||||
severity_code: string
|
||||
trap_oid: string
|
||||
alert_sent: boolean
|
||||
dispatch_status: string
|
||||
}
|
||||
|
||||
export interface LogEntriesParams {
|
||||
@@ -73,8 +74,12 @@ export interface SyslogRule {
|
||||
priority: number
|
||||
device_name_contains: string
|
||||
keyword_regex: string
|
||||
source_match: string
|
||||
message_regex: string
|
||||
alert_name: string
|
||||
severity_code: string
|
||||
severity_mapping_json: string
|
||||
resource_uid_extract_regex: string
|
||||
policy_id: number
|
||||
}
|
||||
|
||||
@@ -97,9 +102,14 @@ export interface TrapDictionaryEntry {
|
||||
created_at?: string
|
||||
updated_at?: string
|
||||
oid_prefix: string
|
||||
vendor: string
|
||||
oid: string
|
||||
name: string
|
||||
title: string
|
||||
description: string
|
||||
severity_code: string
|
||||
severity_mapping_json: string
|
||||
parse_expression: string
|
||||
recovery_message: string
|
||||
enabled: boolean
|
||||
}
|
||||
@@ -116,6 +126,69 @@ export interface TrapShield {
|
||||
time_windows_json: string
|
||||
}
|
||||
|
||||
export interface AuditLog {
|
||||
id: number
|
||||
created_at: string
|
||||
trace_id: string
|
||||
source_service: string
|
||||
actor_id: string
|
||||
actor_name: string
|
||||
action: string
|
||||
object_type: string
|
||||
object_id: string
|
||||
operation_risk: string
|
||||
approval_id: string
|
||||
request_method: string
|
||||
request_path: string
|
||||
client_ip: string
|
||||
before_json: string
|
||||
after_json: string
|
||||
result: string
|
||||
error_message: string
|
||||
}
|
||||
|
||||
export interface AuditLogParams {
|
||||
page?: number
|
||||
page_size?: number
|
||||
source_service?: string
|
||||
actor_id?: string
|
||||
action?: string
|
||||
object_type?: string
|
||||
object_id?: string
|
||||
operation_risk?: string
|
||||
result?: string
|
||||
}
|
||||
|
||||
export interface DangerousApproval {
|
||||
id: number
|
||||
created_at: string
|
||||
updated_at: string
|
||||
request_id: string
|
||||
source_service: string
|
||||
action: string
|
||||
object_type: string
|
||||
object_id: string
|
||||
requester_id: string
|
||||
requester_name: string
|
||||
reason: string
|
||||
before_json: string
|
||||
after_json: string
|
||||
status: string
|
||||
reviewer_id: string
|
||||
reviewer_name: string
|
||||
review_comment: string
|
||||
reviewed_at: string
|
||||
}
|
||||
|
||||
export interface ApprovalParams {
|
||||
page?: number
|
||||
page_size?: number
|
||||
source_service?: string
|
||||
status?: string
|
||||
requester_id?: string
|
||||
object_type?: string
|
||||
}
|
||||
|
||||
export function fetchLogEntries(params?: LogEntriesParams) {
|
||||
return request.get(`${BASE}/entries`, { params })
|
||||
}
|
||||
@@ -128,6 +201,10 @@ export function retryAlertOutbox(id: number) {
|
||||
return request.post(`${BASE}/alert-outbox/${id}/retry`)
|
||||
}
|
||||
|
||||
export function replayLogEntry(id: number) {
|
||||
return request.post(`${BASE}/entries/${id}/replay`)
|
||||
}
|
||||
|
||||
export function fetchSyslogRules() {
|
||||
return request.get(`${BASE}/syslog-rules`)
|
||||
}
|
||||
@@ -191,3 +268,23 @@ export function updateTrapSuppression(id: number, data: Partial<TrapShield>) {
|
||||
export function deleteTrapSuppression(id: number) {
|
||||
return request.delete(`${BASE}/trap-suppressions/${id}`)
|
||||
}
|
||||
|
||||
export function fetchAuditLogs(params?: AuditLogParams) {
|
||||
return request.get(`${BASE}/audit/logs`, { params })
|
||||
}
|
||||
|
||||
export function fetchDangerousApprovals(params?: ApprovalParams) {
|
||||
return request.get(`${BASE}/audit/approvals`, { params })
|
||||
}
|
||||
|
||||
export function createDangerousApproval(data: Partial<DangerousApproval>) {
|
||||
return request.post(`${BASE}/audit/approvals`, data)
|
||||
}
|
||||
|
||||
export function approveDangerousApproval(id: number, data: { reviewer_id: string; reviewer_name?: string; review_comment?: string }) {
|
||||
return request.post(`${BASE}/audit/approvals/${id}/approve`, data)
|
||||
}
|
||||
|
||||
export function rejectDangerousApproval(id: number, data: { reviewer_id: string; reviewer_name?: string; review_comment?: string }) {
|
||||
return request.post(`${BASE}/audit/approvals/${id}/reject`, data)
|
||||
}
|
||||
|
||||
@@ -68,6 +68,7 @@ export interface TopologyNode {
|
||||
label: string
|
||||
type: string
|
||||
ip?: string
|
||||
resource_uid?: string
|
||||
status?: string
|
||||
alerts?: number
|
||||
traffic?: string
|
||||
@@ -83,6 +84,30 @@ export interface TopologyNode {
|
||||
updated_at?: string
|
||||
}
|
||||
|
||||
export interface ImpactResource {
|
||||
resource_uid: string
|
||||
display_name?: string
|
||||
business_system_id?: number
|
||||
direction?: 'upstream' | 'downstream'
|
||||
depth?: number
|
||||
}
|
||||
|
||||
export interface AffectedIP {
|
||||
ip_address: string
|
||||
resource_uid?: string
|
||||
asset_id?: number
|
||||
subnet_id?: number
|
||||
}
|
||||
|
||||
export interface ImpactAnalysis {
|
||||
resource_uid: string
|
||||
incident_id?: number
|
||||
upstream_resources: ImpactResource[]
|
||||
downstream_resources: ImpactResource[]
|
||||
business_systems: number[]
|
||||
affected_ips: AffectedIP[]
|
||||
}
|
||||
|
||||
// ==================== 分组管理接口 ====================
|
||||
|
||||
/** 获取分组列表 */
|
||||
@@ -126,6 +151,9 @@ export const fetchTopologyView = (id: number) => request.get(`/DC-Control/v1/top
|
||||
/** 获取拓扑图数据(用于前端可视化) */
|
||||
export const fetchTopologyGraph = (id: number) => request.get(`/DC-Control/v1/topologies/${id}/graph`)
|
||||
|
||||
export const fetchImpactAnalysis = (params: { resource_uid: string; topology_id?: number; incident_id?: number; depth?: number }) =>
|
||||
request.get<ImpactAnalysis>('/DC-Control/v1/impact/analyze', { params })
|
||||
|
||||
// ==================== 节点管理接口 ====================
|
||||
|
||||
/** 创建节点 */
|
||||
|
||||
@@ -24,6 +24,22 @@ export const createNoticeChannel = (data: {
|
||||
retry_interval?: number
|
||||
enabled?: boolean
|
||||
description?: string
|
||||
email_smtp_host?: string
|
||||
email_smtp_port?: number
|
||||
email_username?: string
|
||||
email_password?: string
|
||||
email_from?: string
|
||||
email_to?: string[]
|
||||
email_cc?: string[]
|
||||
email_bcc?: string[]
|
||||
email_use_tls?: boolean
|
||||
sms_provider?: string
|
||||
sms_access_key_id?: string
|
||||
sms_access_key_secret?: string
|
||||
sms_sign_name?: string
|
||||
sms_template_code?: string
|
||||
sms_phones?: string[]
|
||||
in_app_targets?: string[]
|
||||
}) => {
|
||||
return request.post('/Alert/v1/channel/create', data)
|
||||
}
|
||||
@@ -43,6 +59,22 @@ export const updateNoticeChannel = (data: {
|
||||
retry_interval?: number
|
||||
enabled?: boolean
|
||||
description?: string
|
||||
email_smtp_host?: string
|
||||
email_smtp_port?: number
|
||||
email_username?: string
|
||||
email_password?: string
|
||||
email_from?: string
|
||||
email_to?: string[]
|
||||
email_cc?: string[]
|
||||
email_bcc?: string[]
|
||||
email_use_tls?: boolean
|
||||
sms_provider?: string
|
||||
sms_access_key_id?: string
|
||||
sms_access_key_secret?: string
|
||||
sms_sign_name?: string
|
||||
sms_template_code?: string
|
||||
sms_phones?: string[]
|
||||
in_app_targets?: string[]
|
||||
}) => {
|
||||
return request.post('/Alert/v1/channel/update', data)
|
||||
}
|
||||
|
||||
@@ -41,6 +41,11 @@ export const createRack = (data: any) => {
|
||||
return request.post('/Assets/v1/rack/create', data)
|
||||
}
|
||||
|
||||
/** 批量导入机柜并初始化U位 */
|
||||
export const bulkImportRacks = (data: { dry_run?: boolean; items: any[] }) => {
|
||||
return request.post('/Assets/v1/rack/bulk_import', data)
|
||||
}
|
||||
|
||||
/** 更新机柜 */
|
||||
export const updateRack = (data: any) => {
|
||||
return request.put('/Assets/v1/rack/update', data)
|
||||
|
||||
40
src/api/ops/rawEvent.ts
Normal file
40
src/api/ops/rawEvent.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { request } from '@/api/request'
|
||||
|
||||
export interface RawEvent {
|
||||
id: number
|
||||
created_at: string
|
||||
updated_at: string
|
||||
source_type: string
|
||||
resource_uid: string
|
||||
event_time: string
|
||||
severity: string
|
||||
title: string
|
||||
message: string
|
||||
labels: string
|
||||
annotations: string
|
||||
parse_status: string
|
||||
raw_payload: string
|
||||
trace_id: string
|
||||
alert_record_id: number
|
||||
replay_count: number
|
||||
last_replayed_at?: string
|
||||
}
|
||||
|
||||
export const fetchRawEvents = (params: {
|
||||
page?: number
|
||||
page_size?: number
|
||||
keyword?: string
|
||||
source_type?: string
|
||||
resource_uid?: string
|
||||
severity?: string
|
||||
parse_status?: string
|
||||
trace_id?: string
|
||||
start_time?: string
|
||||
end_time?: string
|
||||
sort?: string
|
||||
order?: string
|
||||
}) => request.get('/Alert/v1/raw-events/list', { params })
|
||||
|
||||
export const fetchRawEventDetail = (id: number) => request.get(`/Alert/v1/raw-events/get/${id}`)
|
||||
|
||||
export const replayRawEvent = (id: number) => request.post(`/Alert/v1/raw-events/replay/${id}`)
|
||||
@@ -18,6 +18,7 @@ export enum ReportType {
|
||||
FAULT = 'fault',
|
||||
SERVER = 'server',
|
||||
NETWORK_DEVICE = 'network_device',
|
||||
EVIDENCE = 'evidence',
|
||||
}
|
||||
|
||||
export enum ReportStatus {
|
||||
@@ -150,7 +151,7 @@ export interface HistoryReportParams {
|
||||
}
|
||||
|
||||
export interface TopNReportParams {
|
||||
data_source: 'dc-host' | 'dc-network' | 'dc-database' | 'dc-middleware'
|
||||
data_source: 'dc-host' | 'dc-network' | 'dc-database' | 'dc-middleware' | 'alert'
|
||||
metric_id?: string
|
||||
metric_name?: string
|
||||
target_identities: string[]
|
||||
@@ -163,6 +164,28 @@ export interface TopNReportParams {
|
||||
collector_identity?: string
|
||||
}
|
||||
|
||||
/** 证据导出事件行 */
|
||||
export interface EvidenceEvent {
|
||||
event_time: string
|
||||
action: string
|
||||
actor?: string
|
||||
message?: string
|
||||
source_id?: string
|
||||
details?: Record<string, any>
|
||||
}
|
||||
|
||||
/** POST /reports/evidence/export */
|
||||
export interface EvidenceExportParams {
|
||||
incident_id: number
|
||||
resource_uid?: string
|
||||
business_system_id?: number
|
||||
title?: string
|
||||
timeline?: EvidenceEvent[]
|
||||
notifications?: EvidenceEvent[]
|
||||
ticket_logs?: EvidenceEvent[]
|
||||
audit_logs?: EvidenceEvent[]
|
||||
}
|
||||
|
||||
export interface GenerateReportParams {
|
||||
report_type: ReportType
|
||||
title?: string
|
||||
@@ -195,6 +218,10 @@ export const generateReport = (data: GenerateReportParams) =>
|
||||
export const createReportAsyncJob = (data: GenerateReportParams) =>
|
||||
request.post<ApiResponse<ReportRecord>>('/DC-Control/v1/reports/jobs', data)
|
||||
|
||||
/** 生成 incident 证据导出记录 */
|
||||
export const exportEvidenceReport = (data: EvidenceExportParams) =>
|
||||
request.post<ApiResponse<ReportRecord>>('/DC-Control/v1/reports/evidence/export', data)
|
||||
|
||||
/** 指标发现(时间窗内有样本的 metric_name) */
|
||||
export const fetchReportMetricsAvailable = (params: {
|
||||
data_source: string
|
||||
|
||||
@@ -49,3 +49,8 @@ export const cancelReservation = (data: { rack_id: number; start_unit: number; e
|
||||
export const updateUnitStatus = (data: { rack_id: number; start_unit: number; end_unit: number; status: 'available' | 'disabled' }) => {
|
||||
return request.put('/Assets/v1/unit/status', data)
|
||||
}
|
||||
|
||||
/** 获取U位容量趋势 */
|
||||
export const fetchUnitTrend = (params?: { datacenter_id?: number; months?: number }) => {
|
||||
return request.get('/Assets/v1/capacity/unit/trend', { params })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user