diff --git a/nezha-fronted/src/assets/stylus/main.scss b/nezha-fronted/src/assets/stylus/main.scss
index 95cc402c4..6d8c4e2b1 100644
--- a/nezha-fronted/src/assets/stylus/main.scss
+++ b/nezha-fronted/src/assets/stylus/main.scss
@@ -1157,7 +1157,7 @@ li{
padding: 0 20px 20px 20px;
border-radius: 10px;
}
-.nz-pop-select-area {
+.nz-pop-select-area, .nz-pop-select-panel {
padding: 0 !important;
box-shadow: 0 2px 12px 0 rgba(0,0,0,.1) !important;
}
diff --git a/nezha-fronted/src/components/common/popBox/selectPanel.vue b/nezha-fronted/src/components/common/popBox/selectPanel.vue
new file mode 100644
index 000000000..b4973ef00
--- /dev/null
+++ b/nezha-fronted/src/components/common/popBox/selectPanel.vue
@@ -0,0 +1,183 @@
+
+
+
+
+
+
+
+
+
+
+ {{ node.label }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/nezha-fronted/src/components/page/dashboard/chartBox.vue b/nezha-fronted/src/components/page/dashboard/chartBox.vue
index b28ae0c21..e1f269638 100644
--- a/nezha-fronted/src/components/page/dashboard/chartBox.vue
+++ b/nezha-fronted/src/components/page/dashboard/chartBox.vue
@@ -168,7 +168,7 @@
-
-
+ -->
+
+
+
+
+
+
+
+
@@ -495,6 +506,8 @@
import promqlInput from "./explore/promqlInput";
import {nzNumber} from "../../common/js/validate";
import richTextEditor from "../../charts/richTextEditor";
+ import selectPanel from "../../common/popBox/selectPanel";
+
var rz = {
methods: {
rz(e) {
@@ -518,7 +531,7 @@
save:false,
},
editChart: {},
-
+ filterPanel: "",
statisticsList: this.$CONSTANTS.statisticsList,
promqlCount: 1,
@@ -625,7 +638,8 @@
'chart-preview':chartPreview,
'alert-chart-param':alertChartParam,
'promql-input': promqlInput,
- 'rich-text-editor':richTextEditor
+ 'rich-text-editor':richTextEditor,
+ selectPanel,
},
mounted() {
this.$nextTick(() => {
@@ -641,6 +655,10 @@
clickOutside() {
this.esc(false);
},
+ selectPanel(panel) {
+ this.panelName = panel.name;
+ this.panelId = panel.id;
+ },
toAddPanel() {
this.$refs.panelBox2.show(true);
this.panel = {
@@ -829,10 +847,8 @@
},
// 新建图表
addCharts(params) {
- let panelId;
- let panel;
//先处理panel
- let panelPromise=new Promise(resolve => {
+ /*let panelPromise=new Promise(resolve => {
if (this.panelId) {
panelId = this.panelId;
panel=this.panelData.find(p => p.id === this.panelId);
@@ -861,17 +877,16 @@
});
}
}
- });
+ });*/
- panelPromise.then(()=>{
- if (panelId) {
- this.panelId = panelId;
+ //panelPromise.then(()=>{
+ if (this.panelId) {
this.$post('panel/' + this.panelId + '/charts', params ? params : this.editChart).then(response => {
if (response.code === 200) {
this.esc();
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
this.$refs.chartForm.resetFields();//清空表单
- this.$emit('on-create-success', 'create', response.data, params, panel);
+ this.$emit('on-create-success', 'create', response.data, params, {id: this.panelId, name: this.panelName});
} else {
if (response.msg) {
this.$message.error(response.msg);
@@ -882,7 +897,7 @@
this.prevent_opt.save=false
});
}
- })
+ //})
},
// 更新图表
updateCharts(params) {
@@ -1684,21 +1699,6 @@
}
}
},
- editChart: {
- deep: true,
- immediate: true,
- handler(n) {
- let panel = this.panelData.find(p => {
- return p.name == n.panelName;
- });
-
- if(panel){
- this.panelId = panel.id;
- }else{
- this.panelId = null;
- }
- }
- }
},
beforeDestroy() {
if(this.$refs.chartTag){
diff --git a/nezha-fronted/src/components/page/dashboard/panel.vue b/nezha-fronted/src/components/page/dashboard/panel.vue
index 854948247..8787adc15 100644
--- a/nezha-fronted/src/components/page/dashboard/panel.vue
+++ b/nezha-fronted/src/components/page/dashboard/panel.vue
@@ -6,13 +6,27 @@
-
+
+
+
+
+
+
+
+
+
+
+
+ <!–{{$t('dashboard.panel.createPanelTitleSec')}}–>
@@ -47,7 +61,7 @@
-
+ -->
@@ -108,6 +122,8 @@
import draggable from 'vuedraggable'
import pickTime from "../../common/pickTime";
import exportXLSX from "../../common/exportXLSX";
+ import selectPanel from "../../common/popBox/selectPanel";
+
export default {
name: "panel",
data() {
@@ -192,6 +208,7 @@
draggable,
'pick-time':pickTime,
'export-excel':exportXLSX,
+ selectPanel,
},
methods: {
//刷新
@@ -217,8 +234,8 @@
//this.$refs.chartList.initCurrentRecordNum();
this.$refs.chartList.cleanData();
this.getData(this.filter);
-
},
+
del(u) {
this.$confirm(this.$t("tip.confirmDelete"), {
confirmButtonText: this.$t("tip.yes"),
@@ -696,7 +713,7 @@
panelContent.style.background = '#d8dce1';
},
- filterPanelFocus:function(e){
+ /*filterPanelFocus:function(e){
e.stopPropagation();
},
filterPanelFunc:function(){
@@ -706,7 +723,7 @@
}else{
this.showPanelList = this.panelData;
}
- },
+ },*/
tableListEnter(){
this.tableHover = true;
},
@@ -751,8 +768,7 @@
}
.panel-list-width {
- width:240px;
- overflow: hidden;
+ width: 400px;
}
.panel-dropdown-title {
@@ -857,10 +873,6 @@
}
/* end--Panel-自定义可编辑的el-select下拉框样式*/
- .panel-select-width {
- width: 150px;
- }
-
.panel-refresh-interval {
margin-right: 5px;
float: right;
@@ -949,6 +961,31 @@
}