fix: 修复asset-tag、chartbox、endpoint表头等bug

1.edit-asset时tag不能新增的bug
2.chartbox url类型回显错误的bug
3.endpoint表头编辑框不显示的bug
4.底部滑框退出全屏后主列表不显示的bug
5.左侧菜单project折叠bug
This commit is contained in:
chenjinsong
2020-08-05 20:58:24 +08:00
parent 0d83ebdf70
commit af70abd141
7 changed files with 29 additions and 59 deletions

View File

@@ -498,8 +498,8 @@
}
}
},
// 获取panel详情数据,获取panel下所有chart列表
// 获取panel详情数据,获取panel下所有chart列表
getData(params) {
const param = {
panelId: params.panelId,

View File

@@ -267,13 +267,13 @@ export const bottomBoxWindow = {
//副列表
document.querySelector(".sub-list").style.height = vm.bottomBox.mainListHeight ? contentRightHeight-vm.bottomBox.mainListHeight-9 + 'px' : 'calc(50% - 4px)';
setTimeout(() => {
vm.bottomBox.isFullScreen = false;
if (document.querySelector(".main-list-with-sub").offsetHeight >= 100) {
vm.mainResizeShow = true;
vm.bottomBox.mainResizeShow = true;
}
if (document.querySelector(".sub-list").offsetHeight >= 100) {
vm.bottomBox.subResizeShow = true;
}
vm.bottomBox.isFullScreen = false;
window.resizing = false;
}, 210);
},

View File

@@ -9,7 +9,7 @@
<div class="sidebar-info" style="height: 90%">
<el-scrollbar style="height: 100%;">
<template v-if="parentMenu == 'projects'">
<el-collapse v-model="currentProject.id + ''" class="left-menu-bg" accordion style="padding-top: 0;" ref="projectLeft">
<el-collapse class="left-menu-bg" accordion style="padding-top: 0;" ref="projectLeft">
<el-collapse-item v-for="(item, index) in projectList" :key="item.id" :name="item.id + ''">
<template slot="title">
<div class="sidebar-info-item-project sidebar-info-item" :class="{'sidebar-info-item-active': item.id == currentProject.id}" @click="detailProject(item)" :id="'project-module-'+item.id">

View File

@@ -375,6 +375,7 @@
});
},
addTag() {
!this.editAsset.tags && (this.$set(this.editAsset, "tags", []));
this.editAsset.tags.push({tag: "", value: ""});
this.$nextTick(() => {
this.$refs.tagEditBoxScrollbar.update();

View File

@@ -637,6 +637,9 @@
} else if (!n.id && n.type && n.type.toLowerCase() == 'http') {
n.port = 9100;
}
if (!n.type) {
n.type = 'http';
}
}
},
}

View File

@@ -311,7 +311,6 @@
//productId: 0,//不需要这个参数,可以删除
panelId: 0,
panelName: '',
panelName2: '',
selectFirstPanel: false,
metricList: [], // metric列表
metricCascaderList:[],//metric级联列表
@@ -333,8 +332,6 @@
'promql-input': promqlInput,
},
mounted() {
this.isUrl = false;
this.isSingleStat = false;
this.$nextTick(() => {
this.initElements();
});
@@ -451,7 +448,6 @@
if (response.code === 200) {
if(this.$refs.chartForm){
this.$refs.chartForm.resetFields();//清空表单
this.panelName2 = '';
}
this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")});
this.esc(true);
@@ -618,7 +614,6 @@
this.esc();
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
this.$refs.chartForm.resetFields();//清空表单
this.panelName2 = '';
this.$emit('on-create-success', 'update', response2.data, params);
} else {
if(response2.msg){
@@ -871,7 +866,7 @@
setIsUrl(){
this.isUrl = true;
this.isSingleStat = false;
this.isAlert=false;
this.isAlert = false;
},
setIsSingleStat(){
this.isUrl = false;
@@ -892,13 +887,11 @@
editData(data, panelId) {
if (!panelId) {
this.panelId = 0;
this.panelName2 = "";
} else {
this.panelId = panelId;
let temp = this.panelData.filter((item) => {
return item.id == panelId;
});
this.panelName2 = temp[0].name;
}
this.isedit = true;
this.editInfo = data;
@@ -1088,27 +1081,7 @@
legend: this.legends[index],
});
});
console.info(elements)
/*this.elementTarget.forEach((elem,index) => {
if(elem.type==='normal'){
const metricStr = bus.tagsToString(elem.metric,elem.selectedTagList);
elements.push({
//id:index+1,
//metric: elem.metric,//指标名称
expression: metricStr,//指标对应Label及Value组成的表达式字符串
type:elem.type,//指标类型
legend:elem.legend,//配置的legend
});
}else if(elem.type==='expert'){
elements.push({
//id:index+1,
//metric: elem.metric,//指标名称
expression: elem.expression,//指标对应Label及Value组成的表达式字符串
type:elem.type,//指标类型
legend:elem.legend,//配置的legend
});
}
});*/
//console.info(elements)
params.elements = elements;
if (valid) {
this.$refs.chartsPreview.show(params);
@@ -1133,18 +1106,9 @@
params.id = this.editChart.id;
}
this.$refs.chartsPreview.show(params);
/*
if (this.isedit) {
params.id = this.editChart.id;
this.updateCharts(params);
} else {
this.addCharts(params);
}
*/
}
});
}
//this.$refs.chartForm.validate();
},
//preview--end
initElements() {
@@ -1175,7 +1139,20 @@
immediate: true,
handler(n) {
this.editChart = JSON.parse(JSON.stringify(n));
if (n.type === 'url') {
this.setIsUrl();
} else if(n.type === 'alertList'){
this.setIsAlertList();
} else if(n.type === 'singleStat'){
this.setIsSingleStat();
this.resetElements();
} else {
this.setIsOtherChart();
}
this.$set(this.editChart, "panelName", this.showPanel.name);
if (this.showPanel.id) {
this.panelId = this.showPanel.id;
}
if (n.id) {
this.editData(this.editChart, this.showPanel.id);
} else {
@@ -1185,11 +1162,12 @@
},
editChart: {
deep: true,
immediate: true,
handler(n) {
let panel = this.panelData.find(p => {
return p.name == n.panelName;
});
this.panelId = panel.id;
panel && (this.panelId = panel.id);
}
}
/*panelData: {

View File

@@ -325,7 +325,7 @@
},
// 图表创建成功回调panel页面进行图表的刷新
createSuccess(msg, data, params, panel) {
this.filter.panelId = this.panel.id;
this.filter.panelId = this.showPanel.id;
this.getData(this.filter);
},
// 获取数据,用在子页面
@@ -375,8 +375,7 @@
}
});
},
getTableData: function (clearShowPanel) {
getTableData(clearShowPanel) {
this.$get('panel?type=dashboard').then(response => {
if (response.code === 200) {
this.panelData = response.data.list;
@@ -648,7 +647,7 @@
created() {
this.getTableData();
},
mounted: function () {
mounted() {
this.onScroll();
document.querySelector("#tableList").addEventListener("mouseenter", () => {
this.tableHover = true;
@@ -657,19 +656,8 @@
this.tableHover = false;
});
},
computed: {
refreshPanel() {
return this.$store.state.panelListReload;
},
},
watch: {
refreshPanel(n, o) {
if (n) {
this.getTableData();
this.$store.commit('panelListChange', false);
}
},
'filter.searchName':function(n,o){
'filter.searchName': function(n,o){
let temp=this;
setTimeout(function(){
temp.search();