feat:explore 添加错误提示信息 & endpoint-query dialog样式调整

This commit is contained in:
wangwenrui
2020-04-24 17:41:33 +08:00
parent 37586c40cd
commit aa0889c613
5 changed files with 67 additions and 35 deletions

View File

@@ -28,6 +28,7 @@
<!--这个index居然是从1开始-->
<promql-input
v-for="index of promqlKeys.length"
:ref="'promql-'+(index-1)"
:id="promqlKeys[index-1]"
:key="promqlKeys[index-1]"
:expression-list="expressions"
@@ -250,9 +251,11 @@ instance_cpu_time_ns{app="fox", proc="widget", rev="4d3a513", env="prod", job="c
setTimeout(() => {
if (this.expressions.length > 0) {
let requestArr = [];
let promqlInputIndexs=[];
this.expressions.forEach((item, index) => {
if (item != '') {
let step=bus.getStep(this.filterTime[0],this.filterTime[1]);
promqlInputIndexs.push(index);
requestArr.push(axios.get('/prom/api/v1/query_range?query=' + item + '&start=' + this.filterTime[0] + '&end=' + this.filterTime[1] + '&step='+step))
}
})
@@ -267,7 +270,7 @@ instance_cpu_time_ns{app="fox", proc="widget", rev="4d3a513", env="prod", job="c
res.forEach((response, index) => {
if (response.data.status == 'success') {
let data = response.data.data.result;
data.forEach((result, index) => {
data.forEach((result, i) => {
let seriesItem = {
name: '',
symbol: 'none', //去掉点
@@ -289,13 +292,22 @@ instance_cpu_time_ns{app="fox", proc="widget", rev="4d3a513", env="prod", job="c
series.push(seriesItem);
legend.push({name: seriesItem.name, alias: null, isGray: false});
})
}else{
let promqlIndex=promqlInputIndexs[index];
console.log(response)
this.$refs['promql-'+promqlIndex][0].setError(response.data.error)
}
})
this.$refs.exploreChart.setLegend(legend);
this.$refs.exploreChart.setRandomColors(series.length)
this.$refs.exploreChart.setSeries(series)
if(series.length>0){
this.$refs.exploreChart.setLegend(legend);
this.$refs.exploreChart.setRandomColors(series.length)
this.$refs.exploreChart.setSeries(series)
this.defaultChartVisible = true;
}else{
// this.defaultChartVisible = false;
}
}
this.defaultChartVisible = true;
this.$refs.exploreChart.endLoading();
})
}
@@ -348,14 +360,19 @@ instance_cpu_time_ns{app="fox", proc="widget", rev="4d3a513", env="prod", job="c
return a.prop.charCodeAt(0) - b.prop.charCodeAt(0);
})
})
this.storedTableData = Object.assign([], tData);
this.pageObj.total = this.storedTableData.length;
this.tableData = this.filterShowData(this.storedTableData, this.pageObj);
this.tableLabels = Object.assign([], tLabels);
this.showTableLabels = Object.assign([], tLabels);
this.dropCol = Object.assign([], tLabels);
console.log(tData.length)
if(tData.length>0){
this.storedTableData = Object.assign([], tData);
this.pageObj.total = this.storedTableData.length;
this.tableData = this.filterShowData(this.storedTableData, this.pageObj);
this.tableLabels = Object.assign([], tLabels);
this.showTableLabels = Object.assign([], tLabels);
this.dropCol = Object.assign([], tLabels);
this.defaultTableVisible = true;
}else{
// this.defaultTableVisible = false;
}
}
this.defaultTableVisible = true;
this.tableLoading = false;
})
}
@@ -448,8 +465,6 @@ instance_cpu_time_ns{app="fox", proc="widget", rev="4d3a513", env="prod", job="c
const dh = this.$refs.elementset.$el.offsetHeight;
let positionx =
e.clientX + dw <= w - 10 ? e.clientX + 14 : e.clientX + 14 - dw;
console.log(e.clientY + dh)
console.log(h)
let positiony =
e.clientY + dh <= h - 10
? e.clientY + 20