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 @@