fix:endpoint 最新指标列表查询功能bug修复

This commit is contained in:
wangwenrui
2020-02-13 09:34:47 +08:00
parent 547ed24238
commit 87ac19ef41
2 changed files with 40 additions and 12 deletions

View File

@@ -33,7 +33,14 @@
ref="queryExpression"
>
<template slot-scope="{ item }">
<span>{{ item.key }}<!--:{{item.type}}--></span>
<el-popover
trigger="hover"
placement="left"
>
<span><span class="tip-line-font">[{{item.type}}]&nbsp;</span>{{ item.key }}</span>
<span slot="reference">{{ item.key }}<!--:{{item.type}}--></span>
</el-popover>
</template>
</el-autocomplete>
</div>
@@ -214,6 +221,7 @@
</script>
<style scoped lang="scss">
@import '../../../assets/stylus/index';
/* .search-input-history{
display: inline-block;
border:1px solid #e5e5e5;
@@ -243,6 +251,9 @@
background: #f0f0f0;
cursor:pointer;
}
.tip-line-font{
color:$header-text-color;
}
.new-search{
display: flex;
position: relative;

View File

@@ -1109,12 +1109,16 @@
metric=expression.substr(0,expression.indexOf('{'));
let labelStr=expression.substr(expression.indexOf('{')+1,expression.indexOf('}')-expression.indexOf('{')-1);
let labelArr=labelStr.split(',');
if(labelArr.length>0){
labels=labelArr.map((item,index)=>{
let temp=item.split('=');
let label=temp[0]&&temp[0]!=''?temp[0]:null;
let value=temp[1]&&temp[1]!=''?temp[1]:null;
return label?{label:label,value:value}:null;
})
}
}else{
metric=expression;
}
@@ -1125,13 +1129,26 @@
if(metricName.indexOf(metric)==-1){
return false;
}
if(labels.length>0){
for(let i in labels){
let label=labels[i];
if(label&&label.label){
let value=item.metric[label.label];
if(!value || value != label.value){
let queryVal=label.value;
debugger
if(/^'.+'$/.test(queryVal)){
queryVal=queryVal.substr(1,queryVal.length-2);
}
if(!value || value != queryVal){
return false;
}
}else{
return true;
}
}
}
return true;
})
for(let i in sourceData){