diff --git a/nezha-fronted/src/components/common/alert/alertLabel.vue b/nezha-fronted/src/components/common/alert/alertLabel.vue index b6e84e018..346e1b008 100644 --- a/nezha-fronted/src/components/common/alert/alertLabel.vue +++ b/nezha-fronted/src/components/common/alert/alertLabel.vue @@ -42,7 +42,7 @@
PingLastReply
-
{{alertLabelData && alertLabelData.pingInfo && alertLabelData.pingInfo.lastUpdate ? alertLabelData.pingInfo.lastUpdate : '--'}}
+
{{alertLabelData && alertLabelData.pingInfo && alertLabelData.pingInfo.lastUpdate ? utcTimeToTimezoneStr(alertLabelData.pingInfo.lastUpdate) : '--'}}
Alert
diff --git a/nezha-fronted/src/components/common/alert/alertLabel2.vue b/nezha-fronted/src/components/common/alert/alertLabel2.vue index df3f7410e..25da47129 100644 --- a/nezha-fronted/src/components/common/alert/alertLabel2.vue +++ b/nezha-fronted/src/components/common/alert/alertLabel2.vue @@ -42,7 +42,7 @@
PingLastReply
-
{{alertLabelData && alertLabelData.pingInfo && alertLabelData.pingInfo.lastUpdate ? alertLabelData.pingInfo.lastUpdate : '--'}}
+
{{alertLabelData && alertLabelData.pingInfo && alertLabelData.pingInfo.lastUpdate ? utcTimeToTimezoneStr(alertLabelData.pingInfo.lastUpdate) : '--'}}
Alert
diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue b/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue index ec2d29a91..df35d4c00 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue @@ -51,10 +51,15 @@ >
-
+ + + @@ -87,7 +88,16 @@ export default { } }, methods: { - + chartBySync (row) { + this.$post('visual/panel/chart/syncTmpl', { pid: row.id }).then(res => { + if (res.code === 200) { + this.getTableData() + this.$message.success(this.$t('tip.syncSuccess')) + } else { + this.$message.error(res.msg) + } + }) + }, }, created() { diff --git a/nezha-fronted/src/components/page/config/template/chartTemp.vue b/nezha-fronted/src/components/page/config/template/chartTemp.vue index 7495fef5c..d52f06d1e 100644 --- a/nezha-fronted/src/components/page/config/template/chartTemp.vue +++ b/nezha-fronted/src/components/page/config/template/chartTemp.vue @@ -52,6 +52,7 @@ @copy="(row) => {copyRow(row, 'exprTmpl')}" @orderBy="tableDataSort" @reload="getTableData" + @sync="chartBySync" @selectionChange="selectionChange" @showBottomBox="(targetTab, object) => { $refs.dataList.showBottomBox(targetTab, object) }"> @@ -162,6 +163,16 @@ export default { this.object.panelName = this.showPanel.name this.rightBox.show = true }, + chartBySync (row) { + this.$post('visual/panel/chart/syncTmpl', { pid: row.id }).then(res => { + if (res.code === 200) { + this.getTableData() + this.$message.success(this.$t('tip.syncSuccess')) + } else { + this.$message.error(res.msg) + } + }) + }, getTableData (params) { if (params && Object.keys(params).length > 0) { for (const key in params) { diff --git a/nezha-fronted/src/components/page/dashboard/overview/overview.vue b/nezha-fronted/src/components/page/dashboard/overview/overview.vue index 2ebeac187..2275226f7 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/overview.vue +++ b/nezha-fronted/src/components/page/dashboard/overview/overview.vue @@ -432,7 +432,7 @@ export default { return new Promise(resolve => { this.assetLoading = true this.$refs.assetHexagon.startLoading() - this.$get('asset/asset', { pageSize: -1}).then(response => { + this.$get('stat/alertMessage/topN', { size: 48, dimension: 'asset' }).then(response => { this.assetLoading = false this.$refs.assetHexagon.endLoading() if (response.code === 200) { @@ -634,7 +634,7 @@ export default { endpointOption.series[0].label.formatter = data.asset.total + '' endpointOption.series[0].data = [ { name: vm.$t('dashboard.overview.asset.ok'), value: data.asset.ok ? data.asset.ok : 0 }, - { name: vm.$t('dashboard.overview.asset.alarm'), value: data.asset.alarm ? data.asset.alarm : 0 }, + { name: vm.$t('dashboard.overview.asset.alarm'), value: data.asset.alarm ? data.asset.alarm : 0 } // { name: vm.$t('dashboard.overview.asset.total'), value: data.asset.total ? data.asset.total : 0 } ] endpointOption.title.text = vm.$t('asset.asset') @@ -938,12 +938,12 @@ export default { queryAlertStatByModule () { return new Promise(resolve => { this.$refs.moduleHexagon.startLoading() - this.$get('monitor/module', { pageSize: -1 }).then(response => { + this.$get('stat/alertMessage/topN', { size: 48, dimension: 'module' }).then(response => { this.$refs.moduleHexagon.endLoading() if (response.code === 200) { const moduleData = response.data.list moduleData.sort((a, b) => b.alertNum - a.alertNum) - const alertTopModules = moduleData.slice(0,48) + const alertTopModules = moduleData.slice(0, 48) const requests = alertTopModules.map(a => axios.get(`stat/alertMessage/severity?moduleId=${a.id}`)) const moduleStateData = [] axios.all(requests).then(result => { diff --git a/nezha-fronted/src/components/page/dashboard/panel.vue b/nezha-fronted/src/components/page/dashboard/panel.vue index e8116dde1..1a36f8a67 100644 --- a/nezha-fronted/src/components/page/dashboard/panel.vue +++ b/nezha-fronted/src/components/page/dashboard/panel.vue @@ -59,6 +59,9 @@
{{ $t('overall.AddByTemplate') }}
+ +
{{ $t('overall.syncChart') }}
+
@@ -296,6 +299,16 @@ export default { this.chart.panelId = this.showPanel.id this.rightBox.chartTemp.show = true }, + chartBySync () { + this.$post('visual/panel/chart/syncTmpl', { panelId: this.showPanel.id }).then(res => { + if (res.code === 200) { + this.getData(this.filter) + this.$message.success(this.$t('tip.syncSuccess')) + } else { + this.$message.error(res.msg) + } + }) + }, addGroupItem (groupId) { this.chart = this.newChart() this.chart.groupId = groupId diff --git a/nezha-fronted/src/components/page/monitor/module/moduleList.vue b/nezha-fronted/src/components/page/monitor/module/moduleList.vue index 441a3a3c3..a22e7d305 100644 --- a/nezha-fronted/src/components/page/monitor/module/moduleList.vue +++ b/nezha-fronted/src/components/page/monitor/module/moduleList.vue @@ -44,6 +44,7 @@ @edit="edit" @orderBy="tableDataSort" @reload="getTableData" + @sync="chartBySync" @selectionChange="selectionChange" @showBottomBox="(targetTab, object) => { $refs.dataList.showBottomBox(targetTab, object) }"> @@ -89,6 +90,7 @@ export default { endpointNameTmpl: '{{module.name}}-{{asset.name}}', type: 'http', port: 9100, + chartIds: [], configs: { walk: [], snmpCredentialsId: '', @@ -163,6 +165,9 @@ export default { } else { this.object.paramObj.push({ key: '', value: [] }) } + if (!this.object.chartIds) { + this.object.chartIds = [] + } this.rightBox.show = true }, getTableData () { @@ -190,7 +195,17 @@ export default { } } }) - } + }, + chartBySync (row) { + this.$post('visual/panel/chart/syncTmpl', { modules: row.id }).then(res => { + if (res.code === 200) { + this.getTableData() + this.$message.success(this.$t('tip.syncSuccess')) + } else { + this.$message.error(res.msg) + } + }) + }, }, computed: { },