pref:dashboard legend点击交互 & legend 别名功能优化

1.dashboard legend点击逻辑与grafana保持一致
2.legend别名显示、配置优化
3.tooltip 使用别名
4.抽取公共的重新设置popover z-index 的方法到common.js
This commit is contained in:
wangwenrui
2020-03-04 20:30:25 +08:00
parent 06bb5423d9
commit c2331eaeeb
8 changed files with 188 additions and 52 deletions

View File

@@ -298,8 +298,9 @@ export default {
let t_date = new Date(dpsItem[0] * 1000);
let timeTmp = bus.timeFormate(t_date, 'yyyy-MM-dd hh:mm:ss');
tableData.push({//表格数据
label: host.slice(host.indexOf('{') + 1,host.indexOf('}')),//label
metric: queryItem.metric.__name__?queryItem.metric.__name__:'',//metric列
// label: host.slice(host.indexOf('{') + 1,host.indexOf('}')),//label
// metric: queryItem.metric.__name__?queryItem.metric.__name__:'',//metric列
element:{element:host,alias:alias},
time: timeTmp,//采集时间
value: dpsItem[1],//数值
});
@@ -378,6 +379,7 @@ export default {
}).catch((error) => {
if (error) {
this.$message.error(error.toString());
console.error(error)
}
});
});
@@ -395,9 +397,12 @@ export default {
let labelValue=expression.replace(/(\{\{.+?\}\})/g,function(i){
let label=i.substr(i.indexOf('{{')+2,i.indexOf('}}')-i.indexOf('{{')-2)
let reg=new RegExp(label+'=".+?"')
let find=legend.match(reg)[0];
let value=find.substr(find.indexOf('"')+1,find.lastIndexOf('"')-find.indexOf('"')-1);
return value;
let value=null;
if(reg.test(legend)){
let find=legend.match(reg)[0];
value=find.substr(find.indexOf('"')+1,find.lastIndexOf('"')-find.indexOf('"')-1);
}
return value?value:label;
})
return labelValue
}else{