112 lines
2.5 KiB
Vue
112 lines
2.5 KiB
Vue
<template>
|
|
<div class="notification-log-view">
|
|
<GenericMonitorList
|
|
:fetchData="fetchNotifications"
|
|
:columnsConfig="notificationLogColumns"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import GenericMonitorList from '../../components/GenericMonitorList.vue';
|
|
import { getNotifications, ZapcoreLevel } from '../../api/monitor.js';
|
|
import { formatRFC3339 } from '../../utils/format.js';
|
|
|
|
// 适配通用组件的 fetchData prop
|
|
const fetchNotifications = async (params) => {
|
|
return await getNotifications(params);
|
|
};
|
|
|
|
// 定义表格的列
|
|
const notificationLogColumns = [
|
|
{
|
|
title: '用户ID',
|
|
dataIndex: 'user_id',
|
|
key: 'user_id',
|
|
sorter: true,
|
|
filterType: 'number',
|
|
minWidth: 100,
|
|
},
|
|
{
|
|
title: '通知渠道',
|
|
dataIndex: 'notifier_type',
|
|
key: 'notifier_type',
|
|
filterType: 'select',
|
|
filterOptions: [
|
|
{ value: '邮件', text: '邮件' },
|
|
{ value: '企业微信', text: '企业微信' },
|
|
{ value: '飞书', text: '飞书' },
|
|
{ value: '日志', text: '日志' },
|
|
],
|
|
minWidth: 120,
|
|
},
|
|
{
|
|
title: '目标地址',
|
|
dataIndex: 'to_address',
|
|
key: 'to_address',
|
|
minWidth: 200,
|
|
},
|
|
{
|
|
title: '标题',
|
|
dataIndex: 'title',
|
|
key: 'title',
|
|
minWidth: 200,
|
|
},
|
|
{
|
|
title: '消息',
|
|
dataIndex: 'message',
|
|
key: 'message',
|
|
minWidth: 300,
|
|
},
|
|
{
|
|
title: '日志级别',
|
|
dataIndex: 'level',
|
|
key: 'level',
|
|
sorter: true,
|
|
filterType: 'select',
|
|
filterOptions: Object.entries(ZapcoreLevel).map(([text, value]) => ({ value, text })),
|
|
minWidth: 110,
|
|
},
|
|
{
|
|
title: '告警时间',
|
|
dataIndex: 'alarm_timestamp',
|
|
key: 'alarm_timestamp',
|
|
sorter: true,
|
|
formatter: (row, column, cellValue) => formatRFC3339(cellValue),
|
|
minWidth: 180,
|
|
},
|
|
{
|
|
title: '状态',
|
|
dataIndex: 'status',
|
|
key: 'status',
|
|
filterType: 'select',
|
|
filterOptions: [
|
|
{ value: '发送成功', text: '发送成功' },
|
|
{ value: '发送失败', text: '发送失败' },
|
|
{ value: '已跳过', text: '已跳过' },
|
|
],
|
|
minWidth: 120,
|
|
},
|
|
{
|
|
title: '错误信息',
|
|
dataIndex: 'error_message',
|
|
key: 'error_message',
|
|
minWidth: 200,
|
|
},
|
|
{
|
|
title: '创建时间',
|
|
dataIndex: 'created_at',
|
|
key: 'created_at',
|
|
sorter: true,
|
|
formatter: (row, column, cellValue) => formatRFC3339(cellValue),
|
|
minWidth: 180,
|
|
},
|
|
];
|
|
</script>
|
|
|
|
<style scoped>
|
|
.notification-log-view {
|
|
/* 视图容器样式 */
|
|
}
|
|
</style>
|