From 0df4139720e7168f3c4523a46ccd7fe632117a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=8D=9A=E6=96=87?= <1179111926@qq.com> Date: Fri, 8 Aug 2025 16:12:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/projects/vgpu/components/TabTop.vue | 2 - .../web/projects/vgpu/components/config.js | 8 ++-- .../projects/vgpu/views/card/admin/Detail.vue | 40 +++++++++---------- .../vgpu/views/card/admin/getOptions.js | 6 +-- .../vgpu/views/monitor/overview/getOptions.js | 19 +++++---- .../vgpu/views/node/admin/getOptions.js | 7 ++-- .../projects/vgpu/views/poll/admin/Detail.vue | 6 +-- .../vgpu/views/poll/admin/DetailBox.vue | 4 -- .../vgpu/views/poll/admin/getOptions.js | 7 ++-- .../projects/vgpu/views/poll/admin/index.vue | 6 +-- 10 files changed, 46 insertions(+), 59 deletions(-) diff --git a/packages/web/projects/vgpu/components/TabTop.vue b/packages/web/projects/vgpu/components/TabTop.vue index ddbeac6..2f8317f 100644 --- a/packages/web/projects/vgpu/components/TabTop.vue +++ b/packages/web/projects/vgpu/components/TabTop.vue @@ -54,8 +54,6 @@ const getTopOptions = () => { formatter: function (params) { var res = params[0].name + '
'; for (var i = 0; i < params.length; i++) { - console.log(params[i].value, formatSmartPercentage(params[i].value), 'params') - res += params[i].marker + params[i].seriesName + diff --git a/packages/web/projects/vgpu/components/config.js b/packages/web/projects/vgpu/components/config.js index 6da7771..f71ba76 100644 --- a/packages/web/projects/vgpu/components/config.js +++ b/packages/web/projects/vgpu/components/config.js @@ -1,4 +1,4 @@ -import { timeParse } from '@/utils'; +import { timeParse, formatSmartPercentage } from '@/utils'; export default ({ percent, title, unit = '%' }) => { const value = percent.toFixed(1); @@ -232,7 +232,7 @@ export const getLineOptions = ({ data = [], unit = '%' }) => { var res = params[0].name + '
'; for (var i = 0; i < params.length; i++) { res += - params[i].marker + (+params[i].value).toFixed(0) + ` ${unit}
`; + params[i].marker + formatSmartPercentage(params[i].value) + ` ${unit}
`; } return res; }, @@ -240,7 +240,7 @@ export const getLineOptions = ({ data = [], unit = '%' }) => { grid: { top: 7, // 上边距 bottom: 20, // 下边距 - left: '7%', // 左边距 + left: '10%', // 左边距 right: 10, // 右边距 }, xAxis: { @@ -258,7 +258,7 @@ export const getLineOptions = ({ data = [], unit = '%' }) => { series: [ { data: data.map((item) => { - return item.value.toFixed(1); + return item.value; }), type: 'line', areaStyle: { diff --git a/packages/web/projects/vgpu/views/card/admin/Detail.vue b/packages/web/projects/vgpu/views/card/admin/Detail.vue index e05fa0e..3bb9877 100644 --- a/packages/web/projects/vgpu/views/card/admin/Detail.vue +++ b/packages/web/projects/vgpu/views/card/admin/Detail.vue @@ -208,26 +208,26 @@ const columns = [ } ]; -const cp = useInstantVector( - [ - { - label: 'vGPU超配', - count: '0', - query: `avg(sum(hami_vgpu_count{node=~"$node"}) by (instance))`, - }, - { - label: '算力超配', - count: '0', - query: `avg(sum(hami_vcore_scaling{node=~"$node"}) by (instance))`, - }, - { - label: '显存超配', - count: '1.5', - query: `avg(sum(hami_vmemory_scaling{node=~"$node"}) by (instance))`, - }, - ], - (query) => query.replaceAll('$node', props.detail.name), -); +// const cp = useInstantVector( +// [ +// { +// label: 'vGPU超配', +// count: '0', +// query: `avg(sum(hami_vgpu_count{node=~"$node"}) by (instance))`, +// }, +// { +// label: '算力超配', +// count: '0', +// query: `avg(sum(hami_vcore_scaling{node=~"$node"}) by (instance))`, +// }, +// { +// label: '显存超配', +// count: '1.5', +// query: `avg(sum(hami_vmemory_scaling{node=~"$node"}) by (instance))`, +// }, +// ], +// (query) => query.replaceAll('$node', props.detail.name), +// ); const gaugeConfig = useInstantVector( [ diff --git a/packages/web/projects/vgpu/views/card/admin/getOptions.js b/packages/web/projects/vgpu/views/card/admin/getOptions.js index 3044839..e8551ce 100644 --- a/packages/web/projects/vgpu/views/card/admin/getOptions.js +++ b/packages/web/projects/vgpu/views/card/admin/getOptions.js @@ -1,4 +1,4 @@ -import { timeParse } from '@/utils'; +import { timeParse, formatSmartPercentage } from '@/utils'; export const getRangeOptions = ({ core = [], memory = [] }) => { return { @@ -17,7 +17,7 @@ export const getRangeOptions = ({ core = [], memory = [] }) => { params[i].marker + params[i].seriesName + ' : ' + - (+params[i].value).toFixed(0) + + formatSmartPercentage(params[i].value) + `%
`; } @@ -27,7 +27,7 @@ export const getRangeOptions = ({ core = [], memory = [] }) => { grid: { top: 37, // 上边距 bottom: 20, // 下边距 - left: '7%', // 左边距 + left: '10%', // 左边距 right: 10, // 右边距 }, xAxis: { diff --git a/packages/web/projects/vgpu/views/monitor/overview/getOptions.js b/packages/web/projects/vgpu/views/monitor/overview/getOptions.js index 99289ac..b4f4600 100644 --- a/packages/web/projects/vgpu/views/monitor/overview/getOptions.js +++ b/packages/web/projects/vgpu/views/monitor/overview/getOptions.js @@ -1,4 +1,4 @@ -import { timeParse } from '@/utils'; +import { timeParse, formatSmartPercentage } from '@/utils'; import { cloneDeep } from 'lodash'; import nodeApi from '~/vgpu/api/node'; import { ElMessage } from 'element-plus'; @@ -323,16 +323,16 @@ export const getCardOptions = (list, chartWidth) => { rich: { cnt: { fontSize: 10, - color: '#999' - } - } + color: '#999', + }, + }, }, labelLayout: function (params) { const isLeft = params.labelRect.x < chartWidth / 2; const points = params.labelLinePoints; points[2][0] = isLeft - ? params.labelRect.x - : params.labelRect.x + params.labelRect.width; + ? params.labelRect.x + : params.labelRect.x + params.labelRect.width; return { labelLinePoints: points, }; @@ -343,7 +343,6 @@ export const getCardOptions = (list, chartWidth) => { })), }, ], - }; }; @@ -385,7 +384,7 @@ export const getLineOptions = ({ grid: { top: 37, // 上边距 bottom: 20, // 下边距 - left: '7%', // 左边距 + left: '10%', // 左边距 right: 10, // 右边距 }, xAxis: { @@ -496,7 +495,7 @@ export const getRangeOptions = (data) => { params[i].marker + params[i].seriesName + ' : ' + - (+params[i].value).toFixed(0) + + formatSmartPercentage(params[i].value) + `%
`; } @@ -506,7 +505,7 @@ export const getRangeOptions = (data) => { grid: { top: 37, // 上边距 bottom: 20, // 下边距 - left: '7%', // 左边距 + left: '10%', // 左边距 right: 10, // 右边距 }, xAxis: { diff --git a/packages/web/projects/vgpu/views/node/admin/getOptions.js b/packages/web/projects/vgpu/views/node/admin/getOptions.js index 50ff8ce..a7cd503 100644 --- a/packages/web/projects/vgpu/views/node/admin/getOptions.js +++ b/packages/web/projects/vgpu/views/node/admin/getOptions.js @@ -1,4 +1,4 @@ -import { timeParse } from '@/utils'; +import { timeParse, formatSmartPercentage } from '@/utils'; export const getRangeOptions = ({ core = [], @@ -22,7 +22,8 @@ export const getRangeOptions = ({ params[i].marker + params[i].seriesName + ' : ' + - (+params[i].value).toFixed(0) + + // (+params[i].value).toFixed(0) + + formatSmartPercentage(params[i].value) + `%
`; } @@ -32,7 +33,7 @@ export const getRangeOptions = ({ grid: { top: 37, // 上边距 bottom: 20, // 下边距 - left: '7%', // 左边距 + left: '10%', // 左边距 right: 10, // 右边距 }, xAxis: { diff --git a/packages/web/projects/vgpu/views/poll/admin/Detail.vue b/packages/web/projects/vgpu/views/poll/admin/Detail.vue index b28996f..7e2f062 100644 --- a/packages/web/projects/vgpu/views/poll/admin/Detail.vue +++ b/packages/web/projects/vgpu/views/poll/admin/Detail.vue @@ -1,6 +1,6 @@