diff --git a/orion-visor-ui/src/api/monitor/alarm-event.ts b/orion-visor-ui/src/api/monitor/alarm-event.ts new file mode 100644 index 00000000..28eff525 --- /dev/null +++ b/orion-visor-ui/src/api/monitor/alarm-event.ts @@ -0,0 +1,129 @@ +import type { TableData } from '@arco-design/web-vue'; +import type { DataGrid, OrderDirection, Pagination, ClearRequest } from '@/types/global'; +import axios from 'axios'; +import qs from 'query-string'; + +/** + * 告警记录处理请求 + */ +export interface AlarmEventHandleRequest { + idList?: Array; + handleStatus?: string; + handleTime?: number; + handleRemark?: string; +} + +/** + * 告警记录误报请求 + */ +export interface AlarmEventFalseAlarmRequest { + idList?: Array; +} + +/** + * 告警记录查询请求 + */ +export interface AlarmEventQueryRequest extends Pagination, OrderDirection { + id?: number; + hostId?: number; + agentKey?: string; + policyId?: number; + metricsId?: number; + metricsMeasurement?: string; + alarmLevel?: number; + falseAlarm?: number; + handleStatus?: string; + handleRemark?: string; + handleUserId?: number; + createTimeRange?: string[]; +} + +/** + * 告警记录清理请求 + */ +export interface AlarmEventClearRequest extends AlarmEventQueryRequest, ClearRequest { +} + +/** + * 告警记录查询响应 + */ +export interface AlarmEventQueryResponse extends TableData { + id: number; + hostId: number; + hostName: string; + hostAddress: string; + agentKey: string; + policyId: number; + metricsId: number; + metricsMeasurement: string; + alarmTags: string; + alarmValue: any; + alarmThreshold: any; + alarmInfo: string; + alarmLevel: number; + triggerCondition: string; + consecutiveCount: number; + falseAlarm: number; + handleStatus: string; + handleTime: number; + handleRemark: string; + handleUserId: number; + handleUsername: string; + createTime: number; + updateTime: number; + updater: string; +} + +/** + * 处理告警记录 + */ +export function handleAlarmEvent(request: AlarmEventHandleRequest) { + return axios.post('/monitor/alarm-event/handle', request); +} + +/** + * 设置为误报 + */ +export function setAlarmEventFalse(request: AlarmEventFalseAlarmRequest) { + return axios.post('/monitor/alarm-event/set-false', request); +} + +/** + * 分页查询告警记录 + */ +export function getAlarmEventPage(request: AlarmEventQueryRequest) { + return axios.post>('/monitor/alarm-event/query', request); +} + +/** + * 查询告警记录数量 + */ +export function getAlarmEventCount(request: AlarmEventQueryRequest) { + return axios.post('/monitor/alarm-event/count', request); +} + +/** + * 删除告警记录 + */ +export function deleteAlarmEvent(id: number) { + return axios.delete('/monitor/alarm-event/delete', { params: { id } }); +} + +/** + * 批量删除告警记录 + */ +export function batchDeleteAlarmEvent(idList: Array) { + return axios.delete('/monitor/alarm-event/batch-delete', { + params: { idList }, + paramsSerializer: params => { + return qs.stringify(params, { arrayFormat: 'comma' }); + } + }); +} + +/** + * 清理告警记录 + */ +export function clearMonitorAlarmEvent(request: AlarmEventClearRequest) { + return axios.post('/monitor/alarm-event/clear', request); +} diff --git a/orion-visor-ui/src/api/monitor/alarm-policy.ts b/orion-visor-ui/src/api/monitor/alarm-policy.ts new file mode 100644 index 00000000..a4c10b45 --- /dev/null +++ b/orion-visor-ui/src/api/monitor/alarm-policy.ts @@ -0,0 +1,92 @@ +import type { TableData } from '@arco-design/web-vue'; +import type { DataGrid, OrderDirection, Pagination } from '@/types/global'; +import axios from 'axios'; + +/** + * 监控告警策略创建请求 + */ +export interface AlarmPolicyCreateRequest { + name?: string; + description?: string; + notifyIdList?: Array; +} + +/** + * 监控告警策略更新请求 + */ +export interface AlarmPolicyUpdateRequest extends AlarmPolicyCreateRequest { + id?: number; + updateNotify?: boolean; +} + +/** + * 监控告警策略查询请求 + */ +export interface AlarmPolicyQueryRequest extends Pagination, OrderDirection { + id?: number; + name?: string; + description?: string; +} + +/** + * 监控告警策略查询响应 + */ +export interface AlarmPolicyQueryResponse extends TableData { + id: number; + name: string; + description: string; + notifyIdList: Array; + createTime: number; + updateTime: number; + creator: string; + updater: string; +} + +/** + * 创建监控告警策略 + */ +export function createAlarmPolicy(request: AlarmPolicyCreateRequest) { + return axios.post('/monitor/alarm-policy/create', request); +} + +/** + * 更新监控告警策略 + */ +export function updateAlarmPolicy(request: AlarmPolicyUpdateRequest) { + return axios.put('/monitor/alarm-policy/update', request); +} + +/** + * 复制监控告警策略 + */ +export function copyAlarmPolicy(request: AlarmPolicyCreateRequest) { + return axios.post('/monitor/alarm-policy/copy', request); +} + +/** + * 查询监控告警策略 + */ +export function getAlarmPolicy(id: number) { + return axios.get('/monitor/alarm-policy/get', { params: { id } }); +} + +/** + * 查询全部监控告警策略 + */ +export function getAlarmPolicyList() { + return axios.get>('/monitor/alarm-policy/list'); +} + +/** + * 分页查询监控告警策略 + */ +export function getAlarmPolicyPage(request: AlarmPolicyQueryRequest) { + return axios.post>('/monitor/alarm-policy/query', request); +} + +/** + * 删除监控告警策略 + */ +export function deleteAlarmPolicy(id: number) { + return axios.delete('/monitor/alarm-policy/delete', { params: { id } }); +} diff --git a/orion-visor-ui/src/api/monitor/alarm-rule.ts b/orion-visor-ui/src/api/monitor/alarm-rule.ts new file mode 100644 index 00000000..21563a8b --- /dev/null +++ b/orion-visor-ui/src/api/monitor/alarm-rule.ts @@ -0,0 +1,84 @@ +import type { TableData } from '@arco-design/web-vue'; +import axios from 'axios'; + +/** + * 监控告警规则创建请求 + */ +export interface AlarmRuleCreateRequest { + policyId?: number; + metricsId?: number; + tags?: string; + level?: number; + ruleSwitch?: number; + allEffect?: number; + triggerCondition?: string; + threshold?: any; + consecutiveCount?: number; + silencePeriod?: number; + description?: string; +} + +/** + * 监控告警规则更新请求 + */ +export interface AlarmRuleUpdateRequest extends AlarmRuleCreateRequest { + id?: number; +} + +/** + * 监控告警规则查询响应 + */ +export interface AlarmRuleQueryResponse extends TableData { + id: number; + policyId: number; + metricsId: number; + metricsMeasurement: string; + tags: string; + ruleSwitch: number; + allEffect: number; + level: number; + triggerCondition: string; + threshold: any; + consecutiveCount?: number; + silencePeriod: number; + description: string; + createTime: number; + updateTime: number; + creator: string; + updater: string; +} + +/** + * 创建监控告警规则 + */ +export function createAlarmRule(request: AlarmRuleCreateRequest) { + return axios.post('/monitor/alarm-policy-rule/create', request); +} + +/** + * 更新监控告警规则 + */ +export function updateAlarmRule(request: AlarmRuleUpdateRequest) { + return axios.put('/monitor/alarm-policy-rule/update', request); +} + +/** + * 更新监控告警规则 + */ +export function updateAlarmRuleSwitch(request: AlarmRuleUpdateRequest) { + return axios.put('/monitor/alarm-policy-rule/update-switch', request); +} + +/** + * 查询全部监控告警规则 + */ +export function getAlarmRuleList(policyId: number, metricsMeasurement: string = '') { + return axios.get>('/monitor/alarm-policy-rule/list', { params: { policyId, metricsMeasurement } }); +} + +/** + * 删除监控告警规则 + */ +export function deleteAlarmRule(id: number) { + return axios.delete('/monitor/alarm-policy-rule/delete', { params: { id } }); +} diff --git a/orion-visor-ui/src/api/monitor/metrics.ts b/orion-visor-ui/src/api/monitor/metrics.ts index 1d5437d3..338251e7 100644 --- a/orion-visor-ui/src/api/monitor/metrics.ts +++ b/orion-visor-ui/src/api/monitor/metrics.ts @@ -66,13 +66,6 @@ export function updateMetrics(request: MetricsUpdateRequest) { return axios.put('/monitor/monitor-metrics/update', request); } -/** - * 查询监控指标 - */ -export function getMetrics(id: number) { - return axios.get('/monitor/monitor-metrics/get', { params: { id } }); -} - /** * 查询全部监控指标 */ diff --git a/orion-visor-ui/src/api/monitor/monitor-host.ts b/orion-visor-ui/src/api/monitor/monitor-host.ts index 34d62e3f..fd025031 100644 --- a/orion-visor-ui/src/api/monitor/monitor-host.ts +++ b/orion-visor-ui/src/api/monitor/monitor-host.ts @@ -20,7 +20,7 @@ export interface MonitorHostUpdateRequest { * 监控主机更新请求 */ export interface MonitorHostSwitchUpdateRequest { - id?: number; + idList?: Array; alarmSwitch?: number; } @@ -57,6 +57,23 @@ export interface MonitorHostChartRequest { end?: string; } +/** + * 监控指标数据 + */ +export interface MonitorMetricsData { + timestamp: number; + metrics: Array; +} + +/** + * 监控指标 + */ +export interface MonitorMetrics { + type: string; + tags: Record; + values: Record; +} + /** * 监控主机查询响应 */ @@ -139,6 +156,13 @@ export function getMonitorHostMetrics(agentKeyList: Array) { }); } +/** + * 获取监控主机概览 + */ +export function getMonitorHostOverride(agentKey: string) { + return axios.get('/monitor/monitor-host/override', { params: { agentKey } }); +} + /** * 查询监控主机图表 */ diff --git a/orion-visor-ui/src/api/system/notify-template.ts b/orion-visor-ui/src/api/system/notify-template.ts new file mode 100644 index 00000000..cd435594 --- /dev/null +++ b/orion-visor-ui/src/api/system/notify-template.ts @@ -0,0 +1,91 @@ +import type { TableData } from '@arco-design/web-vue'; +import type { DataGrid, OrderDirection, Pagination } from '@/types/global'; +import axios from 'axios'; + +/** + * 通知模板创建请求 + */ +export interface NotifyTemplateCreateRequest { + name?: string; + bizType?: string; + channelType?: string; + channelConfig?: string; + messageTemplate?: string; + description?: string; +} + +/** + * 通知模板更新请求 + */ +export interface NotifyTemplateUpdateRequest extends NotifyTemplateCreateRequest { + id?: number; +} + +/** + * 通知模板查询请求 + */ +export interface NotifyTemplateQueryRequest extends Pagination, OrderDirection { + id?: number; + name?: string; + bizType?: string; + channelType?: string; +} + +/** + * 通知模板查询响应 + */ +export interface NotifyTemplateQueryResponse extends TableData { + id: number; + name: string; + bizType: string; + channelType: string; + channelConfig: string; + messageTemplate: string; + description: string; + createTime: number; + updateTime: number; + creator: string; + updater: string; +} + +/** + * 创建通知模板 + */ +export function createNotifyTemplate(request: NotifyTemplateCreateRequest) { + return axios.post('/infra/notify-template/create', request); +} + +/** + * 更新通知模板 + */ +export function updateNotifyTemplate(request: NotifyTemplateUpdateRequest) { + return axios.put('/infra/notify-template/update', request); +} + +/** + * 查询通知模板 + */ +export function getNotifyTemplate(id: number) { + return axios.get('/infra/notify-template/get', { params: { id } }); +} + +/** + * 查询全部通知模板 + */ +export function getNotifyTemplateList(bizType: string) { + return axios.get>('/infra/notify-template/list', { params: { bizType } }); +} + +/** + * 分页查询通知模板 + */ +export function getNotifyTemplatePage(request: NotifyTemplateQueryRequest) { + return axios.post>('/infra/notify-template/query', request); +} + +/** + * 删除通知模板 + */ +export function deleteNotifyTemplate(id: number) { + return axios.delete('/infra/notify-template/delete', { params: { id } }); +} diff --git a/orion-visor-ui/src/api/user/operator-log.ts b/orion-visor-ui/src/api/user/operator-log.ts index 0d21a35a..200238f4 100644 --- a/orion-visor-ui/src/api/user/operator-log.ts +++ b/orion-visor-ui/src/api/user/operator-log.ts @@ -16,7 +16,7 @@ export interface OperatorLogQueryRequest extends Pagination, OrderDirection { } /** - * 操作日志清理参数 + * 操作日志清空请求 */ export interface OperatorLogClearRequest extends OperatorLogQueryRequest, ClearRequest { } diff --git a/orion-visor-ui/src/components/monitor/alarm-policy/selector/index.vue b/orion-visor-ui/src/components/monitor/alarm-policy/selector/index.vue new file mode 100644 index 00000000..4a7392c3 --- /dev/null +++ b/orion-visor-ui/src/components/monitor/alarm-policy/selector/index.vue @@ -0,0 +1,54 @@ + + + + + + + diff --git a/orion-visor-ui/src/components/monitor/metrics/selector/index.vue b/orion-visor-ui/src/components/monitor/metrics/selector/index.vue new file mode 100644 index 00000000..d63807f0 --- /dev/null +++ b/orion-visor-ui/src/components/monitor/metrics/selector/index.vue @@ -0,0 +1,54 @@ + + + + + + + diff --git a/orion-visor-ui/src/components/system/message-box/index.vue b/orion-visor-ui/src/components/system/message-box/index.vue index 8fbed43d..726bb535 100644 --- a/orion-visor-ui/src/components/system/message-box/index.vue +++ b/orion-visor-ui/src/components/system/message-box/index.vue @@ -22,25 +22,25 @@ - - - 清空 - - - - 全部已读 - + + + + + @@ -263,6 +263,10 @@ .header-button { padding: 0 6px; } + + :deep(.arco-tabs-tab) { + margin: 0 6px 0 0 !important; + } } diff --git a/orion-visor-ui/src/components/system/notify-template/selector/index.vue b/orion-visor-ui/src/components/system/notify-template/selector/index.vue new file mode 100644 index 00000000..cd82ad5b --- /dev/null +++ b/orion-visor-ui/src/components/system/notify-template/selector/index.vue @@ -0,0 +1,62 @@ + + + + + + + diff --git a/orion-visor-ui/src/router/routes/modules/monitor.ts b/orion-visor-ui/src/router/routes/modules/monitor.ts index b3075cbe..fa8c22c2 100644 --- a/orion-visor-ui/src/router/routes/modules/monitor.ts +++ b/orion-visor-ui/src/router/routes/modules/monitor.ts @@ -17,6 +17,16 @@ const MONITOR: AppRouteRecordRaw = { path: '/monitor/monitor-host', component: () => import('@/views/monitor/monitor-host/index.vue'), }, + { + name: 'alarmPolicy', + path: '/monitor/alarm-policy', + component: () => import('@/views/monitor/alarm-policy/index.vue'), + }, + { + name: 'alarmEvent', + path: '/monitor/alarm-event', + component: () => import('@/views/monitor/alarm-event/index.vue'), + }, { name: 'monitorDetail', path: '/monitor/detail', @@ -32,6 +42,21 @@ const MONITOR: AppRouteRecordRaw = { }, component: () => import('@/views/monitor/monitor-detail/index.vue'), }, + { + name: 'alarmRule', + path: '/monitor/alarm-rule', + meta: { + // 固定到 tab + noAffix: false, + // 是否允许打开多个 tab + multipleTab: true, + // 名称模板 + localeTemplate: (route: RouteLocationNormalized) => { + return `${route.meta.locale} - ${route.query.name || ''}`; + }, + }, + component: () => import('@/views/monitor/alarm-rule/index.vue'), + }, ], }; diff --git a/orion-visor-ui/src/router/routes/modules/system.ts b/orion-visor-ui/src/router/routes/modules/system.ts index 0237f002..a2ca2145 100644 --- a/orion-visor-ui/src/router/routes/modules/system.ts +++ b/orion-visor-ui/src/router/routes/modules/system.ts @@ -21,6 +21,11 @@ const SYSTEM: AppRouteRecordRaw = { path: '/system/dict-value', component: () => import('@/views/system/dict-value/index.vue'), }, + { + name: 'notifyTemplate', + path: '/system/notify-template', + component: () => import('@/views/system/notify-template/index.vue'), + }, { name: 'systemSetting', path: '/system/setting', diff --git a/orion-visor-ui/src/store/modules/cache/index.ts b/orion-visor-ui/src/store/modules/cache/index.ts index bc78ccd7..73e460af 100644 --- a/orion-visor-ui/src/store/modules/cache/index.ts +++ b/orion-visor-ui/src/store/modules/cache/index.ts @@ -24,6 +24,9 @@ import { getExecJobList } from '@/api/exec/exec-job'; import { getPathBookmarkGroupList } from '@/api/terminal/path-bookmark-group'; import { getCommandSnippetList } from '@/api/terminal/command-snippet'; import { getPathBookmarkList } from '@/api/terminal/path-bookmark'; +import { getNotifyTemplateList } from '@/api/system/notify-template'; +import { getAlarmPolicyList } from '@/api/monitor/alarm-policy'; +import { getMetricsList } from '@/api/monitor/metrics'; export default defineStore('cache', { state: (): CacheState => ({}), @@ -173,6 +176,21 @@ export default defineStore('cache', { return await this.load('execJob', getExecJobList, ['exec:exec-job:query'], force); }, + // 查询监控告警策略列表 + async loadMonitorAlarmPolicy(force = false) { + return await this.load('alarmPolicy', getAlarmPolicyList, ['monitor:alarm-policy:query'], force); + }, + + // 查询监控指标列表 + async loadMonitorMetricsList(force = false) { + return await this.load('monitorMetrics', getMetricsList, ['monitor:monitor-metrics:query'], force); + }, + + // 查询通知模板列表 + async loadNotifyTemplate(bizType: string, force = false) { + return await this.load(`notifyTemplate_${bizType}`, () => getNotifyTemplateList(bizType), ['infra:notify-template:query'], force); + }, + // 加载偏好 async loadPreference(type: PreferenceType, force = false) { return await this.load(`preference_${type}`, () => getPreference(type), undefined, force, {}); @@ -185,8 +203,8 @@ export default defineStore('cache', { // 加载系统设置 async loadSystemSetting(force = false) { - return await this.load(`system_setting`, getSystemAggregateSetting, undefined, force, {}); - }, + return await this.load('systemSetting', getSystemAggregateSetting, undefined, force, {}); + } } }); diff --git a/orion-visor-ui/src/store/modules/cache/types.ts b/orion-visor-ui/src/store/modules/cache/types.ts index ec83dc71..2d0feb71 100644 --- a/orion-visor-ui/src/store/modules/cache/types.ts +++ b/orion-visor-ui/src/store/modules/cache/types.ts @@ -7,10 +7,11 @@ export type CacheType = 'users' | 'menus' | 'roles' | 'authorizedHostKeys' | 'authorizedHostIdentities' | 'commandSnippetGroups' | 'pathBookmarkGroups' | 'commandSnippets' | 'pathBookmarks' - | 'system_setting' + | 'alarmPolicy' | 'monitorMetrics' + | 'systemSetting' | 'notifyTemplate*' | '*_Tags' | 'preference_*' | string export interface CacheState { - [key: CacheType]: unknown; + [key: CacheType]: any; } diff --git a/orion-visor-ui/src/types/form.ts b/orion-visor-ui/src/types/form.ts index e1395a2e..0185ad7b 100644 --- a/orion-visor-ui/src/types/form.ts +++ b/orion-visor-ui/src/types/form.ts @@ -1,5 +1,8 @@ import type { SelectOptionData, TreeNodeData } from '@arco-design/web-vue'; +// 表单操作 +export type FormHandle = 'add' | 'update' | 'copy' | 'view'; + // 通过 label 进行过滤 export const labelFilter = (searchValue: string, option: { label: string }) => { return option.label.toLowerCase().includes(searchValue.toLowerCase()); diff --git a/orion-visor-ui/src/utils/charts.ts b/orion-visor-ui/src/utils/charts.ts index 6626d1a4..915011c7 100644 --- a/orion-visor-ui/src/utils/charts.ts +++ b/orion-visor-ui/src/utils/charts.ts @@ -1,10 +1,14 @@ -// 获取百分比进度状态 -export const getPercentProgressColor = (percent: number) => { - if (percent < 0.6) { - return 'rgb(var(--green-6))'; - } else if (percent < 0.8) { - return 'rgb(var(--orange-6))'; - } else { - return 'rgb(var(--red-6))'; +// 获取百分比进度颜色 +export const getPercentProgressColor = (percent: number, defaultColor = 'rgb(var(--green-6))') => { + try { + if (percent < 0.6) { + return defaultColor; + } else if (percent < 0.8) { + return 'rgb(var(--orange-6))'; + } else { + return 'rgb(var(--red-6))'; + } + } catch (e) { + return defaultColor; } }; diff --git a/orion-visor-ui/src/utils/index.ts b/orion-visor-ui/src/utils/index.ts index 7b376dfd..3299398f 100644 --- a/orion-visor-ui/src/utils/index.ts +++ b/orion-visor-ui/src/utils/index.ts @@ -239,6 +239,10 @@ export function replaceHtmlTag(message: string) { .replaceAll('<sr 2>', '') .replaceAll('<sr 4>', '') .replaceAll('</sr>', '') + .replaceAll('<sg>', '') + .replaceAll('<sg 2>', '') + .replaceAll('<sg 4>', '') + .replaceAll('</sg>', '') .replaceAll('<b>', '') .replaceAll('</b>', ''); } @@ -256,9 +260,24 @@ export function clearHtmlTag(message: string) { .replaceAll('<sr 2>', '') .replaceAll('<sr>', '') .replaceAll('</sr>', '') + .replaceAll('<sg 0>', '') + .replaceAll('<sg 2>', '') + .replaceAll('<sg>', '') + .replaceAll('</sg>', '') .replaceAll('<b>', '') .replaceAll('</b>', '') .replaceAll('
', '\n'); } +/** + * 分配记录 (忽略基础信息) + */ +export const assignOmitRecord = (record: any, ...omits: Array) => { + const model = Object.assign({}, record); + for (const omitKey of [...omits, 'creator', 'updater', 'createTime', 'updateTime']) { + delete model[omitKey]; + } + return model; +}; + export default null; diff --git a/orion-visor-ui/src/utils/metrics.ts b/orion-visor-ui/src/utils/metrics.ts index 4ef0ceac..857593ed 100644 --- a/orion-visor-ui/src/utils/metrics.ts +++ b/orion-visor-ui/src/utils/metrics.ts @@ -27,7 +27,7 @@ export type WindowUnit = // 指标单位格式化选项 export interface MetricUnitFormatOptions { // 小数位 - digit?: number; + precision?: number; // 后缀 suffix?: string; // 空转0 @@ -37,7 +37,12 @@ export interface MetricUnitFormatOptions { } // 指标单位格式化函数 -type MetricUnitFormatterFn = (value: number, option?: MetricUnitFormatOptions) => string; +type MetricUnitFormatterOption = { + // 格式化单位 + format: (value: number, option?: MetricUnitFormatOptions) => string; + // 获取阈值原始值 + getThresholdOriginalValue: (value: number) => number; +}; // 指标单位格式化配置 type WindowTimeFormatterOption = { @@ -54,27 +59,57 @@ type WindowTimeFormatterOption = { }; // 指标单位格式化 -export const MetricUnitFormatter: Record = { +export const MetricUnitFormatter: Record = { // 字节 - BYTES: formatBytes, + BYTES: { + format: formatBytes, + getThresholdOriginalValue: getByteThresholdOriginalValue, + }, // 比特 - BITS: formatBits, + BITS: { + format: formatBits, + getThresholdOriginalValue: getBitThresholdOriginalValue, + }, // 次数 - COUNT: formatCount, + COUNT: { + format: formatCount, + getThresholdOriginalValue: identity, + }, // 秒 - SECONDS: formatSeconds, + SECONDS: { + format: formatSeconds, + getThresholdOriginalValue: identity, + }, // 百分比 - PER: formatPer, + PER: { + format: formatPer, + getThresholdOriginalValue: identity, + }, // 字节/秒 - BYTES_S: (value, option) => formatBytes(value, option) + '/s', + BYTES_S: { + format: (value, option) => formatBytes(value, option) + '/s', + getThresholdOriginalValue: getByteThresholdOriginalValue, + }, // 比特/秒 - BITS_S: (value, option) => formatBits(value, option) + 'ps', + BITS_S: { + format: (value, option) => formatBits(value, option) + 'ps', + getThresholdOriginalValue: getBitThresholdOriginalValue, + }, // 次数/秒 - COUNT_S: (value, option) => formatCount(value, option) + '/s', + COUNT_S: { + format: (value, option) => formatCount(value, option) + '/s', + getThresholdOriginalValue: identity, + }, // 文本 - TEXT: formatText, + TEXT: { + format: formatText, + getThresholdOriginalValue: identity, + }, // 无单位 - NONE: (value, option) => formatNumber(value, option), + NONE: { + format: formatText, + getThresholdOriginalValue: identity, + }, }; // 窗口单位格式化 @@ -124,39 +159,26 @@ export const parseWindowUnit = (windowValue: string): [number, WindowUnit] => { } }; -// 安全取小数位 -function getFixed(option?: MetricUnitFormatOptions, defaultValue = 2): number { - return typeof option?.digit === 'number' ? option.digit : defaultValue; +// 提取单位 +export function extractUnit(str: string): string { + const match = str.match(/[^\d.]+$/); + return match ? match[0] : ''; } -// 格式化数字 -function formatNumber(value: number, option?: MetricUnitFormatOptions): string { - const fixed = getFixed(option, 2); - const abs = Math.abs(value); - let result: string; - - if (abs >= 1e9) { - result = (value / 1e9).toFixed(fixed); - } else if (abs >= 1_000_000) { - result = (value / 1_000_000).toFixed(fixed); - } else if (abs >= 1_000) { - result = (value / 1_000).toFixed(fixed); - } else { - result = value.toFixed(fixed); - } - - return parseFloat(result).toString(); +// 安全取小数位 +function getPrecision(option?: MetricUnitFormatOptions, defaultValue = 2): number { + return typeof option?.precision === 'number' ? option.precision : defaultValue; } // 格式化百分比 function formatPer(value: number, option?: MetricUnitFormatOptions): string { - const fixed = getFixed(option, 2); + const fixed = getPrecision(option, 2); return parseFloat((value).toFixed(fixed)) + '%'; } // 格式化字节 -function formatBytes(value: number, option?: MetricUnitFormatOptions): string { - const fixed = getFixed(option, 2); +export function formatBytes(value: number, option?: MetricUnitFormatOptions): string { + const fixed = getPrecision(option, 2); const units = ['B', 'KB', 'MB', 'GB', 'TB']; let v = Math.abs(value); let i = 0; @@ -170,10 +192,10 @@ function formatBytes(value: number, option?: MetricUnitFormatOptions): string { } // 格式化比特 -function formatBits(value: number, option?: MetricUnitFormatOptions): string { - const fixed = getFixed(option, 2); +export function formatBits(value: number, option?: MetricUnitFormatOptions): string { + const fixed = getPrecision(option, 2); const units = ['b', 'Kb', 'Mb', 'Gb']; - let v = Math.abs(value); + let v = Math.abs(value * 8); let i = 0; while (v >= 1000 && i < units.length - 1) { v /= 1000; @@ -186,7 +208,7 @@ function formatBits(value: number, option?: MetricUnitFormatOptions): string { // 格式化次数 function formatCount(value: number, option?: MetricUnitFormatOptions): string { - const fixed = getFixed(option, 2); + const fixed = getPrecision(option, 2); const abs = Math.abs(value); if (abs >= 1_000_000) { return parseFloat((value / 1_000_000).toFixed(fixed)) + 'M'; @@ -198,7 +220,7 @@ function formatCount(value: number, option?: MetricUnitFormatOptions): string { // 格式化时间 function formatSeconds(value: number, option?: MetricUnitFormatOptions): string { - const fixed = getFixed(option, 2); + const fixed = getPrecision(option, 2); if (value >= 3600) { return parseFloat((value / 3600).toFixed(fixed)) + 'h'; } else if (value >= 60) { @@ -209,8 +231,23 @@ function formatSeconds(value: number, option?: MetricUnitFormatOptions): string // 格式化文本 function formatText(value: number, option?: MetricUnitFormatOptions): string { - const fixed = getFixed(option, 2); + const fixed = getPrecision(option, 2); const unitText = option?.suffix || ''; const numStr = value.toFixed(fixed); return unitText ? `${numStr} ${unitText}` : numStr; } + +// 获取 byte 的阈值原值 MB > b +function getByteThresholdOriginalValue(value: number) { + return value * 1024 * 1024; +} + +// 获取 bit 的阈值原值 Mb > bit +function getBitThresholdOriginalValue(value: number) { + return value / 8 * 1000 * 1000; +} + +// 返回原值 +function identity(value: number): number { + return value; +} diff --git a/orion-visor-ui/src/views/exec/exec-template/types/table.columns.ts b/orion-visor-ui/src/views/exec/exec-template/types/table.columns.ts index 839406a8..a6bbd8cd 100644 --- a/orion-visor-ui/src/views/exec/exec-template/types/table.columns.ts +++ b/orion-visor-ui/src/views/exec/exec-template/types/table.columns.ts @@ -22,6 +22,7 @@ const columns = [ title: '模板命令', dataIndex: 'command', slotName: 'command', + minWidth: 380, align: 'left', ellipsis: true, default: true, diff --git a/orion-visor-ui/src/views/monitor/alarm-event/components/alarm-event-clear-modal.vue b/orion-visor-ui/src/views/monitor/alarm-event/components/alarm-event-clear-modal.vue new file mode 100644 index 00000000..d8c74ce8 --- /dev/null +++ b/orion-visor-ui/src/views/monitor/alarm-event/components/alarm-event-clear-modal.vue @@ -0,0 +1,223 @@ + + + + + + + diff --git a/orion-visor-ui/src/views/monitor/alarm-event/components/alarm-event-handle-modal.vue b/orion-visor-ui/src/views/monitor/alarm-event/components/alarm-event-handle-modal.vue new file mode 100644 index 00000000..b6128fc0 --- /dev/null +++ b/orion-visor-ui/src/views/monitor/alarm-event/components/alarm-event-handle-modal.vue @@ -0,0 +1,130 @@ + + + + + + + diff --git a/orion-visor-ui/src/views/monitor/alarm-event/components/alarm-event-table-base.vue b/orion-visor-ui/src/views/monitor/alarm-event/components/alarm-event-table-base.vue new file mode 100644 index 00000000..81d5f07f --- /dev/null +++ b/orion-visor-ui/src/views/monitor/alarm-event/components/alarm-event-table-base.vue @@ -0,0 +1,348 @@ + + + + + + + diff --git a/orion-visor-ui/src/views/monitor/alarm-event/components/alarm-event-table.vue b/orion-visor-ui/src/views/monitor/alarm-event/components/alarm-event-table.vue new file mode 100644 index 00000000..d5facd64 --- /dev/null +++ b/orion-visor-ui/src/views/monitor/alarm-event/components/alarm-event-table.vue @@ -0,0 +1,199 @@ + + + + + + + diff --git a/orion-visor-ui/src/views/monitor/alarm-event/index.vue b/orion-visor-ui/src/views/monitor/alarm-event/index.vue new file mode 100644 index 00000000..b800870f --- /dev/null +++ b/orion-visor-ui/src/views/monitor/alarm-event/index.vue @@ -0,0 +1,48 @@ + + + + + + + diff --git a/orion-visor-ui/src/views/monitor/alarm-event/types/const.ts b/orion-visor-ui/src/views/monitor/alarm-event/types/const.ts new file mode 100644 index 00000000..8fdb1971 --- /dev/null +++ b/orion-visor-ui/src/views/monitor/alarm-event/types/const.ts @@ -0,0 +1,30 @@ +export const TableName = 'alarm_event'; + +// 最大清理数量 +export const maxClearLimit = 2000; + +// 是否为误报 +export const FalseAlarm = { + // 误报 + TRUE: 1, + // 非误报 + FALSE: 0, +}; + +// 告警条件 字典项 +export const TriggerConditionKey = 'alarmTriggerCondition'; + +// 告警记录处理状态 字典项 +export const HandleStatusKey = 'alarmEventHandleStatus'; + +// 是否为误报 字典项 +export const FalseAlarmKey = 'falseAlarm'; + +// 指标数据集 字典项 +export const MetricsMeasurementKey = 'metricsMeasurement'; + +// 告警等级 字典项 +export const AlarmLevelKey = 'alarmLevel'; + +// 加载的字典值 +export const dictKeys = [TriggerConditionKey, HandleStatusKey, FalseAlarmKey, MetricsMeasurementKey, AlarmLevelKey]; diff --git a/orion-visor-ui/src/views/monitor/alarm-event/types/form.rules.ts b/orion-visor-ui/src/views/monitor/alarm-event/types/form.rules.ts new file mode 100644 index 00000000..112f624b --- /dev/null +++ b/orion-visor-ui/src/views/monitor/alarm-event/types/form.rules.ts @@ -0,0 +1,22 @@ +import type { FieldRule } from '@arco-design/web-vue'; + +export const handleRules = { + handleStatus: [{ + required: true, + message: '请输入处理状态' + }, { + maxLength: 16, + message: '处理状态长度不能大于16位' + }], + handleTime: [{ + required: true, + message: '请输入处理时间' + }], + handleRemark: [{ + required: true, + message: '请输入处理备注' + }, { + maxLength: 512, + message: '处理备注长度不能大于512位' + }], +} as Record; diff --git a/orion-visor-ui/src/views/monitor/alarm-event/types/table.columns.ts b/orion-visor-ui/src/views/monitor/alarm-event/types/table.columns.ts new file mode 100644 index 00000000..bdbbe86f --- /dev/null +++ b/orion-visor-ui/src/views/monitor/alarm-event/types/table.columns.ts @@ -0,0 +1,146 @@ +import type { TableColumnData } from '@arco-design/web-vue'; +import { dateFormat } from '@/utils'; + +const columns = [ + { + title: 'id', + dataIndex: 'id', + slotName: 'id', + width: 98, + align: 'left', + fixed: 'left', + default: true, + }, { + title: '主机信息', + dataIndex: 'hostInfo', + slotName: 'hostInfo', + width: 248, + align: 'left', + fixed: 'left', + default: true, + }, { + title: '处理状态', + dataIndex: 'handleStatus', + slotName: 'handleStatus', + width: 108, + align: 'left', + fixed: 'left', + default: true, + }, { + title: '告警级别', + dataIndex: 'alarmLevel', + slotName: 'alarmLevel', + align: 'left', + width: 108, + default: true, + }, { + title: '告警策略', + dataIndex: 'policyId', + slotName: 'policyId', + align: 'left', + width: 120, + default: false, + }, { + title: '指标数据集', + dataIndex: 'metricsMeasurement', + slotName: 'metricsMeasurement', + align: 'left', + width: 108, + ellipsis: true, + tooltip: true, + default: false, + }, { + title: '告警指标', + dataIndex: 'metricsId', + slotName: 'metricsId', + align: 'left', + width: 184, + default: false, + }, { + title: '告警标签', + dataIndex: 'alarmTags', + slotName: 'alarmTags', + align: 'left', + minWidth: 168, + ellipsis: true, + tooltip: true, + default: true, + }, { + title: '告警值', + dataIndex: 'alarmValue', + slotName: 'alarmValue', + width: 148, + align: 'left', + default: true, + }, { + title: '告警阈值', + dataIndex: 'alarmThreshold', + slotName: 'alarmThreshold', + width: 148, + align: 'left', + default: false, + }, { + title: '告警摘要', + dataIndex: 'alarmInfo', + slotName: 'alarmInfo', + align: 'left', + width: 248, + tooltip: true, + default: true, + }, { + title: '连续触发次数', + dataIndex: 'consecutiveCount', + slotName: 'consecutiveCount', + align: 'left', + width: 116, + default: true, + }, { + title: '处理人', + dataIndex: 'handleUsername', + slotName: 'handleUsername', + align: 'left', + width: 138, + ellipsis: true, + tooltip: true, + default: true, + }, { + title: '处理备注', + dataIndex: 'handleRemark', + slotName: 'handleRemark', + align: 'left', + minWidth: 128, + ellipsis: true, + tooltip: true, + default: true, + }, { + title: '处理时间', + dataIndex: 'handleTime', + slotName: 'handleTime', + align: 'left', + width: 180, + render: ({ record }) => { + return record.handleTime && dateFormat(new Date(record.handleTime)); + }, + default: true, + }, { + title: '告警时间', + dataIndex: 'createTime', + slotName: 'createTime', + align: 'center', + width: 180, + render: ({ record }) => { + return dateFormat(new Date(record.createTime)); + }, + fixed: 'right', + default: true, + }, { + title: '操作', + slotName: 'handle', + width: 130, + align: 'center', + fixed: 'right', + default: true, + }, +] as TableColumnData[]; + +export default columns; diff --git a/orion-visor-ui/src/views/monitor/alarm-policy/components/alarm-policy-form-modal.vue b/orion-visor-ui/src/views/monitor/alarm-policy/components/alarm-policy-form-modal.vue new file mode 100644 index 00000000..88026878 --- /dev/null +++ b/orion-visor-ui/src/views/monitor/alarm-policy/components/alarm-policy-form-modal.vue @@ -0,0 +1,173 @@ + + + + + + + diff --git a/orion-visor-ui/src/views/monitor/alarm-policy/components/alarm-policy-table.vue b/orion-visor-ui/src/views/monitor/alarm-policy/components/alarm-policy-table.vue new file mode 100644 index 00000000..91a93dcb --- /dev/null +++ b/orion-visor-ui/src/views/monitor/alarm-policy/components/alarm-policy-table.vue @@ -0,0 +1,230 @@ + + + + + + + diff --git a/orion-visor-ui/src/views/monitor/alarm-policy/index.vue b/orion-visor-ui/src/views/monitor/alarm-policy/index.vue new file mode 100644 index 00000000..0702c54b --- /dev/null +++ b/orion-visor-ui/src/views/monitor/alarm-policy/index.vue @@ -0,0 +1,43 @@ + + + + + + + diff --git a/orion-visor-ui/src/views/monitor/alarm-policy/types/const.ts b/orion-visor-ui/src/views/monitor/alarm-policy/types/const.ts new file mode 100644 index 00000000..3f6075fa --- /dev/null +++ b/orion-visor-ui/src/views/monitor/alarm-policy/types/const.ts @@ -0,0 +1 @@ +export const TableName = 'monitor_alarm_policy'; diff --git a/orion-visor-ui/src/views/monitor/alarm-policy/types/form.rules.ts b/orion-visor-ui/src/views/monitor/alarm-policy/types/form.rules.ts new file mode 100644 index 00000000..ac59a73b --- /dev/null +++ b/orion-visor-ui/src/views/monitor/alarm-policy/types/form.rules.ts @@ -0,0 +1,20 @@ +import type { FieldRule } from '@arco-design/web-vue'; + +const rules = { + name: [{ + required: true, + message: '请输入策略名称' + }, { + maxLength: 64, + message: '策略名称长度不能大于64位' + }], + description: [{ + required: true, + message: '请输入策略描述' + }, { + maxLength: 255, + message: '策略描述长度不能大于255位' + }], +} as Record; + +export default rules; diff --git a/orion-visor-ui/src/views/monitor/alarm-policy/types/table.columns.ts b/orion-visor-ui/src/views/monitor/alarm-policy/types/table.columns.ts new file mode 100644 index 00000000..3a1fdbaa --- /dev/null +++ b/orion-visor-ui/src/views/monitor/alarm-policy/types/table.columns.ts @@ -0,0 +1,99 @@ +import type { TableColumnData } from '@arco-design/web-vue'; +import { dateFormat } from '@/utils'; + +const columns = [ + { + title: 'id', + dataIndex: 'id', + slotName: 'id', + width: 68, + align: 'left', + fixed: 'left', + default: true, + }, { + title: '策略名称', + dataIndex: 'name', + slotName: 'name', + align: 'left', + minWidth: 218, + ellipsis: true, + tooltip: true, + default: true, + }, { + title: '规则数量', + dataIndex: 'ruleCount', + slotName: 'ruleCount', + align: 'left', + width: 128, + default: true, + }, { + title: '主机数量', + dataIndex: 'hostCount', + slotName: 'hostCount', + align: 'left', + width: 128, + default: true, + }, { + title: '今日触发次数', + dataIndex: 'todayTriggerCount', + slotName: 'todayTriggerCount', + align: 'left', + width: 128, + default: true, + }, { + title: '7日触发次数', + dataIndex: 'weekTriggerCount', + slotName: 'weekTriggerCount', + align: 'left', + width: 128, + default: true, + }, { + title: '策略描述', + dataIndex: 'description', + slotName: 'description', + align: 'left', + minWidth: 238, + ellipsis: true, + tooltip: true, + default: true, + }, { + title: '创建时间', + dataIndex: 'createTime', + slotName: 'createTime', + align: 'center', + width: 180, + render: ({ record }) => { + return dateFormat(new Date(record.createTime)); + }, + }, { + title: '修改时间', + dataIndex: 'updateTime', + slotName: 'updateTime', + align: 'center', + width: 180, + render: ({ record }) => { + return dateFormat(new Date(record.updateTime)); + }, + default: true, + }, { + title: '创建人', + width: 148, + dataIndex: 'creator', + slotName: 'creator', + }, { + title: '修改人', + width: 148, + dataIndex: 'updater', + slotName: 'updater', + default: true, + }, { + title: '操作', + slotName: 'handle', + width: 248, + align: 'center', + fixed: 'right', + default: true, + }, +] as TableColumnData[]; + +export default columns; diff --git a/orion-visor-ui/src/views/monitor/alarm-rule/components/alarm-rule-form-drawer.vue b/orion-visor-ui/src/views/monitor/alarm-rule/components/alarm-rule-form-drawer.vue new file mode 100644 index 00000000..54029640 --- /dev/null +++ b/orion-visor-ui/src/views/monitor/alarm-rule/components/alarm-rule-form-drawer.vue @@ -0,0 +1,368 @@ + + + + + + + diff --git a/orion-visor-ui/src/views/monitor/alarm-rule/components/alarm-rule-table.vue b/orion-visor-ui/src/views/monitor/alarm-rule/components/alarm-rule-table.vue new file mode 100644 index 00000000..3a64350e --- /dev/null +++ b/orion-visor-ui/src/views/monitor/alarm-rule/components/alarm-rule-table.vue @@ -0,0 +1,273 @@ + + + + + + + diff --git a/orion-visor-ui/src/views/monitor/alarm-rule/index.vue b/orion-visor-ui/src/views/monitor/alarm-rule/index.vue new file mode 100644 index 00000000..9d636f9f --- /dev/null +++ b/orion-visor-ui/src/views/monitor/alarm-rule/index.vue @@ -0,0 +1,48 @@ + + + + + + + diff --git a/orion-visor-ui/src/views/monitor/alarm-rule/types/const.ts b/orion-visor-ui/src/views/monitor/alarm-rule/types/const.ts new file mode 100644 index 00000000..2a50ff25 --- /dev/null +++ b/orion-visor-ui/src/views/monitor/alarm-rule/types/const.ts @@ -0,0 +1,32 @@ +// 告警规则标签 +export interface RuleTag { + key: string; + value: string[]; +} + +// 表格名称 +export const TableName = 'alarm-rule'; + +// 默认告警条件 +export const DefaultCondition = 'GE'; + +// 默认告警等级 +export const DefaultLevel = 0; + +// 指标度量 字典项 +export const MeasurementKey = 'metricsMeasurement'; + +// 监控指标单位 字典项 +export const MetricsUnitKey = 'metricsUnit'; + +// 规则开关 字典项 +export const RuleSwitchKey = 'monitorAlarmSwitch'; + +// 告警条件 字典项 +export const TriggerConditionKey = 'alarmTriggerCondition'; + +// 告警等级 字典项 +export const LevelKey = 'alarmLevel'; + +// 加载的字典值 +export const dictKeys = [MetricsUnitKey, MeasurementKey, TriggerConditionKey, RuleSwitchKey, LevelKey]; diff --git a/orion-visor-ui/src/views/monitor/alarm-rule/types/form.rules.ts b/orion-visor-ui/src/views/monitor/alarm-rule/types/form.rules.ts new file mode 100644 index 00000000..0207e96a --- /dev/null +++ b/orion-visor-ui/src/views/monitor/alarm-rule/types/form.rules.ts @@ -0,0 +1,45 @@ +import type { FieldRule } from '@arco-design/web-vue'; + +const rules = { + policyId: [{ + required: true, + message: '请输入策略id' + }], + metricsId: [{ + required: true, + message: '请输入指标id' + }], + ruleSwitch: [{ + required: true, + message: '请输入规则开关' + }], + level: [{ + required: true, + message: '请输入告警级别' + }], + triggerCondition: [{ + required: true, + message: '请输入告警条件' + }, { + maxLength: 8, + message: '告警条件长度不能大于8位' + }], + threshold: [{ + required: true, + message: '请输入触发阈值' + }], + silencePeriod: [{ + required: true, + message: '请输入静默时间' + }], + consecutiveCount: [{ + required: true, + message: '请输入持续数据点' + }], + description: [{ + maxLength: 255, + message: '规则描述长度不能大于255位' + }], +} as Record; + +export default rules; diff --git a/orion-visor-ui/src/views/monitor/alarm-rule/types/table.columns.ts b/orion-visor-ui/src/views/monitor/alarm-rule/types/table.columns.ts new file mode 100644 index 00000000..af61e2f6 --- /dev/null +++ b/orion-visor-ui/src/views/monitor/alarm-rule/types/table.columns.ts @@ -0,0 +1,107 @@ +import type { TableColumnData } from '@arco-design/web-vue'; +import { dateFormat } from '@/utils'; + +const columns = [ + { + title: 'id', + dataIndex: 'id', + slotName: 'id', + width: 68, + align: 'left', + fixed: 'left', + default: true, + }, { + title: '告警条件', + dataIndex: 'triggerCondition', + slotName: 'triggerCondition', + align: 'left', + minWidth: 348, + ellipsis: true, + tooltip: true, + default: true, + }, { + title: '指标标签', + dataIndex: 'tags', + slotName: 'tags', + align: 'left', + width: 168, + ellipsis: true, + tooltip: true, + default: true, + }, { + title: '告警级别', + dataIndex: 'level', + slotName: 'level', + align: 'left', + width: 120, + default: true, + }, { + title: '持续数据点', + dataIndex: 'consecutiveCount', + slotName: 'consecutiveCount', + align: 'left', + width: 108, + default: true, + }, { + title: '静默时间', + dataIndex: 'silencePeriod', + slotName: 'silencePeriod', + align: 'left', + width: 108, + default: true, + }, { + title: '规则开关', + dataIndex: 'ruleSwitch', + slotName: 'ruleSwitch', + align: 'left', + width: 118, + default: true, + }, { + title: '规则描述', + dataIndex: 'description', + slotName: 'description', + align: 'left', + minWidth: 128, + ellipsis: true, + tooltip: true, + default: true, + }, { + title: '创建时间', + dataIndex: 'createTime', + slotName: 'createTime', + align: 'center', + width: 180, + render: ({ record }) => { + return dateFormat(new Date(record.createTime)); + }, + }, { + title: '修改时间', + dataIndex: 'updateTime', + slotName: 'updateTime', + align: 'center', + width: 180, + render: ({ record }) => { + return dateFormat(new Date(record.updateTime)); + }, + default: true, + }, { + title: '创建人', + width: 148, + dataIndex: 'creator', + slotName: 'creator', + }, { + title: '修改人', + width: 148, + dataIndex: 'updater', + slotName: 'updater', + }, { + title: '操作', + slotName: 'handle', + width: 168, + align: 'center', + fixed: 'right', + default: true, + }, +] as TableColumnData[]; + +export default columns; diff --git a/orion-visor-ui/src/views/monitor/metrics/components/metrics-form-modal.vue b/orion-visor-ui/src/views/monitor/metrics/components/metrics-form-modal.vue index cf0061ee..4df5ae30 100644 --- a/orion-visor-ui/src/views/monitor/metrics/components/metrics-form-modal.vue +++ b/orion-visor-ui/src/views/monitor/metrics/components/metrics-form-modal.vue @@ -28,6 +28,7 @@ @@ -71,6 +72,7 @@ + + + + diff --git a/orion-visor-ui/src/views/monitor/monitor-detail/compoments/detail-header.vue b/orion-visor-ui/src/views/monitor/monitor-detail/compoments/detail-header.vue index 47195094..0f2e0236 100644 --- a/orion-visor-ui/src/views/monitor/monitor-detail/compoments/detail-header.vue +++ b/orion-visor-ui/src/views/monitor/monitor-detail/compoments/detail-header.vue @@ -7,7 +7,9 @@ + +
+ +
+ 更新时间: {{ dateFormat(new Date(overrideTimestamp)) }} +
-
+
(); const emits = defineEmits(['reloadChart']); const activeKey = defineModel('activeKey', { type: String }); @@ -199,7 +207,7 @@ .header-right { padding-right: 16px; - .chart-handle { + .handle-wrapper { display: flex; } } diff --git a/orion-visor-ui/src/views/monitor/monitor-detail/compoments/host-overview-tab.vue b/orion-visor-ui/src/views/monitor/monitor-detail/compoments/host-overview-tab.vue new file mode 100644 index 00000000..567c5239 --- /dev/null +++ b/orion-visor-ui/src/views/monitor/monitor-detail/compoments/host-overview-tab.vue @@ -0,0 +1,522 @@ + + + + + + + diff --git a/orion-visor-ui/src/views/monitor/monitor-detail/compoments/metrics-chart-tab.vue b/orion-visor-ui/src/views/monitor/monitor-detail/compoments/metrics-chart-tab.vue index bcc8608f..cfe480f1 100644 --- a/orion-visor-ui/src/views/monitor/monitor-detail/compoments/metrics-chart-tab.vue +++ b/orion-visor-ui/src/views/monitor/monitor-detail/compoments/metrics-chart-tab.vue @@ -18,7 +18,7 @@ diff --git a/orion-visor-ui/src/views/monitor/monitor-detail/types/const.ts b/orion-visor-ui/src/views/monitor/monitor-detail/types/const.ts index b83e96af..2a2a68c5 100644 --- a/orion-visor-ui/src/views/monitor/monitor-detail/types/const.ts +++ b/orion-visor-ui/src/views/monitor/monitor-detail/types/const.ts @@ -1,4 +1,5 @@ import type { WindowUnit, MetricUnitType, MetricUnitFormatOptions } from '@/utils/metrics'; +import { dictKeys as alarmDictKeys } from '@/views/monitor/alarm-event/types/const'; // 图表组件配置 export interface MetricsChartProps { @@ -26,9 +27,13 @@ export interface MetricsChartOption { // tab export const TabKeys = { - CHART: 'chart' + OVERVIEW: 'overview', + CHART: 'chart', + ALARM: 'alarm', }; +export const TableName = 'host_alarm_event'; + // 探针在线状态 字典项 export const OnlineStatusKey = 'agentOnlineStatus'; @@ -42,4 +47,4 @@ export const ChartRangeKey = 'metricsChartRange'; export const MetricsAggregateKey = 'metricsAggregate'; // 加载的字典值 -export const dictKeys = [AlarmSwitchKey, OnlineStatusKey, ChartRangeKey, MetricsAggregateKey]; +export const dictKeys = [AlarmSwitchKey, OnlineStatusKey, ChartRangeKey, MetricsAggregateKey, ...alarmDictKeys]; diff --git a/orion-visor-ui/src/views/monitor/monitor-host/components/monitor-host-card-list.vue b/orion-visor-ui/src/views/monitor/monitor-host/components/monitor-host-card-list.vue index 7fd152a5..d2f9bb47 100644 --- a/orion-visor-ui/src/views/monitor/monitor-host/components/monitor-host-card-list.vue +++ b/orion-visor-ui/src/views/monitor/monitor-host/components/monitor-host-card-list.vue @@ -4,7 +4,7 @@ :create-card-position="false" :loading="loading" :field-config="cardFieldConfig" - :list="list" + :list="renderList" :pagination="pagination" :card-layout-cols="cardColLayout" :filter-count="filterCount" @@ -101,7 +101,7 @@