diff --git a/nezha-fronted/src/components/charts/chartDataFormat.js b/nezha-fronted/src/components/charts/chartDataFormat.js index c1e41c3f2..8dd99c54b 100644 --- a/nezha-fronted/src/components/charts/chartDataFormat.js +++ b/nezha-fronted/src/components/charts/chartDataFormat.js @@ -4,6 +4,7 @@ * type:自定义参数,用于区分是y轴调用还是tooltip调用,以设置不同精度 type =1 y轴调用 type=2 tooltip调用 * */ import {parse} from "echarts/extension-src/dataTool/gexf"; +import bus from "../../libs/bus" function none(value, index){ return value; @@ -412,6 +413,12 @@ function timeCompute(value,unit,dot=0){ } } +function timeFormat34(value) { + return bus.timeFormate(value, "yyyy-MM-dd hh:mm:ss"); +} +function timeFormat35(value) { + return bus.timeFormate(value, "MM/dd/yyyy h:mm:ss a"); +} //unit转化配置信息 /* * value:传递给数据库的值 @@ -615,7 +622,23 @@ let unitOptions=[ ascii:7, }, ] - }//Time end + },//Time end + { + value:'Date&Time', + label: 'Date & Time', + children: [ + { + value:34, + compute: timeFormat34, + label:'YYYY-MM-DD HH:mm:ss', + }, + { + value:35, + compute: timeFormat35, + label:'MM/DD/YYYY h:mm:ss a', + } + ] + } ] let units=[]; window.onload=function(){ diff --git a/nezha-fronted/src/components/common/alert/alertMessageTable.vue b/nezha-fronted/src/components/common/alert/alertMessageTable.vue index 8f3a9ae0a..c781bbc08 100644 --- a/nezha-fronted/src/components/common/alert/alertMessageTable.vue +++ b/nezha-fronted/src/components/common/alert/alertMessageTable.vue @@ -567,7 +567,31 @@ }, promQueryParamConvert(obj){ - let result="(" + obj.alertRule.expr + ")"; + let r = "(" + obj.alertRule.expr + ")"; + if (Object.keys(obj.labels).length > 0) { + r += " and " + function(){ + let group = "(group({"; + let by = " by ("; + + for (let k in obj.labels) { + if (k != 'alertname' && k != 'severity') { + group += k; + group += "="; + group += ("'" + obj.labels[k] + "',"); + by += k; + by += "," + } + } + group = group.substring(0, group.length-1); + group += "})"; + by = by.substring(0, by.length-1); + by += ")"; + + return group + by + ")"; + }(); + } + return r; + /*let result="(" + obj.alertRule.expr + ")"; if(obj.labels){ if(obj.labels.alertname){ delete obj.labels.alertname; @@ -591,7 +615,7 @@ return q; }() + ")"; } - return result; + return result;*/ }, //asset弹框控制 tabControl(data) { diff --git a/nezha-fronted/src/components/common/header.vue b/nezha-fronted/src/components/common/header.vue index 8aba854e7..d7df88053 100644 --- a/nezha-fronted/src/components/common/header.vue +++ b/nezha-fronted/src/components/common/header.vue @@ -108,7 +108,7 @@ - {{$t('overall.config')}} + {{$t('overall.config')}} {{$t('config.account.account')}} @@ -134,6 +134,9 @@ {{$t('config.operationlog.operationlog')}} + + {{$t('overall.about')}} + diff --git a/nezha-fronted/src/components/common/js/constants.js b/nezha-fronted/src/components/common/js/constants.js index 9148f6e4d..ee20328cc 100644 --- a/nezha-fronted/src/components/common/js/constants.js +++ b/nezha-fronted/src/components/common/js/constants.js @@ -12,6 +12,7 @@ export const staticMenus = { {route: '/system', name: i18n.t('config.system.system')}, {route: '/terminallog', name: i18n.t('config.terminallog.terminallog')}, {route: '/operationlog', name: i18n.t('config.operationlog.operationlog')}, + {route: '/about', name: i18n.t('overall.about')}, ], }, alerts: { diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js index 628afe0ef..7861abe6c 100644 --- a/nezha-fronted/src/components/common/language/cn.js +++ b/nezha-fronted/src/components/common/language/cn.js @@ -13,7 +13,7 @@ const cn = { esc: "取消", cancel: "取消", save: "保存", - preivew: "预览", + preview: "预览", download: "下载", upload: "上传", search: "搜索", @@ -26,6 +26,8 @@ const cn = { clearAll: "清空", clear: "清除", name: "名称", + version: "版本", + components: "组件", cover: "覆盖", signOut: "登出", select: "选择", @@ -34,6 +36,7 @@ const cn = { all: "全选", value: "值", other: "其他", + about: '关于', query: "查询", back: "返回", unavailable: "不可用", @@ -48,7 +51,6 @@ const cn = { createDatacenter: "新增数据中心", active: "活跃", type: "类别", - preview: "预览", detail: "详细信息", changePwd: "修改密码", createCabinet: "创建机柜", diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index 647da4823..904098b66 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -31,6 +31,8 @@ const en = { remark: "Description", clear: 'Clear', //"清除" name: 'Name', //'名称' + version: "Version", //版本 + components: "Components", //组件 cover: 'Override', //'覆盖' signOut: 'Logout',//'登出' select: 'Select',//'选择' @@ -39,6 +41,7 @@ const en = { all: 'All',//'全选' value: 'Value', other: 'Others',//"其他" + about: 'About',//关于 detail: 'Detail', //详情 query: 'Query', //查询 back: 'Back', //返回 diff --git a/nezha-fronted/src/components/page/config/about.vue b/nezha-fronted/src/components/page/config/about.vue new file mode 100644 index 000000000..1370ffca5 --- /dev/null +++ b/nezha-fronted/src/components/page/config/about.vue @@ -0,0 +1,106 @@ + + + + + + {{version.nezha.name}} + {{$t("overall.version")}} {{version.nezha.version}} + + + + {{$t("overall.components")}} + + + {{item.name}} + {{item.version}} + + + + + + + diff --git a/nezha-fronted/src/libs/bus.js b/nezha-fronted/src/libs/bus.js index 60d6e4541..01301e6f4 100644 --- a/nezha-fronted/src/libs/bus.js +++ b/nezha-fronted/src/libs/bus.js @@ -100,10 +100,11 @@ export default new Vue({ const o = { 'M+': time.getMonth() + 1, // 月份 'd+': time.getDate(), // 日 - 'h+': time.getHours(), // 小时 + 'hh': time.getHours(), // 小时 'm+': time.getMinutes(), // 分 's+': time.getSeconds(), // 秒 'q+': Math.floor((time.getMonth() + 3) / 3), // 季度 + 'a': time.getHours() > 12 ? "pm" : "am", S: time.getMilliseconds(), // 毫秒 w: week, }; @@ -116,6 +117,7 @@ export default new Vue({ (o[k]) : ((`00${o[k]}`).substr((`${o[k]}`).length))); } }); + fm = fm.replace("h", time.getHours() > 12 ? time.getHours()-12 : time.getHours()); return fm; }, // 格式化tag为字符串表达式 diff --git a/nezha-fronted/src/router/index.js b/nezha-fronted/src/router/index.js index 15f1422a8..3456bb864 100644 --- a/nezha-fronted/src/router/index.js +++ b/nezha-fronted/src/router/index.js @@ -84,6 +84,10 @@ export default new Router({ path: '/operationlog', component: resolve => require(['../components/page/config/operationlog.vue'], resolve), }, + { + path: '/about', + component: resolve => require(['../components/page/config/about.vue'], resolve), + }, { path: '/mib', component: resolve => require(['../components/page/config/mib.vue'], resolve),