From 3ae20a4a853636e5ab660e78e961c870d79c6cc5 Mon Sep 17 00:00:00 2001 From: chenjinsong <523037378@qq.com> Date: Wed, 21 Jul 2021 22:46:08 +0800 Subject: [PATCH] =?UTF-8?q?CN-65=20perf:=20=E6=95=B0=E6=8D=AE=E7=9A=84?= =?UTF-8?q?=E5=8D=95=E4=BD=8D=E7=9A=84=E5=B1=95=E7=A4=BA=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/charts/ChartTable.vue | 17 ++- src/components/charts/PieTable.vue | 47 ++++--- src/components/charts/StatisticsLegend.vue | 16 +-- src/components/charts/chart-formatter.js | 55 --------- src/components/charts/chart-options.js | 30 +++-- src/utils/constants.js | 6 + src/utils/date-util.js | 2 - src/utils/unit-convert.js | 101 +++++++++++++++ src/views/charts/Chart.vue | 135 ++++++++++++--------- src/views/charts/Panel.vue | 62 ++++------ src/views/entities/EntityExplorer.vue | 1 - 11 files changed, 275 insertions(+), 197 deletions(-) delete mode 100644 src/components/charts/chart-formatter.js create mode 100644 src/utils/unit-convert.js diff --git a/src/components/charts/ChartTable.vue b/src/components/charts/ChartTable.vue index 70fe5a0a..ec9b9a38 100644 --- a/src/components/charts/ChartTable.vue +++ b/src/components/charts/ChartTable.vue @@ -28,8 +28,11 @@ > {{c.label}} {{}} - - {{shortFormatter(row[c.prop])}} + + {{unitConvert(row[c.prop], unitTypes.byte).join(' ')}} + + + {{unitConvert(row[c.prop], unitTypes.number).join(' ')}} {{row[c.prop]}} @@ -45,15 +48,19 @@ diff --git a/src/components/charts/PieTable.vue b/src/components/charts/PieTable.vue index 55507e79..1223ff93 100644 --- a/src/components/charts/PieTable.vue +++ b/src/components/charts/PieTable.vue @@ -36,8 +36,11 @@ {{ nameColumn === 'fqdnCategoryName' ? row['fqdnCategoryName'] : row['reputationLevel'] }} - - {{ shortFormatter(row[item.prop]) }} + + {{unitConvert(row[item.prop], unitTypes.byte).join(' ')}} + + + {{unitConvert(row[item.prop], unitTypes.number).join(' ')}} {{ row[item.prop] }} @@ -54,23 +57,27 @@ :label="item.label" :prop="item.prop" #default="{row}"> - - {{ nameColumn === 'fqdnCategoryName' ? row['categoryName'] : row['reputationLevel'] }} - - - {{ shortFormatter(row[item.prop]) }} - + + {{ nameColumn === 'fqdnCategoryName' ? row['categoryName'] : row['reputationLevel'] }} + + + {{unitConvert(row[item.prop], unitTypes.byte).join(' ')}} + + + {{unitConvert(row[item.prop], unitTypes.number).join(' ')}} + - {{ row[item.prop] }} - + {{ row[item.prop] }} + diff --git a/src/components/charts/StatisticsLegend.vue b/src/components/charts/StatisticsLegend.vue index 4676fd24..112048e4 100644 --- a/src/components/charts/StatisticsLegend.vue +++ b/src/components/charts/StatisticsLegend.vue @@ -8,8 +8,8 @@ {{item.legend}} - {{shortFormatter(item.aggregation.max)}} - {{shortFormatter(item.aggregation.avg)}} + {{unitConvert(item.aggregation.avg)}} + {{unitConvert(item.aggregation.max)}} @@ -18,24 +18,16 @@