-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
管理系统新增集群监控功能 1. 新增资源信息页面,通过嵌入 grafana 查看集群信息 支持直接嵌入 grafana 或通过代理的方式将请求转发到 grafana ![image](https://github.com/PKUHPC/SCOW/assets/140392039/70dbd318-5dc8-4f04-a9d6-d6fc90b5b89c) 2. 新增告警日志页面,通过 grafana api 获取告警日志信息 ![image](https://github.com/PKUHPC/SCOW/assets/140392039/25228d35-82a4-4731-993a-63f9edb828f0)
- Loading branch information
1 parent
d1c2e74
commit abb7e84
Showing
27 changed files
with
2,320 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@scow/mis-web": minor | ||
"@scow/config": minor | ||
"@scow/cli": minor | ||
--- | ||
|
||
管理系统新增集群监控功能 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
apps/mis-web/src/pageComponents/admin/AllAlarmLogsTable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/** | ||
* Copyright (c) 2022 Peking University and Peking University Institute for Computing and Digital Economy | ||
* SCOW is licensed under Mulan PSL v2. | ||
* You can use this software according to the terms and conditions of the Mulan PSL v2. | ||
* You may obtain a copy of Mulan PSL v2 at: | ||
* http://license.coscl.org.cn/MulanPSL2 | ||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, | ||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, | ||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. | ||
* See the Mulan PSL v2 for more details. | ||
*/ | ||
|
||
import { Static } from "@sinclair/typebox"; | ||
import { Table, Tag } from "antd"; | ||
import dayjs from "dayjs"; | ||
import { prefix, useI18nTranslateToString } from "src/i18n"; | ||
import { GetAlarmLogsSchema } from "src/pages/api/admin/monitor/getAlarmLogs"; | ||
|
||
interface Pagination { | ||
current: number; | ||
pageSize: number | undefined; | ||
defaultPageSize: number; | ||
showSizeChanger: boolean; | ||
total: number | undefined; | ||
onChange: (page: number, pageSize: number) => void; | ||
} | ||
|
||
interface Props { | ||
data: Static<typeof GetAlarmLogsSchema["responses"]["200"]> | undefined; | ||
isLoading: boolean; | ||
pagination: Pagination; | ||
} | ||
|
||
interface AlarmLog { | ||
id: number; | ||
fingerprint: string; | ||
status: string; | ||
severity: string; | ||
description: string; | ||
startsAt: number; | ||
endsAt: number | null; | ||
} | ||
|
||
const p = prefix("pageComp.admin.allAlarmLogsTable."); | ||
|
||
export const AllAlarmLogsTable: React.FC<Props> = ({ data, isLoading, pagination }) => { | ||
|
||
const t = useI18nTranslateToString(); | ||
|
||
const statusTexts = { | ||
"firing": <Tag color="error">{t(p("firing"))}</Tag>, | ||
"resolved": <Tag color="success">{t(p("resolved"))}</Tag>, | ||
}; | ||
|
||
const severityTexts = { | ||
"Warning": <Tag color="warning">{"Warning"}</Tag>, | ||
"Error": <Tag color="error">{"Error"}</Tag>, | ||
}; | ||
|
||
return ( | ||
<Table | ||
dataSource={data?.results} | ||
loading={isLoading} | ||
rowKey="id" | ||
scroll={{ x: true }} | ||
pagination={pagination} | ||
> | ||
<Table.Column<AlarmLog> | ||
dataIndex="id" | ||
title={t(p("serialNumber"))} | ||
render={(text, record, index) => { | ||
const { current, pageSize } = pagination; | ||
return (current - 1) * (pageSize || 0) + index + 1; | ||
}} | ||
/> | ||
<Table.Column<AlarmLog> dataIndex="fingerprint" title={t(p("fingerPrint"))} /> | ||
<Table.Column<AlarmLog> | ||
dataIndex="status" | ||
title={t(p("status"))} | ||
render={(m: string) => statusTexts[m]} | ||
/> | ||
<Table.Column<AlarmLog> | ||
dataIndex="severity" | ||
title={t(p("alarmLevel"))} | ||
render={(s: string) => severityTexts[s]} | ||
/> | ||
<Table.Column<AlarmLog> dataIndex="description" title={t(p("description"))} /> | ||
<Table.Column<AlarmLog> | ||
dataIndex="startsAt" | ||
title={t(p("firingTime"))} | ||
render={(s: number) => dayjs(s).format("YYYY-MM-DD HH:mm:ss")} | ||
/> | ||
<Table.Column<AlarmLog> | ||
dataIndex="endsAt" | ||
title={t(p("resolvedTime"))} | ||
render={(e: number) => e ? dayjs(e).format("YYYY-MM-DD HH:mm:ss") : "-"} | ||
/> | ||
</Table> | ||
); | ||
}; |
Oops, something went wrong.