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) { getData(params) {
const param = { const param = {
panelId: params.panelId, 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)'; document.querySelector(".sub-list").style.height = vm.bottomBox.mainListHeight ? contentRightHeight-vm.bottomBox.mainListHeight-9 + 'px' : 'calc(50% - 4px)';
setTimeout(() => { setTimeout(() => {
vm.bottomBox.isFullScreen = false;
if (document.querySelector(".main-list-with-sub").offsetHeight >= 100) { if (document.querySelector(".main-list-with-sub").offsetHeight >= 100) {
vm.mainResizeShow = true; vm.bottomBox.mainResizeShow = true;
} }
if (document.querySelector(".sub-list").offsetHeight >= 100) { if (document.querySelector(".sub-list").offsetHeight >= 100) {
vm.bottomBox.subResizeShow = true; vm.bottomBox.subResizeShow = true;
} }
vm.bottomBox.isFullScreen = false;
window.resizing = false; window.resizing = false;
}, 210); }, 210);
}, },

View File

@@ -9,7 +9,7 @@
<div class="sidebar-info" style="height: 90%"> <div class="sidebar-info" style="height: 90%">
<el-scrollbar style="height: 100%;"> <el-scrollbar style="height: 100%;">
<template v-if="parentMenu == 'projects'"> <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 + ''"> <el-collapse-item v-for="(item, index) in projectList" :key="item.id" :name="item.id + ''">
<template slot="title"> <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"> <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() { addTag() {
!this.editAsset.tags && (this.$set(this.editAsset, "tags", []));
this.editAsset.tags.push({tag: "", value: ""}); this.editAsset.tags.push({tag: "", value: ""});
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.tagEditBoxScrollbar.update(); this.$refs.tagEditBoxScrollbar.update();

View File

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

View File

@@ -311,7 +311,6 @@
//productId: 0,//不需要这个参数,可以删除 //productId: 0,//不需要这个参数,可以删除
panelId: 0, panelId: 0,
panelName: '', panelName: '',
panelName2: '',
selectFirstPanel: false, selectFirstPanel: false,
metricList: [], // metric列表 metricList: [], // metric列表
metricCascaderList:[],//metric级联列表 metricCascaderList:[],//metric级联列表
@@ -333,8 +332,6 @@
'promql-input': promqlInput, 'promql-input': promqlInput,
}, },
mounted() { mounted() {
this.isUrl = false;
this.isSingleStat = false;
this.$nextTick(() => { this.$nextTick(() => {
this.initElements(); this.initElements();
}); });
@@ -451,7 +448,6 @@
if (response.code === 200) { if (response.code === 200) {
if(this.$refs.chartForm){ if(this.$refs.chartForm){
this.$refs.chartForm.resetFields();//清空表单 this.$refs.chartForm.resetFields();//清空表单
this.panelName2 = '';
} }
this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")}); this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")});
this.esc(true); this.esc(true);
@@ -618,7 +614,6 @@
this.esc(); this.esc();
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")}); this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
this.$refs.chartForm.resetFields();//清空表单 this.$refs.chartForm.resetFields();//清空表单
this.panelName2 = '';
this.$emit('on-create-success', 'update', response2.data, params); this.$emit('on-create-success', 'update', response2.data, params);
} else { } else {
if(response2.msg){ if(response2.msg){
@@ -871,7 +866,7 @@
setIsUrl(){ setIsUrl(){
this.isUrl = true; this.isUrl = true;
this.isSingleStat = false; this.isSingleStat = false;
this.isAlert=false; this.isAlert = false;
}, },
setIsSingleStat(){ setIsSingleStat(){
this.isUrl = false; this.isUrl = false;
@@ -892,13 +887,11 @@
editData(data, panelId) { editData(data, panelId) {
if (!panelId) { if (!panelId) {
this.panelId = 0; this.panelId = 0;
this.panelName2 = "";
} else { } else {
this.panelId = panelId; this.panelId = panelId;
let temp = this.panelData.filter((item) => { let temp = this.panelData.filter((item) => {
return item.id == panelId; return item.id == panelId;
}); });
this.panelName2 = temp[0].name;
} }
this.isedit = true; this.isedit = true;
this.editInfo = data; this.editInfo = data;
@@ -1088,27 +1081,7 @@
legend: this.legends[index], legend: this.legends[index],
}); });
}); });
console.info(elements) //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
});
}
});*/
params.elements = elements; params.elements = elements;
if (valid) { if (valid) {
this.$refs.chartsPreview.show(params); this.$refs.chartsPreview.show(params);
@@ -1133,18 +1106,9 @@
params.id = this.editChart.id; params.id = this.editChart.id;
} }
this.$refs.chartsPreview.show(params); 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 //preview--end
initElements() { initElements() {
@@ -1175,7 +1139,20 @@
immediate: true, immediate: true,
handler(n) { handler(n) {
this.editChart = JSON.parse(JSON.stringify(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); this.$set(this.editChart, "panelName", this.showPanel.name);
if (this.showPanel.id) {
this.panelId = this.showPanel.id;
}
if (n.id) { if (n.id) {
this.editData(this.editChart, this.showPanel.id); this.editData(this.editChart, this.showPanel.id);
} else { } else {
@@ -1185,11 +1162,12 @@
}, },
editChart: { editChart: {
deep: true, deep: true,
immediate: true,
handler(n) { handler(n) {
let panel = this.panelData.find(p => { let panel = this.panelData.find(p => {
return p.name == n.panelName; return p.name == n.panelName;
}); });
this.panelId = panel.id; panel && (this.panelId = panel.id);
} }
} }
/*panelData: { /*panelData: {

View File

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