From 92c709eeecc38fdfce34546d302f702ffe449a34 Mon Sep 17 00:00:00 2001 From: wanghaohao Date: Wed, 30 Oct 2024 14:29:31 +0800 Subject: [PATCH] add alert list page --- web/src/api/prometheus.ts | 22 ++++- web/src/router/index.ts | 6 ++ web/src/views/alertList.vue | 157 ++++++++++++++++++++++++++++++++++++ 3 files changed, 183 insertions(+), 2 deletions(-) create mode 100644 web/src/views/alertList.vue diff --git a/web/src/api/prometheus.ts b/web/src/api/prometheus.ts index 08c71c5..7b7b3b1 100644 --- a/web/src/api/prometheus.ts +++ b/web/src/api/prometheus.ts @@ -53,7 +53,7 @@ export function addConfigRule(data: object) { // 编辑告警告警规则 export function updateConfigRule(data: object) { return request({ - url: "/alert/update", + url: " /plugin/prometheus/ruleUpdate", method: "post", data, }); @@ -63,7 +63,7 @@ export function updateConfigRule(data: object) { // 删除告警告警规则 export function delConfigRule(data: { id: number }) { return request({ - url: "/alert/delete", + url: "/plugin/prometheus/ruleDelete", method: "get", params: data, }); @@ -84,4 +84,22 @@ export function getExporterList(data: object) { method: "get", params: data, }); +} + +// 获取所有历史告警 +export function getHistoryAlerts(data: Object) { + return request({ + url: "/plugin/prometheus/alertQuery", + method: "get", + params: data, + }); +} + +// 变更告警状态 +export function updateAlertState(data: Object) { + return request({ + url: "/plugin/prometheus/alertUpdateState", + method: "post", + data, + }); } \ No newline at end of file diff --git a/web/src/router/index.ts b/web/src/router/index.ts index f425bf0..e3c4d0a 100644 --- a/web/src/router/index.ts +++ b/web/src/router/index.ts @@ -1,6 +1,7 @@ import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router' import HomeView from '../views/HomeView.vue' import RuleList from '../views/ruleList.vue' +import AlertList from '../views/alertList.vue' const routes: Array = [ { @@ -13,6 +14,11 @@ const routes: Array = [ name: 'rule', component: RuleList }, + { + path: '/alert', + name: 'alert', + component: AlertList + }, ] const router = createRouter({ diff --git a/web/src/views/alertList.vue b/web/src/views/alertList.vue new file mode 100644 index 0000000..526f7c0 --- /dev/null +++ b/web/src/views/alertList.vue @@ -0,0 +1,157 @@ + + + + + -- Gitee