From e009142e7dc33c22161c5546528e29fc532449a6 Mon Sep 17 00:00:00 2001 From: chenjinsong <523037378@qq.com> Date: Fri, 17 Feb 2023 20:50:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=8C=E5=96=84NetworkOverviewLine?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B=EF=BC=9B?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=8F=98=E9=87=8F=E5=90=8D=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/charts2/networkOverviewLine.scss | 8 +- src/views/administration/Index.vue | 10 -- .../charts/dnsInsight/DnsTrafficLine.vue | 54 ++++----- .../charts/linkMonitor/LinkTrafficLine.vue | 42 +++---- .../networkOverview/NetworkOverviewLine.vue | 106 +++++++++--------- .../charts2/charts/npm/NpmTrafficLine.vue | 26 ++--- .../NetworkOverviewLine.test.js | 98 ++++++++++++---- .../NetworkOverviewLineMockData.js | 73 ++++++++++++ 8 files changed, 268 insertions(+), 149 deletions(-) create mode 100644 test/views/charts2/charts/networkOverview/NetworkOverviewLineMockData.js diff --git a/src/assets/css/components/views/charts2/networkOverviewLine.scss b/src/assets/css/components/views/charts2/networkOverviewLine.scss index 88e36698..6f0eb450 100644 --- a/src/assets/css/components/views/charts2/networkOverviewLine.scss +++ b/src/assets/css/components/views/charts2/networkOverviewLine.scss @@ -98,11 +98,11 @@ //top: 0; //left: 0; display: flex; - .line-value-mpackets.mousemove-cursor { + .line-value-tabs.mousemove-cursor { border-top: 4px solid #D3D0D8; z-index: 0; } - .line-value-mpackets { + .line-value-tabs { cursor: pointer; padding: 16px 0 0 20px; border-top: 4px solid transparent; @@ -122,10 +122,10 @@ } } } - .line-value-mpackets-name { + .line-value-tabs-name { position: relative; display: flex; - .mpackets-name { + .tabs-name { flex: 1; padding-left: 19px; } diff --git a/src/views/administration/Index.vue b/src/views/administration/Index.vue index 6c7b5e93..58e00fc9 100644 --- a/src/views/administration/Index.vue +++ b/src/views/administration/Index.vue @@ -43,16 +43,6 @@ export default { i18n: 'I18n', path: '/administration/i18n', icon: 'cn-icon cn-icon-i18n' - }, - { - i18n: 'galaxyProxy.galaxyProxy', - path: '/administration/galaxyProxy', - icon: 'cn-icon cn-icon-proxy' - }, - { - i18n: 'overall.chart', - path: '/administration/chart', - icon: 'cn-icon cn-icon-chart' } ] } diff --git a/src/views/charts2/charts/dnsInsight/DnsTrafficLine.vue b/src/views/charts2/charts/dnsInsight/DnsTrafficLine.vue index 7ff9d86f..757e3d17 100644 --- a/src/views/charts2/charts/dnsInsight/DnsTrafficLine.vue +++ b/src/views/charts2/charts/dnsInsight/DnsTrafficLine.vue @@ -5,17 +5,17 @@
-
-
+
-
{{$t(item.name)}}
+
{{$t(item.name)}}
{{unitConvert(item.analysis.avg, unitTypes.number)[0]}} @@ -126,7 +126,7 @@ export default { label: 'Maximum' } ], - mpackets: [ + tabs: [ { analysis: {}, name: 'network.total', class: 'total', show: true, invertTab: true, positioning: 0, data: [], unitType: '' }, { analysis: {}, name: 'network.inbound', class: 'inbound', show: true, invertTab: true, positioning: 1, data: [], unitType: '' }, { analysis: {}, name: 'network.outbound', class: 'outbound', show: true, invertTab: true, positioning: 2, data: [], unitType: '' } @@ -202,7 +202,7 @@ export default { this.isNoData = res.data.result.length === 0 if (this.isNoData) { this.lineTab = '' - this.mpackets = [ + this.tabs = [ { analysis: {}, name: 'network.total', class: 'total', show: true, invertTab: true, positioning: 0, data: [], unitType: '' }, { analysis: {}, name: 'network.inbound', class: 'inbound', show: true, invertTab: true, positioning: 1, data: [], unitType: '' }, { analysis: {}, name: 'network.outbound', class: 'outbound', show: true, invertTab: true, positioning: 2, data: [], unitType: '' } @@ -323,7 +323,7 @@ export default { this.chartOption.tooltip.formatter = (params) => { params.forEach(t => { t.seriesName = this.$t(t.seriesName) - this.mpackets.forEach(e => { + this.tabs.forEach(e => { if (this.$t(e.name) === t.seriesName) { t.borderColor = chartColor3[e.positioning] } @@ -366,16 +366,16 @@ export default { legendSelectChange (item, index, val) { if (index === 'index') { this.dispatchLegendSelectAction(item.name) - } else if (this.mpackets[index] && this.mpackets[index].name === item.name) { + } else if (this.tabs[index] && this.tabs[index].name === item.name) { this.dispatchLegendSelectAction(item.name) - this.mpackets.forEach((t) => { + this.tabs.forEach((t) => { if (t.name !== item.name) { this.dispatchLegendUnSelectAction(t.name) } }) } if (val === 'active') { - this.mpackets.forEach(t => { + this.tabs.forEach(t => { if (item.name === t.name) { t.invertTab = !t.invertTab } else { @@ -387,7 +387,7 @@ export default { } else { this.lineTab = t.class } - this.mpackets.forEach((e) => { + this.tabs.forEach((e) => { this.dispatchLegendSelectAction(e.name) }) } @@ -395,8 +395,8 @@ export default { } }, handleActiveBar () { - if (document.querySelector('.network .line-value-mpackets.is-active')) { - const { offsetLeft, clientWidth, clientLeft } = document.querySelector('.network .line-value-mpackets.is-active') + if (document.querySelector('.network .line-value-tabs.is-active')) { + const { offsetLeft, clientWidth, clientLeft } = document.querySelector('.network .line-value-tabs.is-active') const activeBar = document.querySelector('.network .line-value-active') activeBar.style.cssText += `width: ${clientWidth}px; left: ${offsetLeft + this.leftOffset + clientLeft}px;` } @@ -409,7 +409,7 @@ export default { this.lineTab = '' this.handleActiveBar() this.showMarkLine = !this.showMarkLine - this.mpackets.forEach((e) => { + this.tabs.forEach((e) => { if (!e.invertTab) { e.invertTab = true } @@ -421,9 +421,9 @@ export default { let echartsData const chartOption = this.myChart.getOption() if (this.lineTab) { - echartsData = this.mpackets.filter(t => t.show === true && t.invertTab === false) + echartsData = this.tabs.filter(t => t.show === true && t.invertTab === false) } else { - echartsData = this.mpackets.filter(t => t.show === true) + echartsData = this.tabs.filter(t => t.show === true) } if (this.lineRefer === 'Average' && this.showMarkLine) { chartOption.series.forEach((t, i) => { @@ -488,13 +488,13 @@ export default { }) } lineData.splice(0, 1) - const mpackets = _.cloneDeep(this.mpackets) + const tabs = _.cloneDeep(this.tabs) if (val === 'Queries/s') { lineData.forEach((d, i) => { - mpackets[i].data = d.values - mpackets[i].analysis = d.analysis + tabs[i].data = d.values + tabs[i].analysis = d.analysis }) - mpackets.forEach((e, i) => { + tabs.forEach((e, i) => { if (i !== 0) { e.show = false } @@ -503,11 +503,11 @@ export default { this.lineTab = 'total' this.legendSelectChange(e, 0) }) - this.mpackets = mpackets - this.echartsInit(this.mpackets, true) + this.tabs = tabs + this.echartsInit(this.tabs, true) } else { const unit = 'bps' - this.legendInit(lineData, active, show, unit, mpackets) + this.legendInit(lineData, active, show, unit, tabs) } }, legendInit (data, active, show, type, dnsData) { @@ -535,14 +535,14 @@ export default { } } }) - this.mpackets = dnsData + this.tabs = dnsData if (num === 3) { dnsData[0].invertTab = false this.lineTab = 'total' this.legendSelectChange(dnsData[0], 0) - this.echartsInit(this.mpackets) + this.echartsInit(this.tabs) } else { - this.echartsInit(this.mpackets, show) + this.echartsInit(this.tabs, show) if (!this.lineRefer) this.lineRefer = 'Average' } } @@ -550,7 +550,7 @@ export default { mounted () { this.timer = setTimeout(() => { if (this.lineTab) { - const data = this.mpackets.find(t => t.class === this.lineTab) + const data = this.tabs.find(t => t.class === this.lineTab) this.activeChange(data, data.positioning) } else { this.init() diff --git a/src/views/charts2/charts/linkMonitor/LinkTrafficLine.vue b/src/views/charts2/charts/linkMonitor/LinkTrafficLine.vue index 60a7181a..14d25fb5 100644 --- a/src/views/charts2/charts/linkMonitor/LinkTrafficLine.vue +++ b/src/views/charts2/charts/linkMonitor/LinkTrafficLine.vue @@ -2,7 +2,7 @@