fix: bug修复、优化
1.endpoint、module param的null异常 2.model-panel-chart展示静态数据 3.chart纵坐标刻度异常,有多个“1” 4.asset-endpoint二级列表的operation列隐藏 5.panel接口不需要分页参数
This commit is contained in:
@@ -145,6 +145,7 @@ import draggable from 'vuedraggable'
|
||||
export default {
|
||||
name: 'chartList',
|
||||
props: {
|
||||
isModel: {type: Boolean, default: false}
|
||||
},
|
||||
components: {
|
||||
lineChartBlock,
|
||||
@@ -873,6 +874,9 @@ export default {
|
||||
if (response.data.result) {
|
||||
// 循环处理每个elements下获取的数据列
|
||||
if(chartItem.type==='singleStat'){
|
||||
if (this.isModel) {
|
||||
singleStatRlt = 999;
|
||||
} else {
|
||||
if(response.data.result.length===1){
|
||||
let statistics = chartItem.param.statistics;
|
||||
if(response.data.result[0].values){
|
||||
@@ -881,6 +885,7 @@ export default {
|
||||
}else if(response.data.result.length > 1){
|
||||
singleStatRlt = this.$t("dashboard.panel.singleStatErrorTip");
|
||||
}
|
||||
}
|
||||
}else {
|
||||
response.data.result.forEach((queryItem,resIndex) => {
|
||||
const seriesItem = {
|
||||
@@ -910,7 +915,21 @@ export default {
|
||||
}
|
||||
const tagsArr = Object.keys(queryItem.metric);//["__name__","asset","idc","instance","job","module","project"]
|
||||
// 设置时间-数据格式对
|
||||
const dpsArr = Object.entries(queryItem.values);//[ ["0",[1577959830.781,"0"]], ["1",[1577959845.781,"0"]] ]
|
||||
let tempArr = [];
|
||||
let dpsArr = [];
|
||||
if (this.isModel) {
|
||||
let timeStamp = Math.floor(new Date().getTime()/1000);
|
||||
for (let i = 0; i < 20; i++) {
|
||||
tempArr.push([timeStamp - (20-i)*15, Math.floor(Math.random()*10) + ""]);
|
||||
dpsArr.push([i+"", tempArr[i]]);
|
||||
}
|
||||
} else {
|
||||
tempArr = queryItem.values;
|
||||
dpsArr = Object.entries(queryItem.values);//[ ["0",[1577959830.781,"0"]], ["1",[1577959845.781,"0"]] ]
|
||||
dpsArr = dpsArr.map(item => {
|
||||
return [item[0], [item[1][0], Number(item[1][1])]]
|
||||
})
|
||||
}
|
||||
// 判断是否有数据, && tagsArr.length > 0
|
||||
if (dpsArr.length > 0 && this.$refs['editChart'+chartItem.id] && this.$refs['editChart'+chartItem.id].length>0) {
|
||||
tagsArr.forEach((tag, i) => {
|
||||
@@ -937,7 +956,7 @@ export default {
|
||||
seriesItem.metric_name = seriesItem.theData.name;
|
||||
// 将秒改为毫秒
|
||||
//alert('table=='+JSON.stringify(queryItem))
|
||||
seriesItem.theData.data = queryItem.values.map((dpsItem, dpsIndex) => {
|
||||
seriesItem.theData.data = tempArr.map((dpsItem, dpsIndex) => {
|
||||
/*曲线汇总暂不需要
|
||||
if (sumData.data[dpsIndex]) {
|
||||
const sumNum = sumData.data[dpsIndex][1] || 0;
|
||||
|
||||
@@ -255,14 +255,19 @@ function days(value,index,type=1){
|
||||
* unitIndex:不需要传递,用于递归获取units中的单位
|
||||
* */
|
||||
function asciiCompute(num,ascii,units,dot=2,unitIndex=0){
|
||||
num = parseFloat(num)
|
||||
console.info(parseFloat(0.6.toFixed(2)))
|
||||
let quotient=num / ascii;
|
||||
console.info("aa", parseFloat(0.6.toFixed(0)), parseFloat(0.6.toFixed(1)));
|
||||
console.info("quotient", quotient);
|
||||
if(unitIndex <= units.length-1){
|
||||
if(quotient <1 ){ //不足以进位
|
||||
let toFixed=parseFloat(num.toFixed(dot));
|
||||
console.info("toFixed", num, dot, toFixed);
|
||||
if(toFixed == 0){
|
||||
console.info("toFixed-r1", `${num} ${units[unitIndex]}`);
|
||||
return `${num} ${units[unitIndex]}`
|
||||
}else{
|
||||
console.info("toFixed-r2", `${num.toFixed(dot)} ${units[unitIndex]}`);
|
||||
return `${num.toFixed(dot)} ${units[unitIndex]}`;
|
||||
}
|
||||
}else if(quotient >= 1 && quotient <10){ //可以进位,但是又不足以更进一位
|
||||
|
||||
@@ -898,7 +898,8 @@
|
||||
let chartUnit=chartInfo.unit;
|
||||
chartUnit=chartUnit?chartUnit:2;
|
||||
let unit=chartDataFormat.getUnit(chartUnit);
|
||||
return unit.compute(value,index);
|
||||
//console.info(value, chartUnit, unit.compute(value,index))
|
||||
return unit.compute(value,index,2);
|
||||
},
|
||||
},
|
||||
//boundaryGap:[0,0.2]
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
if (this.from == 'endpoint' && this.targetTab == 'endpointQuery') {
|
||||
this.$refs.endpointQuery.tableReload();
|
||||
}
|
||||
if (this.from == 'model') {
|
||||
if (this.targetTab == 'panel') {
|
||||
setTimeout(() => {this.$refs.panelTab.$refs.dashboardScrollbar.update();}, 400);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,13 +55,7 @@
|
||||
<template v-else>-</template>
|
||||
</span>
|
||||
<template v-else-if="item.prop == 'type'">{{scope.row.module.type}}</template>
|
||||
<div v-else-if="item.prop == 'option'" class="content-right-options">
|
||||
<span :title="$t('overall.query')" @click="query(scope.row)" class="content-right-option" :id="'edp-query-'+scope.row.id"><i class="el-icon-search"></i></span>
|
||||
|
||||
<span :title="$t('overall.view')" @click="detail(scope.row)" class="content-right-option" :id="'edp-detail-'+scope.row.id"><i class="nz-icon nz-icon-view"></i></span>
|
||||
|
||||
<span :title="$t('overall.edit')" @click="toEdit(scope.row)" class="content-right-option" :id="'edp-edit-'+scope.row.id"><i class="nz-icon nz-icon-edit"></i></span>
|
||||
</div>
|
||||
<div v-else-if="item.prop == 'option'">-</div>
|
||||
<span v-else-if="item.prop == 'lastUpdate'">{{dateFormat(scope.row.lastUpdate)}}</span>
|
||||
<span v-else-if="item.prop == 'state'" >
|
||||
<el-popover placement="right" trigger="hover" :content="getStateContent(scope.row)" popper-class="small-pop">
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
<el-scrollbar class="el-scrollbar-large" style="height: 100%" ref="dashboardScrollbar">
|
||||
<div class="box-content">
|
||||
<chart-list @on-edit-chart="editData" @on-refresh-time="refreshTime" @on-remove-chart="removeData"
|
||||
ref="chartList"></chart-list>
|
||||
ref="chartList" :is-model="from == 'model'"></chart-list>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
@@ -320,7 +320,7 @@
|
||||
});
|
||||
},
|
||||
getTableData(linkId) {
|
||||
this.$get('panel', {pageNo: 1, pageSize: -1, type: this.from, link: linkId}).then(response => {
|
||||
this.$get('panel', {type: this.from, link: linkId}).then(response => {
|
||||
if (response.code === 200) {
|
||||
this.panelData = response.data.list;
|
||||
if (this.panelData.length > 0) {
|
||||
|
||||
@@ -476,8 +476,8 @@
|
||||
assetId: obj.id,
|
||||
asset: obj,
|
||||
host: obj.host,
|
||||
param: this.currentModuleCopy.param,
|
||||
paramObj: this.currentModuleCopy.paramObj,
|
||||
param: this.currentModuleCopy.param ? this.currentModuleCopy.param : "",
|
||||
paramObj: this.currentModuleCopy.paramObj ? this.currentModuleCopy.paramObj : {},
|
||||
port: this.currentModuleCopy.port,
|
||||
path: this.currentModuleCopy.path,
|
||||
moduleId: this.currentModuleCopy.id
|
||||
|
||||
@@ -468,7 +468,7 @@
|
||||
});
|
||||
},
|
||||
panelReloadOnlyPanel() { //仅刷新panel数据
|
||||
this.$get('panel?pageNo=1&pageSize=-1').then(response => {
|
||||
this.$get('panel').then(response => {
|
||||
if (response.code === 200) {
|
||||
this.panelData = response.data.list;
|
||||
for (let i = 0; i < this.panelData.length; i++) {
|
||||
@@ -481,7 +481,7 @@
|
||||
});
|
||||
},
|
||||
getTableData: function (clearShowPanel) {
|
||||
this.$get('panel?pageNo=1&pageSize=-1').then(response => {
|
||||
this.$get('panel').then(response => {
|
||||
if (response.code === 200) {
|
||||
this.panelData = response.data.list;
|
||||
let isInitData = false;
|
||||
|
||||
Reference in New Issue
Block a user