diff --git a/nezha-fronted/src/components/common/alert/alertLabel.vue b/nezha-fronted/src/components/common/alert/alertLabel.vue index d164b3b63..b6e84e018 100644 --- a/nezha-fronted/src/components/common/alert/alertLabel.vue +++ b/nezha-fronted/src/components/common/alert/alertLabel.vue @@ -1,129 +1,125 @@ @@ -181,6 +177,28 @@ export default { }, components: { + }, + watch: { + id: { + immediate: true, + deep: true, + handler (n) { + this.init() + } + }, + that: { + immediate: true, + deep: true, + handler (n) { + } + }, + LRTriangle: { + immediate: true, + deep: true, + handler (n) { + + } + } }, computed: { calcPosition () { @@ -215,6 +233,49 @@ export default { } }, methods: { + init () { + this.loading = true + if (this.type === 'asset') { + this.$get('asset/asset/' + this.id).then((res) => { + if (res.msg === 'success') { + this.loading = false + this.alertLabelData = res.data + } else { + this.$message.error(res.msg) + } + }) + } + if (this.type === 'project') { + this.$get('monitor/project/' + this.id).then((res) => { + if (res.msg === 'success') { + this.loading = false + this.alertLabelData = res.data + } else { + this.$message.error(res.msg) + } + }) + } + if (this.type === 'module') { + this.$get('monitor/module/' + this.id).then((res) => { + if (res.msg === 'success') { + this.loading = false + this.alertLabelData = res.data + } else { + this.$message.error(res.msg) + } + }) + } + if (this.type === 'endpoint') { + this.$get('monitor/endpoint/' + this.id).then((res) => { + if (res.msg === 'success') { + this.loading = false + this.alertLabelData = res.data + } else { + this.$message.error(res.msg) + } + }) + } + }, alertActiveStr () { return this.$t('overall.active') }, @@ -226,48 +287,7 @@ export default { } } }, - mounted () { - if (this.type === 'asset') { - this.$get('/asset/info?id=' + this.id).then((res) => { - if (res.msg === 'success') { - this.loading = false - this.alertLabelData = res.data.Basic - } else { - this.$message.error(res.msg) - } - }) - } - if (this.type === 'project') { - this.$get('/project?id=' + this.id).then((res) => { - if (res.msg === 'success') { - this.loading = false - this.alertLabelData = res.data.list[0] - } else { - this.$message.error(res.msg) - } - }) - } - if (this.type === 'module') { - this.$get('/module?id=' + this.id).then((res) => { - if (res.msg === 'success') { - this.loading = false - this.alertLabelData = res.data.list[0] - } else { - this.$message.error(res.msg) - } - }) - } - if (this.type === 'endpoint') { - this.$get('/endpoint?id=' + this.id).then((res) => { - if (res.msg === 'success') { - this.loading = false - this.alertLabelData = res.data.list[0] - } else { - this.$message.error(res.msg) - } - }) - } - }, + mounted () {}, beforeDestroy () { } diff --git a/nezha-fronted/src/components/common/bottomBox/bottomBox.vue b/nezha-fronted/src/components/common/bottomBox/bottomBox.vue index 820c37c36..d4be5c142 100644 --- a/nezha-fronted/src/components/common/bottomBox/bottomBox.vue +++ b/nezha-fronted/src/components/common/bottomBox/bottomBox.vue @@ -159,24 +159,24 @@ export default { moduleTabTitle: [ // { prop: 'panel', name: 'Detail' }, { prop: 'endpoint', name: this.$t('asset.endpoint') }, - { prop: 'moduleAlertMessage', name: 'Alert' } + { prop: 'moduleAlertMessage', name: this.$t('overall.alert') } ] }, endpoint: { endpointTabTitle: [ // { prop: 'panel', name: 'Detail' }, { prop: 'endpointQuery', name: 'Query' }, - { prop: 'endpointAlertMessage', name: 'Alert' } + { prop: 'endpointAlertMessage', name: this.$t('overall.alert') } ] }, chartTemp: { chartTempTabTitle: [ - { prop: 'panel', name: 'Template preview' } + { prop: 'panel', name: this.$t('overall.tempPrev') } ] }, alertRule: { alertRule: [ - { prop: 'alertRuleAlertMessage', name: 'Alert' } + { prop: 'alertRuleAlertMessage', name: this.$t('overall.alert') } ] }, model: [ diff --git a/nezha-fronted/src/components/common/bottomBox/nzBottomDataList.vue b/nezha-fronted/src/components/common/bottomBox/nzBottomDataList.vue index 763380462..05cee093d 100644 --- a/nezha-fronted/src/components/common/bottomBox/nzBottomDataList.vue +++ b/nezha-fronted/src/components/common/bottomBox/nzBottomDataList.vue @@ -2,7 +2,7 @@
-
{{title}}:
+
{{bottomHeaderTitle}}:
{{tab.name}}
@@ -82,8 +82,12 @@ export default { default: true }, title: { - type: String, - default: 'Name' + type: String + } + }, + computed: { + bottomHeaderTitle () { + return this.title || this.$t('overall.name') } }, data () { diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js index c30093e44..6b9de9755 100644 --- a/nezha-fronted/src/components/common/language/cn.js +++ b/nezha-fronted/src/components/common/language/cn.js @@ -109,7 +109,8 @@ const cn = { labels: '标签', editType: '类型', searchCondition: '搜索条件', - batchDel: '批量删除' + batchDel: '批量删除', + tempPrev: '模板预览' }, setup: { step0: '欢迎', diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index 7e921d1f7..9b807db4e 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -114,7 +114,8 @@ const en = { silence: 'Silence', editType: 'Type', searchCondition: 'Search condition', - batchDel: 'Batches delete' + batchDel: 'Batches delete', + tempPrev: 'Template preview' }, pageSize: '/page', setup: { diff --git a/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue b/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue index 4c1c46eaa..eaa5873e5 100644 --- a/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue +++ b/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue @@ -128,7 +128,7 @@ import table from '@/components/common/mixin/table' import nzAlertTag from '../../../page/alert/nzAlertTag' import chartDataFormat from '../../../charts/chartDataFormat' import alertRuleInfo from '../../alert/alertRuleInfo' -import alertLabel from '../../alert/alertLabel2' +import alertLabel from '../../alert/alertLabel' import { calcDurationByStringTimeB } from '../../js/tools' export default { name: 'alertMessageTable',