移除告警规则界面、恢复 Chat 端点并优化列表
CI / test (push) Successful in 25s
Release / release (push) Successful in 26s

This commit is contained in:
2026-07-13 10:08:08 +08:00
parent 94fbe62e4c
commit 2ea5b73de2
17 changed files with 73 additions and 402 deletions
-23
View File
@@ -1,8 +1,6 @@
import { mockLogEvents, mockLogRelays, mockLogWebhooks } from './mock'
import { mockOn, mocked, request } from './request'
import type {
AlertRule,
AlertRuleBody,
LogEventPage,
LogRelayView,
LogWebhookInfo,
@@ -30,27 +28,6 @@ export function listLogEvents(params: LogEventParams): Promise<LogEventPage> {
return request('/log-events', { query: { ...params } })
}
// ---- 告警规则 ----
export function listAlertRules(): Promise<AlertRule[]> {
if (mockOn) return mocked([])
return request<{ items: AlertRule[] }>('/log-events/alert-rules').then((r) => r.items)
}
export function createAlertRule(body: AlertRuleBody): Promise<AlertRule> {
if (mockOn) return mocked({ ...body, id: 1, createdAt: '', updatedAt: '' }, 300)
return request('/log-events/alert-rules', { method: 'POST', body })
}
export function updateAlertRule(id: number, body: AlertRuleBody): Promise<AlertRule> {
if (mockOn) return mocked({ ...body, id, createdAt: '', updatedAt: '' }, 300)
return request(`/log-events/alert-rules/${id}`, { method: 'PUT', body })
}
export function deleteAlertRule(id: number): Promise<void> {
if (mockOn) return mocked(undefined, 300)
return request(`/log-events/alert-rules/${id}`, { method: 'DELETE' })
}
export function getLogWebhook(cfgId: number): Promise<LogWebhookState> {
if (mockOn) {
const info = mockLogWebhooks.get(cfgId)