fix:explore save chart 失效修复

This commit is contained in:
wangwenrui
2020-05-25 17:15:14 +08:00
parent a838649591
commit 468237e91f
2 changed files with 21 additions and 11 deletions

View File

@@ -360,6 +360,11 @@
'chart-metric':ChartMetric, 'chart-metric':ChartMetric,
'chart-preview':chartPreview, 'chart-preview':chartPreview,
}, },
mounted() {
this.$nextTick(()=>{
console.log(!this.isUrl && !this.isSingleStat)
})
},
methods: { methods: {
show(show) { show(show) {
if(this.showPanel){ if(this.showPanel){
@@ -574,7 +579,7 @@
addCharts(params) { addCharts(params) {
let panelId; let panelId;
//先处理panel //先处理panel
if (this.showPanel.type) { if (this.showPanel&&this.showPanel.type) {
panelId = this.panelData[0].id; panelId = this.panelData[0].id;
} else { } else {
panelId = this.autocompleteExist(this.panelName2); panelId = this.autocompleteExist(this.panelName2);
@@ -813,7 +818,9 @@
}); });
} else { } else {
console.log(this.$refs)
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.chartTag[0].setMdata(elementInfo.elements[0]); this.$refs.chartTag[0].setMdata(elementInfo.elements[0]);
}); });
} }
@@ -1023,6 +1030,7 @@
deep: true, deep: true,
immediate: true, immediate: true,
handler(n, o) { handler(n, o) {
if(this.showPanel){
if (!this.showPanel.type) { if (!this.showPanel.type) {
if (this.selectFirstPanel) { if (this.selectFirstPanel) {
this.selectFirstPanel = false; this.selectFirstPanel = false;
@@ -1037,6 +1045,7 @@
} }
} }
} }
}
}, },
beforeDestroy() { beforeDestroy() {
if(this.$refs.chartTag){ if(this.$refs.chartTag){

View File

@@ -191,7 +191,7 @@ instance_cpu_time_ns{app="fox", proc="widget", rev="4d3a513", env="prod", job="c
</div> </div>
</div> </div>
<chart-box ref="addChartModal" :panel-data="panelData" @on-create-success="createSuccess"></chart-box> <chart-box ref="addChartModal" :panel-data="panelData" @on-create-success="createSuccess" :show-panel="{}"></chart-box>
<element-set <element-set
:allowed-all="true" :allowed-all="true"
v-clickoutside="elementsetHide" v-clickoutside="elementsetHide"
@@ -316,7 +316,8 @@ instance_cpu_time_ns{app="fox", proc="widget", rev="4d3a513", env="prod", job="c
}) })
if(result.metric&&Object.keys(result.metric).length>0){ if(result.metric&&Object.keys(result.metric).length>0){
let metric = Object.assign({}, result.metric); let metric = Object.assign({}, result.metric);
seriesItem.name += metric.__name__?metric.__name__:''+ '{'; seriesItem.name += metric.__name__?metric.__name__:'';
seriesItem.name +='{'
delete metric.__name__; delete metric.__name__;
for (let key in metric) { for (let key in metric) {
seriesItem.name += key + "=" + '"' + metric[key] + '",'; seriesItem.name += key + "=" + '"' + metric[key] + '",';