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('config.account.account')}}
@@ -134,6 +134,9 @@
{{$t('config.operationlog.operationlog')}}
+ +
{{$t('overall.about')}}
+