diff --git a/nezha-fronted/src/assets/css/components/common/diagnosisTab.scss b/nezha-fronted/src/assets/css/components/common/diagnosisTab.scss index db255a0d1..07939e7a2 100644 --- a/nezha-fronted/src/assets/css/components/common/diagnosisTab.scss +++ b/nezha-fronted/src/assets/css/components/common/diagnosisTab.scss @@ -75,6 +75,9 @@ padding: 15px 0 15px 34px; background-color: $--background-color-base !important; } + .el-table__body-wrapper{ + overflow-x: hidden; + } .el-table__body { tr{ background: $--background-color-empty; diff --git a/nezha-fronted/src/components/common/diagnosisTab.vue b/nezha-fronted/src/components/common/diagnosisTab.vue index 1e4d485b5..6a1a06c0e 100644 --- a/nezha-fronted/src/components/common/diagnosisTab.vue +++ b/nezha-fronted/src/components/common/diagnosisTab.vue @@ -19,7 +19,7 @@
{{diagnosisTabData.row.name}}
-
+
@@ -134,7 +134,9 @@ export default { label: 'name', prop: 'item', minWidth: 200 - }] + }], + diagnoseUrl: '', + fragment: '' // 头部提示部分 } }, props: { @@ -145,7 +147,7 @@ export default { this.dialogVisible = false }, getTableData () { - this.$get('monitor/endpoint/diagnose/' + this.diagnosisTabData.row.id).then(response => { + this.$get(this.diagnoseUrl + '/diagnose/' + this.diagnosisTabData.row.id).then(response => { if (response.code == 200) { this.tableData = response.data.list // 关闭定时器 取消任务 @@ -182,26 +184,46 @@ export default { } return time }, - suspendedStr (status) { // 10进制转为2进制 分别给对应的状态 - if (!status || status === 1 || status == 0) { return '' } - const arr = status.toString(2).split('') - while (arr.length < 4) { - arr.unshift('0') - } - arr.pop() + // 头部提示 + suspendedStr (status, from) { let str = '' - arr.forEach((item, index) => { - if (index === 0) { - str += `
DC
` + if (from === 'endpoint') { // 10进制转为2进制 分别给对应的状态 + let arr = [] + if (!status || status === 1 || status == 0) { + while (arr.length < 3) { + arr.push('1') + } + } else { + arr = status.toString(2).split('') + while (arr.length < 4) { + arr.unshift('0') + } + arr.pop() } - if (index === 1) { - str += `
ASSET
` - } - if (index === 2) { - str += `
ENDPOINT
` - } - }) - return str + arr.forEach((item, index) => { + if (index === 0) { + str += `
DC
` + } + if (index === 1) { + str += `
ASSET
` + } + if (index === 2) { + str += `
ENDPOINT
` + } + }) + } else if (from === 'asset') { + status.forEach((item, index) => { + if (index === 0) { + str += `
PING
` + } + if (index === 1) { + str += `
TALON
` + } + }) + } else { + str = '' + } + this.fragment = str } }, computed: { @@ -212,6 +234,25 @@ export default { mounted () { }, watch: { + diagnosisTabData: { + immediate: true, + deep: true, + handler (n) { + switch (n.from) { + case 'asset': + this.diagnoseUrl = '/asset' + this.suspendedStr([n.row.pingInfo.status, n.row.clientState], 'asset') + break + case 'endpoint': + this.diagnoseUrl = n.url + this.suspendedStr(n.row.configs[0].state, 'endpoint') + break + default: + this.diagnoseUrl = n.url + break + } + } + }, // 展示弹窗 showDiagnosisTab (n) { if (n) { diff --git a/nezha-fronted/src/components/common/table/asset/assetTable.vue b/nezha-fronted/src/components/common/table/asset/assetTable.vue index 7a0dfab86..002285af1 100644 --- a/nezha-fronted/src/components/common/table/asset/assetTable.vue +++ b/nezha-fronted/src/components/common/table/asset/assetTable.vue @@ -168,6 +168,7 @@ {{$t('overall.delete')}} {{$t('overall.silenceAlert')}} {{$t('overall.topology')}} + {{$t('overall.diagnosis')}} diff --git a/nezha-fronted/src/components/common/table/nzDataList.vue b/nezha-fronted/src/components/common/table/nzDataList.vue index 216a69fc1..be19923ab 100644 --- a/nezha-fronted/src/components/common/table/nzDataList.vue +++ b/nezha-fronted/src/components/common/table/nzDataList.vue @@ -114,7 +114,6 @@ > diff --git a/nezha-fronted/src/components/common/table/settings/endpointTable.vue b/nezha-fronted/src/components/common/table/settings/endpointTable.vue index 5fb2c7aaa..6e2b051d0 100644 --- a/nezha-fronted/src/components/common/table/settings/endpointTable.vue +++ b/nezha-fronted/src/components/common/table/settings/endpointTable.vue @@ -181,7 +181,7 @@ {{$t('overall.duplicate')}} {{$t('overall.silenceAlert')}} {{$t('overall.topology')}} - {{$t('overall.diagnosis')}} + {{$t('overall.diagnosis')}} {{$t('endpoints.metricTarget')}}