移除告警规则界面、恢复 Chat 端点并优化列表
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user