diff --git a/nezha-fronted/src/components/charts/chart-alert-list.vue b/nezha-fronted/src/components/charts/chart-alert-list.vue index c4be6791a..ee014f733 100644 --- a/nezha-fronted/src/components/charts/chart-alert-list.vue +++ b/nezha-fronted/src/components/charts/chart-alert-list.vue @@ -46,6 +46,8 @@ {{$t('dashboard.delete')}}
  • {{$t('dashboard.duplicate')}}
  • +
  • + {{$t('overall.syncChart')}}
  • diff --git a/nezha-fronted/src/components/charts/chart-bar-statistics.vue b/nezha-fronted/src/components/charts/chart-bar-statistics.vue index 3b6967f60..8cd29d47a 100644 --- a/nezha-fronted/src/components/charts/chart-bar-statistics.vue +++ b/nezha-fronted/src/components/charts/chart-bar-statistics.vue @@ -46,6 +46,8 @@ {{$t('dashboard.delete')}}
  • {{$t('dashboard.duplicate')}}
  • +
  • + {{$t('overall.syncChart')}}
  • diff --git a/nezha-fronted/src/components/charts/chart-group.vue b/nezha-fronted/src/components/charts/chart-group.vue index 159e426cc..0ac85fee1 100644 --- a/nezha-fronted/src/components/charts/chart-group.vue +++ b/nezha-fronted/src/components/charts/chart-group.vue @@ -44,6 +44,8 @@ {{$t('dashboard.edit')}}
  • {{$t('dashboard.delete')}}
  • +
  • + {{$t('overall.syncChart')}}
  • diff --git a/nezha-fronted/src/components/charts/chart-list-group.vue b/nezha-fronted/src/components/charts/chart-list-group.vue index 8899eb593..389088c32 100644 --- a/nezha-fronted/src/components/charts/chart-list-group.vue +++ b/nezha-fronted/src/components/charts/chart-list-group.vue @@ -72,6 +72,7 @@ @on-duplicate-chart-block="duplicateChart" @on-drag-chart="editChartForDrag" @on-edit-chart-block="editData" + @sync="()=>{chartBySync(item)}" :panel-id="filter.panelId" :is-lock="panelLock" :chart-index="item.chartIndex" @@ -86,6 +87,7 @@ @on-duplicate-chart-block="duplicateChart" @on-drag-chart="editChartForDrag" @on-edit-chart-block="editData" + @sync="()=>{chartBySync(item)}" :chart-data="item" :is-lock="panelLock" :panel-id="filter.panelId" @@ -99,6 +101,7 @@ @on-duplicate-chart-block="duplicateChart" @on-drag-chart="editChartForDrag" @on-edit-chart-block="editData" + @sync="()=>{chartBySync(item)}" :is-lock="panelLock" :panel-id="filter.panelId" :chart-data="item" @@ -113,6 +116,7 @@ @on-drag-chart="editChartForDrag" :is-lock="panelLock" @on-edit-chart-block="editData" + @sync="()=>{chartBySync(item)}" :panel-id="filter.panelId" :chart-data="item" @dropmenu-change="(show) => {dropmenuChange(item.id, show)}" @@ -134,6 +138,7 @@ @on-duplicate-chart-block="duplicateChart" @on-drag-chart="editChartForDrag" @on-edit-chart-block="editData" + @sync="()=>{chartBySync(item)}" @dropmenu-change="(show) => {dropmenuChange(item.id, show)}" :is-lock="panelLock" :panel-id="filter.panelId" @@ -155,6 +160,7 @@ @on-duplicate-chart-block="duplicateChart" @on-drag-chart="editChartForDrag" @on-edit-chart-block="editData" + @sync="()=>{chartBySync(item)}" @dropmenu-change="(show) => {dropmenuChange(item.id, show)}" > { + if (res.code === 200) { + this.getData(this.filter) + this.$message.success(this.$t('tip.syncSuccess')) + } else { + this.$message.error(res.msg) + } + }) } }, created () { diff --git a/nezha-fronted/src/components/charts/chart-list.vue b/nezha-fronted/src/components/charts/chart-list.vue index 438d1c177..f358bf053 100644 --- a/nezha-fronted/src/components/charts/chart-list.vue +++ b/nezha-fronted/src/components/charts/chart-list.vue @@ -71,6 +71,7 @@ @on-duplicate-chart-block="duplicateChart" @on-drag-chart="editChartForDrag" @on-edit-chart-block="editData" + @sync="()=>{chartBySync(item)}" :panel-id="filter.panelId" :is-lock="panelLock" :chart-index="index" @@ -84,6 +85,7 @@ @on-duplicate-chart-block="duplicateChart" @on-drag-chart="editChartForDrag" @on-edit-chart-block="editData" + @sync="()=>{chartBySync(item)}" :chart-data="item" :is-lock="panelLock" :panel-id="filter.panelId" @@ -97,6 +99,7 @@ @on-duplicate-chart-block="duplicateChart" @on-drag-chart="editChartForDrag" @on-edit-chart-block="editData" + @sync="()=>{chartBySync(item)}" :is-lock="panelLock" :panel-id="filter.panelId" :chart-data="item" @@ -111,6 +114,7 @@ @on-drag-chart="editChartForDrag" :is-lock="panelLock" @on-edit-chart-block="editData" + @sync="()=>{chartBySync(item)}" :panel-id="filter.panelId" :chart-data="item" @dropmenu-change="(show) => {dropmenuChange(item.id, show)}" @@ -120,6 +124,7 @@ :from="from" :panel-id="filter.panelId" :chart-index="index" @on-refresh-data="refreshChart" + @sync="()=>{chartBySync(item)}" :is-lock="panelLock" :chart-data="item" @dropmenu-change="(show) => {dropmenuChange(item.id, show)}" @@ -132,6 +137,7 @@ @on-duplicate-chart-block="duplicateChart" @on-drag-chart="editChartForDrag" @on-edit-chart-block="editData" + @sync="()=>{chartBySync(item)}" @dropmenu-change="(show) => {dropmenuChange(item.id, show)}" :is-lock="panelLock" :panel-id="filter.panelId" @@ -152,6 +158,7 @@ @on-duplicate-chart-block="duplicateChart" @on-drag-chart="editChartForDrag" @on-edit-chart-block="editData" + @sync="()=>{chartBySync(item)}" @dropmenu-change="(show) => {dropmenuChange(item.id, show)}" :chartData="item" > @@ -163,6 +170,7 @@ @on-duplicate-chart-block="duplicateChart" @on-drag-chart="editChartForDrag" @on-edit-chart-block="editData" + @sync="()=>{chartBySync(item)}" :chart-data="item" :is-lock="panelLock" :panel-id="filter.panelId" @@ -175,6 +183,7 @@ @on-duplicate-chart-block="duplicateChart" @on-drag-chart="editChartForDrag" @on-edit-chart-block="editData" + @sync="()=>{chartBySync(item)}" :chart-data="item" :is-lock="panelLock" :panel-id="filter.panelId" @@ -190,6 +199,7 @@ :panelLock="panelLock" :filter="filter" @on-edit-chart-block="editData" + @sync="()=>{chartBySync(item)}" @on-edit-group-chart="editDataGroup" @on-remove-group-chart="removeChartGroup" @on-duplicate-group-chart="duplicateChartGroup" @@ -1835,6 +1845,16 @@ export default { init () { this.stepWidth = this.chartResizeTool.stepWidth(document.getElementById('listContainer').offsetWidth - 14) this.tempDomInit() + }, + chartBySync (item) { + this.$post('visual/panel/chart/syncTmpl', { ids: [item.id] }).then(res => { + if (res.code === 200) { + this.getData(this.filter) + this.$message.success(this.$t('tip.syncSuccess')) + } else { + this.$message.error(res.msg) + } + }) } }, created () { diff --git a/nezha-fronted/src/components/charts/chart-pie.vue b/nezha-fronted/src/components/charts/chart-pie.vue index b1405c5a6..4b4ca4308 100644 --- a/nezha-fronted/src/components/charts/chart-pie.vue +++ b/nezha-fronted/src/components/charts/chart-pie.vue @@ -46,6 +46,8 @@ {{$t('dashboard.delete')}}
  • {{$t('dashboard.duplicate')}}
  • +
  • + {{$t('overall.syncChart')}}
  • diff --git a/nezha-fronted/src/components/charts/chart-single-stat.vue b/nezha-fronted/src/components/charts/chart-single-stat.vue index 8a0038d97..3755d36dc 100644 --- a/nezha-fronted/src/components/charts/chart-single-stat.vue +++ b/nezha-fronted/src/components/charts/chart-single-stat.vue @@ -46,6 +46,8 @@ {{$t('dashboard.delete')}}
  • {{$t('dashboard.duplicate')}}
  • +
  • + {{$t('overall.syncChart')}}
  • diff --git a/nezha-fronted/src/components/charts/chart-table.vue b/nezha-fronted/src/components/charts/chart-table.vue index 177b728df..baaec13de 100644 --- a/nezha-fronted/src/components/charts/chart-table.vue +++ b/nezha-fronted/src/components/charts/chart-table.vue @@ -47,6 +47,8 @@ {{$t('dashboard.delete')}}
  • {{$t('dashboard.duplicate')}}
  • +
  • + {{$t('overall.syncChart')}}
  • diff --git a/nezha-fronted/src/components/charts/chart-url.vue b/nezha-fronted/src/components/charts/chart-url.vue index c0fd2af46..226bce907 100644 --- a/nezha-fronted/src/components/charts/chart-url.vue +++ b/nezha-fronted/src/components/charts/chart-url.vue @@ -34,6 +34,8 @@ {{$t('dashboard.delete')}}
  • {{$t('dashboard.duplicate')}}
  • +
  • + {{$t('overall.syncChart')}}
  • diff --git a/nezha-fronted/src/components/charts/line-chart-block.vue b/nezha-fronted/src/components/charts/line-chart-block.vue index 662c5435b..afa955dd8 100644 --- a/nezha-fronted/src/components/charts/line-chart-block.vue +++ b/nezha-fronted/src/components/charts/line-chart-block.vue @@ -60,6 +60,8 @@ {{$t('dashboard.delete')}}
  • {{$t('dashboard.duplicate')}}
  • +
  • + {{$t('overall.syncChart')}}
  • diff --git a/nezha-fronted/src/components/charts/text-chart.vue b/nezha-fronted/src/components/charts/text-chart.vue index bbda72496..3388c75ce 100644 --- a/nezha-fronted/src/components/charts/text-chart.vue +++ b/nezha-fronted/src/components/charts/text-chart.vue @@ -34,6 +34,8 @@ {{$t('dashboard.delete')}}
  • {{$t('dashboard.duplicate')}}
  • +
  • + {{$t('overall.syncChart')}}
  • diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue b/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue index 6c7ed8892..3a99c332d 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue @@ -76,7 +76,7 @@ - diff --git a/nezha-fronted/src/components/common/rightBox/moduleBox.vue b/nezha-fronted/src/components/common/rightBox/moduleBox.vue index dde63cd1f..a14e521e4 100644 --- a/nezha-fronted/src/components/common/rightBox/moduleBox.vue +++ b/nezha-fronted/src/components/common/rightBox/moduleBox.vue @@ -84,13 +84,13 @@ - + { + this.$post('visual/panel/chart/syncTmpl', { models: [row.id] }).then(res => { if (res.code === 200) { this.getTableData() this.$message.success(this.$t('tip.syncSuccess')) diff --git a/nezha-fronted/src/components/page/monitor/module/moduleList.vue b/nezha-fronted/src/components/page/monitor/module/moduleList.vue index 2a2c23976..fff828dbe 100644 --- a/nezha-fronted/src/components/page/monitor/module/moduleList.vue +++ b/nezha-fronted/src/components/page/monitor/module/moduleList.vue @@ -144,31 +144,35 @@ export default { } }, methods: { - edit (u) { - this.object = JSON.parse(JSON.stringify(u)) - this.object.configs = JSON.parse(this.object.configs) - this.object.walk = this.object.configs.walk ? JSON.parse(JSON.stringify(this.object.configs.walk)) : [] - this.object.port = this.object.configs.port ? JSON.parse(JSON.stringify(this.object.configs.port)) : 9100 - this.object.paramObj = [] - this.object.labelModule = [] - if (JSON.stringify(this.object.configs.labels) !== '{}' && this.object.configs.labels) { - Object.keys(this.object.configs.labels).forEach(key => { - this.object.labelModule.push({ key, value: this.object.configs.labels[key] }) - }) - } else { - this.object.labelModule.push({ key: '', value: '' }) - } - if (JSON.stringify(this.object.configs.params) !== '{}' && this.object.configs.params) { - Object.keys(this.object.configs.params).forEach(key => { - this.object.paramObj.push({ key, value: this.object.configs.params[key] }) - }) - } else { - this.object.paramObj.push({ key: '', value: [] }) - } - if (!this.object.chartIds) { - this.object.chartIds = [] - } - this.rightBox.show = true + edit (row) { + this.$get('monitor/module/' + row.id).then(res => { + if (res.code === 200) { + this.object = JSON.parse(JSON.stringify(res.data)) + this.object.configs = JSON.parse(this.object.configs) + this.object.walk = this.object.configs.walk ? JSON.parse(JSON.stringify(this.object.configs.walk)) : [] + this.object.port = this.object.configs.port ? JSON.parse(JSON.stringify(this.object.configs.port)) : 9100 + this.object.paramObj = [] + this.object.labelModule = [] + if (JSON.stringify(this.object.configs.labels) !== '{}' && this.object.configs.labels) { + Object.keys(this.object.configs.labels).forEach(key => { + this.object.labelModule.push({ key, value: this.object.configs.labels[key] }) + }) + } else { + this.object.labelModule.push({ key: '', value: '' }) + } + if (JSON.stringify(this.object.configs.params) !== '{}' && this.object.configs.params) { + Object.keys(this.object.configs.params).forEach(key => { + this.object.paramObj.push({ key, value: this.object.configs.params[key] }) + }) + } else { + this.object.paramObj.push({ key: '', value: [] }) + } + if (!this.object.chartIds) { + this.object.chartIds = '' + } + this.rightBox.show = true + } + }) }, getTableData () { this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo) @@ -205,7 +209,7 @@ export default { this.$message.error(res.msg) } }) - }, + } }, computed: { },