feat:explore 添加错误提示信息 & endpoint-query dialog样式调整
This commit is contained in:
@@ -1451,7 +1451,7 @@ li{
|
|||||||
border-radius: 5px !important;
|
border-radius: 5px !important;
|
||||||
}
|
}
|
||||||
.line-chart-block-modal .el-dialog {
|
.line-chart-block-modal .el-dialog {
|
||||||
margin-top: 5% !important;
|
//margin-top: 5% !important;
|
||||||
}
|
}
|
||||||
.table-chart-dialog .el-dialog {
|
.table-chart-dialog .el-dialog {
|
||||||
height: 80%;
|
height: 80%;
|
||||||
|
|||||||
@@ -4,6 +4,11 @@
|
|||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<style>
|
||||||
|
.endpoint-dialog .el-dialog__body{
|
||||||
|
height: 100% !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<template>
|
<template>
|
||||||
<span>
|
<span>
|
||||||
<div class="sub-top-tools">
|
<div class="sub-top-tools">
|
||||||
@@ -145,7 +150,7 @@
|
|||||||
</el-table>-->
|
</el-table>-->
|
||||||
<button class="to-top" v-show="showTopBtn" :class="{'to-top-is-hover': tableHover}" @click="$('ps', 1)"><i class="nz-icon nz-icon-top"></i></button>
|
<button class="to-top" v-show="showTopBtn" :class="{'to-top-is-hover': tableHover}" @click="$('ps', 1)"><i class="nz-icon nz-icon-top"></i></button>
|
||||||
|
|
||||||
<el-dialog class="line-chart-block-modal nz-dialog"
|
<el-dialog class="line-chart-block-modal nz-dialog endpoint-dialog"
|
||||||
:title="$t('project.endpoint.dialogTitle')"
|
:title="$t('project.endpoint.dialogTitle')"
|
||||||
:visible.sync="graphShow"
|
:visible.sync="graphShow"
|
||||||
width="90%"
|
width="90%"
|
||||||
@@ -153,16 +158,12 @@
|
|||||||
@close="dialogClose">
|
@close="dialogClose">
|
||||||
<div slot="title">
|
<div slot="title">
|
||||||
{{$t("project.endpoint.dialogTitle")}}
|
{{$t("project.endpoint.dialogTitle")}}
|
||||||
<div class="float-right panel-calendar dialog-tool">
|
<div class="float-right panel-calendar dialog-tool" style="display: flex">
|
||||||
<pick-time :refresh-data-func="queryChartDate" :use-refresh="false" v-model="searchTime"></pick-time>
|
<pick-time :refresh-data-func="queryChartDate" :use-refresh="false" v-model="searchTime"></pick-time>
|
||||||
|
<button class="nz-btn nz-btn-size-large nz-btn-style-normal nz-btn-min-width-82" @click="saveChart">{{$t('dashboard.metric.saveChart')}}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<chart ref="endpointChart" ></chart>
|
<chart ref="endpointChart" ></chart>
|
||||||
<div class="line-100 margin-t-10"></div>
|
|
||||||
<div class="chart-bottom">
|
|
||||||
<button class="nz-btn nz-btn-size-large nz-btn-style-normal nz-btn-min-width-82" @click="saveChart">{{$t('dashboard.metric.saveChart')}}</button>
|
|
||||||
</div>
|
|
||||||
<loading ref="graphLoading"></loading>
|
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<chart-box ref="addChartModal" :panel-data="panelData" @on-create-success="createSuccess" @reloadOnlyPanel="getPanelData" @reload="getPanelData"></chart-box>
|
<chart-box ref="addChartModal" :panel-data="panelData" @on-create-success="createSuccess" @reloadOnlyPanel="getPanelData" @reload="getPanelData"></chart-box>
|
||||||
@@ -224,12 +225,12 @@
|
|||||||
metricInfo.elements = [];
|
metricInfo.elements = [];
|
||||||
//console.info("aaa", this.selectedEndpoints)
|
//console.info("aaa", this.selectedEndpoints)
|
||||||
for(let i = 0; i < this.selectedEndpoints.length; i++) {
|
for(let i = 0; i < this.selectedEndpoints.length; i++) {
|
||||||
let type = '';
|
let type = 'expert';
|
||||||
if (this.selectedEndpoints[i].type == '1') {
|
// if (this.selectedEndpoints[i].type == '1') {
|
||||||
type = 'expert';
|
// type = 'expert';
|
||||||
} else if (this.selectedEndpoints[i].type == '2') {
|
// } else if (this.selectedEndpoints[i].type == '2') {
|
||||||
type = 'normal';
|
// type = 'normal';
|
||||||
}
|
// }
|
||||||
metricInfo.elements.push({expression: this.selectedEndpoints[i].element, type: type});
|
metricInfo.elements.push({expression: this.selectedEndpoints[i].element, type: type});
|
||||||
}
|
}
|
||||||
this.$refs.addChartModal.createData(-1, metricInfo);
|
this.$refs.addChartModal.createData(-1, metricInfo);
|
||||||
@@ -418,10 +419,6 @@
|
|||||||
this.$refs.endpointChart.startLoading();
|
this.$refs.endpointChart.startLoading();
|
||||||
this.queryChartDate();
|
this.queryChartDate();
|
||||||
});
|
});
|
||||||
/*setTimeout(()=> {
|
|
||||||
this.$refs.graphLoading.startLoading();
|
|
||||||
this.queryChartDate();
|
|
||||||
}, 200);*/
|
|
||||||
},
|
},
|
||||||
dialogClose:function(){
|
dialogClose:function(){
|
||||||
this.graphShow=false;
|
this.graphShow=false;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
<!--坑,这个index居然是从1开始-->
|
<!--坑,这个index居然是从1开始-->
|
||||||
<promql-input
|
<promql-input
|
||||||
v-for="index of promqlKeys.length"
|
v-for="index of promqlKeys.length"
|
||||||
|
:ref="'promql-'+(index-1)"
|
||||||
:id="promqlKeys[index-1]"
|
:id="promqlKeys[index-1]"
|
||||||
:key="promqlKeys[index-1]"
|
:key="promqlKeys[index-1]"
|
||||||
:expression-list="expressions"
|
:expression-list="expressions"
|
||||||
@@ -250,9 +251,11 @@ instance_cpu_time_ns{app="fox", proc="widget", rev="4d3a513", env="prod", job="c
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.expressions.length > 0) {
|
if (this.expressions.length > 0) {
|
||||||
let requestArr = [];
|
let requestArr = [];
|
||||||
|
let promqlInputIndexs=[];
|
||||||
this.expressions.forEach((item, index) => {
|
this.expressions.forEach((item, index) => {
|
||||||
if (item != '') {
|
if (item != '') {
|
||||||
let step=bus.getStep(this.filterTime[0],this.filterTime[1]);
|
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))
|
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) => {
|
res.forEach((response, index) => {
|
||||||
if (response.data.status == 'success') {
|
if (response.data.status == 'success') {
|
||||||
let data = response.data.data.result;
|
let data = response.data.data.result;
|
||||||
data.forEach((result, index) => {
|
data.forEach((result, i) => {
|
||||||
let seriesItem = {
|
let seriesItem = {
|
||||||
name: '',
|
name: '',
|
||||||
symbol: 'none', //去掉点
|
symbol: 'none', //去掉点
|
||||||
@@ -289,13 +292,22 @@ instance_cpu_time_ns{app="fox", proc="widget", rev="4d3a513", env="prod", job="c
|
|||||||
series.push(seriesItem);
|
series.push(seriesItem);
|
||||||
legend.push({name: seriesItem.name, alias: null, isGray: false});
|
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)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
if(series.length>0){
|
||||||
this.$refs.exploreChart.setLegend(legend);
|
this.$refs.exploreChart.setLegend(legend);
|
||||||
this.$refs.exploreChart.setRandomColors(series.length)
|
this.$refs.exploreChart.setRandomColors(series.length)
|
||||||
this.$refs.exploreChart.setSeries(series)
|
this.$refs.exploreChart.setSeries(series)
|
||||||
}
|
|
||||||
this.defaultChartVisible = true;
|
this.defaultChartVisible = true;
|
||||||
|
}else{
|
||||||
|
// this.defaultChartVisible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.$refs.exploreChart.endLoading();
|
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);
|
return a.prop.charCodeAt(0) - b.prop.charCodeAt(0);
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
console.log(tData.length)
|
||||||
|
if(tData.length>0){
|
||||||
this.storedTableData = Object.assign([], tData);
|
this.storedTableData = Object.assign([], tData);
|
||||||
this.pageObj.total = this.storedTableData.length;
|
this.pageObj.total = this.storedTableData.length;
|
||||||
this.tableData = this.filterShowData(this.storedTableData, this.pageObj);
|
this.tableData = this.filterShowData(this.storedTableData, this.pageObj);
|
||||||
this.tableLabels = Object.assign([], tLabels);
|
this.tableLabels = Object.assign([], tLabels);
|
||||||
this.showTableLabels = Object.assign([], tLabels);
|
this.showTableLabels = Object.assign([], tLabels);
|
||||||
this.dropCol = Object.assign([], tLabels);
|
this.dropCol = Object.assign([], tLabels);
|
||||||
}
|
|
||||||
this.defaultTableVisible = true;
|
this.defaultTableVisible = true;
|
||||||
|
}else{
|
||||||
|
// this.defaultTableVisible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
this.tableLoading = false;
|
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;
|
const dh = this.$refs.elementset.$el.offsetHeight;
|
||||||
let positionx =
|
let positionx =
|
||||||
e.clientX + dw <= w - 10 ? e.clientX + 14 : e.clientX + 14 - dw;
|
e.clientX + dw <= w - 10 ? e.clientX + 14 : e.clientX + 14 - dw;
|
||||||
console.log(e.clientY + dh)
|
|
||||||
console.log(h)
|
|
||||||
let positiony =
|
let positiony =
|
||||||
e.clientY + dh <= h - 10
|
e.clientY + dh <= h - 10
|
||||||
? e.clientY + 20
|
? e.clientY + 20
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="promqlInput">
|
<div class="promqlInput" :style="{height:(errorMsg || appendMsg)?'50px':'36px'}">
|
||||||
<div class="query-row">
|
<div class="query-row">
|
||||||
<div class="query-input">
|
<div class="query-input">
|
||||||
<div class="metricBtn">
|
<div class="metricBtn">
|
||||||
@@ -8,10 +8,11 @@
|
|||||||
<el-button class="metric-btn nz-btn nz-btn-size-normal nz-btn-style-light" @click="toggleDropdown">Metric <i class="el-icon-arrow-down"></i></el-button>
|
<el-button class="metric-btn nz-btn nz-btn-size-normal nz-btn-style-light" @click="toggleDropdown">Metric <i class="el-icon-arrow-down"></i></el-button>
|
||||||
<el-cascader-panel v-show="dropDownVisible" v-model="cascaderValue" slot="dropdown" ref="metricSelector" :props="{emitPath:false}" :options="metricOptions" @change="metricChange"></el-cascader-panel>
|
<el-cascader-panel v-show="dropDownVisible" v-model="cascaderValue" slot="dropdown" ref="metricSelector" :props="{emitPath:false}" :options="metricOptions" @change="metricChange"></el-cascader-panel>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="inputBox">
|
<div class="inputBox">
|
||||||
<el-autocomplete :placeholder="$t('dashboard.metricPreview.inputTip')" :fetch-suggestions="filterInput" clearable @clear="clearExpression" :trigger-on-focus="false" v-model="expressionList[index]" @blur="expressionChange" style="width: 100%;height:36px"></el-autocomplete>
|
<el-autocomplete :placeholder="$t('dashboard.metricPreview.inputTip')" :fetch-suggestions="filterInput" clearable @clear="clearExpression" :trigger-on-focus="false" v-model="expressionList[index]" @blur="expressionChange" style="width: 100%;height:36px"></el-autocomplete>
|
||||||
|
<div class="append-msg error" v-if="errorMsg"><span>{{errorMsg}}</span></div>
|
||||||
|
<div class="append-msg error" v-if="appendMsg"><span>{{appendMsg}}</span></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -21,6 +22,7 @@
|
|||||||
<div class="option nz-btn nz-btn-size-normal nz-btn-style-light" @click="removeExpression"><i class="el-icon-minus"></i></div>
|
<div class="option nz-btn nz-btn-size-normal nz-btn-style-light" @click="removeExpression"><i class="el-icon-minus"></i></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -37,6 +39,8 @@
|
|||||||
metricStore:[],
|
metricStore:[],
|
||||||
metricOptions:[],
|
metricOptions:[],
|
||||||
cascaderValue:'',
|
cascaderValue:'',
|
||||||
|
errorMsg:null,
|
||||||
|
appendMsg:null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@@ -118,6 +122,13 @@
|
|||||||
},
|
},
|
||||||
expressionChange:function(){
|
expressionChange:function(){
|
||||||
this.$emit('change')
|
this.$emit('change')
|
||||||
|
},
|
||||||
|
setError:function(errMsg){
|
||||||
|
console.log(errMsg)
|
||||||
|
this.errorMsg=errMsg;
|
||||||
|
},
|
||||||
|
setMsg:function(){
|
||||||
|
this.appendMsg
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch:{
|
watch:{
|
||||||
@@ -141,6 +152,14 @@
|
|||||||
.promqlInput .query-row{
|
.promqlInput .query-row{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
.inputBox .append-msg{
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1;
|
||||||
|
padding-top: 4px;
|
||||||
|
}
|
||||||
|
.inputBox .error{
|
||||||
|
color: #F56C6C;
|
||||||
|
}
|
||||||
.query-row .query-input{
|
.query-row .query-input{
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
<el-collapse v-model="currentProjectTitle" class="left-menu-bg" accordion style="padding-top:0px;" @change="projectChange" ref="projectLeft">
|
<el-collapse v-model="currentProjectTitle" class="left-menu-bg" accordion style="padding-top:0px;" @change="projectChange" ref="projectLeft">
|
||||||
<el-collapse-item v-for="(item,index) in projectList" :key="item.name+item.id+index" :name="item.name+'-'+item.id">
|
<el-collapse-item v-for="(item,index) in projectList" :key="item.name+item.id+index" :name="item.name+'-'+item.id">
|
||||||
<template slot="title">
|
<template slot="title">
|
||||||
<div class="sidebar-info-item" :class="{'sidebar-info-item-active': item.name+'-'+item.id==currentProjectTitle || item.id==currentProject.id}" @click="detailProjectInfo($event,item)" :id="'project-module-'+item.id">
|
<div class="sidebar-info-item" :class="{'sidebar-info-item-active': item.id==currentProject.id}" @click="detailProjectInfo($event,item)" :id="'project-module-'+item.id">
|
||||||
<div class="sidebar-info-item-txt">
|
<div class="sidebar-info-item-txt">
|
||||||
<el-popover v-if="item.name.length > 14" trigger="hover" placement="top-start" :content="item.name" popper-class="transparent-pop">
|
<el-popover v-if="item.name.length > 14" trigger="hover" placement="top-start" :content="item.name" popper-class="transparent-pop">
|
||||||
<span slot="reference" class="">
|
<span slot="reference" class="">
|
||||||
@@ -497,6 +497,7 @@
|
|||||||
//左侧module列表选中切换
|
//左侧module列表选中切换
|
||||||
changeModule(module) {
|
changeModule(module) {
|
||||||
this.currentModule = module;
|
this.currentModule = module;
|
||||||
|
this.currentProject={};
|
||||||
this.endpointSearchLabel = {moduleId: ''};
|
this.endpointSearchLabel = {moduleId: ''};
|
||||||
this.$refs.projectSearch.clearSearch();
|
this.$refs.projectSearch.clearSearch();
|
||||||
this.showSubList = false;
|
this.showSubList = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user