From 9496d7f8ed37a05078d16a9beb8529c101c17c5c Mon Sep 17 00:00:00 2001 From: "@changcode" Date: Wed, 1 Dec 2021 15:40:07 +0800 Subject: [PATCH 1/8] =?UTF-8?q?style:=20endpoint=20=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/common/rightBox/batchAddEndpoint.vue | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/nezha-fronted/src/components/common/rightBox/batchAddEndpoint.vue b/nezha-fronted/src/components/common/rightBox/batchAddEndpoint.vue index 20bc1fc51..e08d07dc6 100644 --- a/nezha-fronted/src/components/common/rightBox/batchAddEndpoint.vue +++ b/nezha-fronted/src/components/common/rightBox/batchAddEndpoint.vue @@ -10,9 +10,9 @@ -
+
- + Date: Thu, 2 Dec 2021 11:14:27 +0800 Subject: [PATCH 2/8] =?UTF-8?q?feat=20=EF=BC=9A=20logs=20=E5=A4=8D?= =?UTF-8?q?=E7=94=A8=20=E4=BB=A5=E5=8F=8A=20=E6=B7=BB=E5=8A=A0=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=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 @@ diff --git a/nezha-fronted/src/components/common/rightBox/chart/systemConfigJson.js b/nezha-fronted/src/components/common/rightBox/chart/systemConfigJson.js index dadbbc8b6..b699b61d5 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/systemConfigJson.js +++ b/nezha-fronted/src/components/common/rightBox/chart/systemConfigJson.js @@ -1,47 +1,48 @@ const data = [{ name: 'asset', datasql: 'SELECT t.*,atc.vm,atc.vmh,atc.NAME as type,assc.NAME as state,ab.NAME as brand,am.NAME as model,dc.NAME as datacenterName,cabinet.NAME as cabinet,ap.`status` as ping FROM asset_asset t LEFT JOIN asset_type_conf atc ON t.type_id = atc.id LEFT JOIN asset_state_conf assc ON t.state_id = assc.id LEFT JOIN asset_brand ab ON t.brand_id = ab.id LEFT JOIN asset_model am ON t.model_id = am.id LEFT JOIN dc ON t.dc_id = dc.id LEFT JOIN cabinet ON t.cabinet_id = cabinet.id LEFT JOIN asset_ping ap ON t.id = ap.asset_id', - group: [{ - name: 'datacenter', - expr: 'datacenterName', - type: 2 - }, { - name: 'name', - expr: 'name', - type: 2 - }, { - name: 'vm', - expr: 'vm', - type: 2 - }, { - name: 'vmh', - expr: 'vmh', - type: 2 - }, { - name: 'type', - expr: 'type', - type: 2 - }, { - name: 'state', - expr: 'state', - type: 2 - }, { - name: 'brand', - expr: 'brand', - type: 2 - }, { - name: 'model', - expr: 'model', - type: 2 - }, { - name: 'cabinet', - expr: 'cabinet', - type: 2 - }, { - name: 'status', - expr: 'ping', - type: 2 - } + group: [ + { + name: 'datacenter', + expr: 'datacenterName', + type: 2 + }, { + name: 'name', + expr: 'name', + type: 2 + }, { + name: 'vm', + expr: 'vm', + type: 2 + }, { + name: 'vmh', + expr: 'vmh', + type: 2 + }, { + name: 'type', + expr: 'type', + type: 2 + }, { + name: 'state', + expr: 'state', + type: 2 + }, { + name: 'brand', + expr: 'brand', + type: 2 + }, { + name: 'model', + expr: 'model', + type: 2 + }, { + name: 'cabinet', + expr: 'cabinet', + type: 2 + }, { + name: 'status', + expr: 'ping', + type: 2 + } ], select: [{ name: 'count',