perf: alertdetail弹出框使用groupby、增加d&t
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
* type:自定义参数,用于区分是y轴调用还是tooltip调用,以设置不同精度 type =1 y轴调用 type=2 tooltip调用
|
* type:自定义参数,用于区分是y轴调用还是tooltip调用,以设置不同精度 type =1 y轴调用 type=2 tooltip调用
|
||||||
* */
|
* */
|
||||||
import {parse} from "echarts/extension-src/dataTool/gexf";
|
import {parse} from "echarts/extension-src/dataTool/gexf";
|
||||||
|
import bus from "../../libs/bus"
|
||||||
|
|
||||||
function none(value, index){
|
function none(value, index){
|
||||||
return value;
|
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转化配置信息
|
//unit转化配置信息
|
||||||
/*
|
/*
|
||||||
* value:传递给数据库的值
|
* value:传递给数据库的值
|
||||||
@@ -615,7 +622,23 @@ let unitOptions=[
|
|||||||
ascii:7,
|
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=[];
|
let units=[];
|
||||||
window.onload=function(){
|
window.onload=function(){
|
||||||
|
|||||||
@@ -567,7 +567,31 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
promQueryParamConvert(obj){
|
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){
|
||||||
if(obj.labels.alertname){
|
if(obj.labels.alertname){
|
||||||
delete obj.labels.alertname;
|
delete obj.labels.alertname;
|
||||||
@@ -591,7 +615,7 @@
|
|||||||
return q;
|
return q;
|
||||||
}() + ")";
|
}() + ")";
|
||||||
}
|
}
|
||||||
return result;
|
return result;*/
|
||||||
},
|
},
|
||||||
//asset弹框控制
|
//asset弹框控制
|
||||||
tabControl(data) {
|
tabControl(data) {
|
||||||
|
|||||||
@@ -100,10 +100,11 @@ export default new Vue({
|
|||||||
const o = {
|
const o = {
|
||||||
'M+': time.getMonth() + 1, // 月份
|
'M+': time.getMonth() + 1, // 月份
|
||||||
'd+': time.getDate(), // 日
|
'd+': time.getDate(), // 日
|
||||||
'h+': time.getHours(), // 小时
|
'hh': time.getHours(), // 小时
|
||||||
'm+': time.getMinutes(), // 分
|
'm+': time.getMinutes(), // 分
|
||||||
's+': time.getSeconds(), // 秒
|
's+': time.getSeconds(), // 秒
|
||||||
'q+': Math.floor((time.getMonth() + 3) / 3), // 季度
|
'q+': Math.floor((time.getMonth() + 3) / 3), // 季度
|
||||||
|
'a': time.getHours() > 12 ? "pm" : "am",
|
||||||
S: time.getMilliseconds(), // 毫秒
|
S: time.getMilliseconds(), // 毫秒
|
||||||
w: week,
|
w: week,
|
||||||
};
|
};
|
||||||
@@ -116,6 +117,7 @@ export default new Vue({
|
|||||||
(o[k]) : ((`00${o[k]}`).substr((`${o[k]}`).length)));
|
(o[k]) : ((`00${o[k]}`).substr((`${o[k]}`).length)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
fm = fm.replace("h", time.getHours() > 12 ? time.getHours()-12 : time.getHours());
|
||||||
return fm;
|
return fm;
|
||||||
},
|
},
|
||||||
// 格式化tag为字符串表达式
|
// 格式化tag为字符串表达式
|
||||||
|
|||||||
Reference in New Issue
Block a user