From 64023fdbb016595390f9006214de1e46a61c65e0 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Thu, 2 Dec 2021 11:14:27 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=EF=BC=9A=20logs=20=E5=A4=8D=E7=94=A8=20?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=20=E6=B7=BB=E5=8A=A0=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rightBox/chartRightBox/chartRightBox.scss | 7 + .../common/rightBox/chart/chartRightBox.vue | 78 +-- .../common/rightBox/chart/chartTypeShow.js | 95 ++++ .../common/rightBox/chart/logsChartConfig.vue | 493 +++++++++++++++++- .../rightBox/chart/metricsChartConfig.vue | 166 +++--- .../common/rightBox/chart/publicConfig.js | 29 +- 6 files changed, 743 insertions(+), 125 deletions(-) create mode 100644 nezha-fronted/src/components/common/rightBox/chart/chartTypeShow.js diff --git a/nezha-fronted/src/assets/css/components/common/rightBox/chartRightBox/chartRightBox.scss b/nezha-fronted/src/assets/css/components/common/rightBox/chartRightBox/chartRightBox.scss index 7f2318218..d10c6b6c1 100644 --- a/nezha-fronted/src/assets/css/components/common/rightBox/chartRightBox/chartRightBox.scss +++ b/nezha-fronted/src/assets/css/components/common/rightBox/chartRightBox/chartRightBox.scss @@ -90,5 +90,12 @@ border-bottom: none; margin-bottom: 10px; } + .vue-tags-input{ + display: inline-block; + width: 100%; + .ti-input{ + padding: 1px 3px; + } + } } } diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue index 50ae6d165..2103fcdea 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue @@ -15,7 +15,7 @@
- + @@ -59,16 +59,16 @@
- + - + - + - + @@ -84,7 +84,7 @@ - @@ -156,6 +156,8 @@ export default { groupArr: [], panelName: '', rules: { + name: [{ required: true, message: this.$t('validate.required'), trigger: 'change' }], + panelName: [{ required: true, message: this.$t('validate.required'), trigger: 'change' }] } } }, @@ -171,36 +173,42 @@ export default { }, // 保存endpoint save () { - if (this.prevent_opt.save) { return } ; - this.prevent_opt.save = true - // 对endpointList进行处理,避免携带过多无用数据 - const endpointList = [] - this.endpointTableData.forEach((item, index) => { - const endpoint = { - moduleId: item.moduleId, - assetId: item.assetId, - name: item.name, - configs: JSON.stringify(item.configs), - id: item.id - } - endpointList.push(endpoint) - }) - this.$refs.addEndpoint.validate((valid) => { - if (valid) { - this.$put('monitor/endpoint', endpointList).then(response => { - this.prevent_opt.save = false - if (response.code === 200) { - this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) - this.esc(true) - } else { - this.$message.error(response.msg) - } - }) - } else { - this.prevent_opt.save = false - return false - } + console.log(123132213) + const arr = [this.$refs.chartForm.validate()] + arr.push(this.$refs['childrenFrom' + this.editChart.datasource].$refs.chartForm.validate()) + Promise.all(arr).then(res => { + console.log(res) + }).catch(res => { + console.log(res) }) + + // this.$refs.chartForm.validate((valid) => { + // if (valid) { + // if (this.editChart.id) { // 修改 + // this.editChart.param.collapse = this.chartSwitch + // this.$put('visual/panel/chart', this.editChart).then(response => { + // if (response.code === 200) { + // this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) + // this.esc(true) + // } else { + // this.$message.error(response.msg) + // } + // }) + // } else { // 新增 + // this.$post('visual/panel/chart', this.editChart).then(response => { + // if (response.code === 200) { + // this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) + // this.esc(true) + // } else { + // this.$message.error(response.msg) + // } + // }) + // } + // } else { + // console.error('error submit!!') + // return false + // } + // }) }, selectPanel (panel) { this.panelName = panel.name diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartTypeShow.js b/nezha-fronted/src/components/common/rightBox/chart/chartTypeShow.js new file mode 100644 index 000000000..3086ee0ac --- /dev/null +++ b/nezha-fronted/src/components/common/rightBox/chart/chartTypeShow.js @@ -0,0 +1,95 @@ +export default { + methods: { + isStackShow (type) { + switch (type) { + case 'line': + case 'stackArea': + case 'point': + return true + case 'table': + case 'singleStat': + case 'bar': + case 'treemap': + case 'pie': + return false + default: return false + } + }, + isStatisticsShow (type) { + switch (type) { + case 'line': + case 'stackArea': + case 'point': + return false + case 'table': + case 'singleStat': + case 'bar': + case 'treemap': + case 'pie': + return true + default: return false + } + }, + isShowLegend (type) { + switch (type) { + case 'line': + case 'stackArea': + case 'point': + return true + case 'table': + case 'singleStat': + case 'bar': + case 'treemap': + case 'pie': + return false + default: return false + } + }, + isShowValueMapping (type) { + switch (type) { + case 'line': + case 'stackArea': + case 'point': + case 'table': + return false + case 'singleStat': + case 'bar': + case 'treemap': + case 'pie': + return true + default: return false + } + }, + isTable (type) { + switch (type) { + case 'table': + return true + case 'line': + case 'stackArea': + case 'point': + case 'singleStat': + case 'bar': + case 'treemap': + case 'pie': + return false + default: return false + } + }, + isLog (type) { + switch (type) { + case 'log': + return true + case 'table': + case 'line': + case 'stackArea': + case 'point': + case 'singleStat': + case 'bar': + case 'treemap': + case 'pie': + return false + default: return false + } + } + } +} diff --git a/nezha-fronted/src/components/common/rightBox/chart/logsChartConfig.vue b/nezha-fronted/src/components/common/rightBox/chart/logsChartConfig.vue index b53662a50..30e0f2d6f 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/logsChartConfig.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/logsChartConfig.vue @@ -1,12 +1,499 @@ diff --git a/nezha-fronted/src/components/common/rightBox/chart/metricsChartConfig.vue b/nezha-fronted/src/components/common/rightBox/chart/metricsChartConfig.vue index 561454c67..f8cd59f5f 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/metricsChartConfig.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/metricsChartConfig.vue @@ -1,9 +1,11 @@