main
陈博文 3 days ago
parent 2d6e041ce9
commit 0df4139720

@ -54,8 +54,6 @@ const getTopOptions = () => {
formatter: function (params) { formatter: function (params) {
var res = params[0].name + '<br/>'; var res = params[0].name + '<br/>';
for (var i = 0; i < params.length; i++) { for (var i = 0; i < params.length; i++) {
console.log(params[i].value, formatSmartPercentage(params[i].value), 'params')
res += res +=
params[i].marker + params[i].marker +
params[i].seriesName + params[i].seriesName +

@ -1,4 +1,4 @@
import { timeParse } from '@/utils'; import { timeParse, formatSmartPercentage } from '@/utils';
export default ({ percent, title, unit = '%' }) => { export default ({ percent, title, unit = '%' }) => {
const value = percent.toFixed(1); const value = percent.toFixed(1);
@ -232,7 +232,7 @@ export const getLineOptions = ({ data = [], unit = '%' }) => {
var res = params[0].name + '<br/>'; var res = params[0].name + '<br/>';
for (var i = 0; i < params.length; i++) { for (var i = 0; i < params.length; i++) {
res += res +=
params[i].marker + (+params[i].value).toFixed(0) + ` ${unit}<br/>`; params[i].marker + formatSmartPercentage(params[i].value) + ` ${unit}<br/>`;
} }
return res; return res;
}, },
@ -240,7 +240,7 @@ export const getLineOptions = ({ data = [], unit = '%' }) => {
grid: { grid: {
top: 7, // 上边距 top: 7, // 上边距
bottom: 20, // 下边距 bottom: 20, // 下边距
left: '7%', // 左边距 left: '10%', // 左边距
right: 10, // 右边距 right: 10, // 右边距
}, },
xAxis: { xAxis: {
@ -258,7 +258,7 @@ export const getLineOptions = ({ data = [], unit = '%' }) => {
series: [ series: [
{ {
data: data.map((item) => { data: data.map((item) => {
return item.value.toFixed(1); return item.value;
}), }),
type: 'line', type: 'line',
areaStyle: { areaStyle: {

@ -208,26 +208,26 @@ const columns = [
} }
]; ];
const cp = useInstantVector( // const cp = useInstantVector(
[ // [
{ // {
label: 'vGPU超配', // label: 'vGPU',
count: '0', // count: '0',
query: `avg(sum(hami_vgpu_count{node=~"$node"}) by (instance))`, // query: `avg(sum(hami_vgpu_count{node=~"$node"}) by (instance))`,
}, // },
{ // {
label: '算力超配', // label: '',
count: '0', // count: '0',
query: `avg(sum(hami_vcore_scaling{node=~"$node"}) by (instance))`, // query: `avg(sum(hami_vcore_scaling{node=~"$node"}) by (instance))`,
}, // },
{ // {
label: '显存超配', // label: '',
count: '1.5', // count: '1.5',
query: `avg(sum(hami_vmemory_scaling{node=~"$node"}) by (instance))`, // query: `avg(sum(hami_vmemory_scaling{node=~"$node"}) by (instance))`,
}, // },
], // ],
(query) => query.replaceAll('$node', props.detail.name), // (query) => query.replaceAll('$node', props.detail.name),
); // );
const gaugeConfig = useInstantVector( const gaugeConfig = useInstantVector(
[ [

@ -1,4 +1,4 @@
import { timeParse } from '@/utils'; import { timeParse, formatSmartPercentage } from '@/utils';
export const getRangeOptions = ({ core = [], memory = [] }) => { export const getRangeOptions = ({ core = [], memory = [] }) => {
return { return {
@ -17,7 +17,7 @@ export const getRangeOptions = ({ core = [], memory = [] }) => {
params[i].marker + params[i].marker +
params[i].seriesName + params[i].seriesName +
' : ' + ' : ' +
(+params[i].value).toFixed(0) + formatSmartPercentage(params[i].value) +
`%<br/>`; `%<br/>`;
} }
@ -27,7 +27,7 @@ export const getRangeOptions = ({ core = [], memory = [] }) => {
grid: { grid: {
top: 37, // 上边距 top: 37, // 上边距
bottom: 20, // 下边距 bottom: 20, // 下边距
left: '7%', // 左边距 left: '10%', // 左边距
right: 10, // 右边距 right: 10, // 右边距
}, },
xAxis: { xAxis: {

@ -1,4 +1,4 @@
import { timeParse } from '@/utils'; import { timeParse, formatSmartPercentage } from '@/utils';
import { cloneDeep } from 'lodash'; import { cloneDeep } from 'lodash';
import nodeApi from '~/vgpu/api/node'; import nodeApi from '~/vgpu/api/node';
import { ElMessage } from 'element-plus'; import { ElMessage } from 'element-plus';
@ -323,16 +323,16 @@ export const getCardOptions = (list, chartWidth) => {
rich: { rich: {
cnt: { cnt: {
fontSize: 10, fontSize: 10,
color: '#999' color: '#999',
} },
} },
}, },
labelLayout: function (params) { labelLayout: function (params) {
const isLeft = params.labelRect.x < chartWidth / 2; const isLeft = params.labelRect.x < chartWidth / 2;
const points = params.labelLinePoints; const points = params.labelLinePoints;
points[2][0] = isLeft points[2][0] = isLeft
? params.labelRect.x ? params.labelRect.x
: params.labelRect.x + params.labelRect.width; : params.labelRect.x + params.labelRect.width;
return { return {
labelLinePoints: points, labelLinePoints: points,
}; };
@ -343,7 +343,6 @@ export const getCardOptions = (list, chartWidth) => {
})), })),
}, },
], ],
}; };
}; };
@ -385,7 +384,7 @@ export const getLineOptions = ({
grid: { grid: {
top: 37, // 上边距 top: 37, // 上边距
bottom: 20, // 下边距 bottom: 20, // 下边距
left: '7%', // 左边距 left: '10%', // 左边距
right: 10, // 右边距 right: 10, // 右边距
}, },
xAxis: { xAxis: {
@ -496,7 +495,7 @@ export const getRangeOptions = (data) => {
params[i].marker + params[i].marker +
params[i].seriesName + params[i].seriesName +
' : ' + ' : ' +
(+params[i].value).toFixed(0) + formatSmartPercentage(params[i].value) +
`%<br/>`; `%<br/>`;
} }
@ -506,7 +505,7 @@ export const getRangeOptions = (data) => {
grid: { grid: {
top: 37, // 上边距 top: 37, // 上边距
bottom: 20, // 下边距 bottom: 20, // 下边距
left: '7%', // 左边距 left: '10%', // 左边距
right: 10, // 右边距 right: 10, // 右边距
}, },
xAxis: { xAxis: {

@ -1,4 +1,4 @@
import { timeParse } from '@/utils'; import { timeParse, formatSmartPercentage } from '@/utils';
export const getRangeOptions = ({ export const getRangeOptions = ({
core = [], core = [],
@ -22,7 +22,8 @@ export const getRangeOptions = ({
params[i].marker + params[i].marker +
params[i].seriesName + params[i].seriesName +
' : ' + ' : ' +
(+params[i].value).toFixed(0) + // (+params[i].value).toFixed(0) +
formatSmartPercentage(params[i].value) +
`%<br/>`; `%<br/>`;
} }
@ -32,7 +33,7 @@ export const getRangeOptions = ({
grid: { grid: {
top: 37, // 上边距 top: 37, // 上边距
bottom: 20, // 下边距 bottom: 20, // 下边距
left: '7%', // 左边距 left: '10%', // 左边距
right: 10, // 右边距 right: 10, // 右边距
}, },
xAxis: { xAxis: {

@ -1,6 +1,6 @@
<template> <template>
<back-header> <back-header>
资源池管理 > {{ route.query?.name || '' }} 资源池管理 > {{ route.query?.poolName || '' }}
</back-header> </back-header>
<table-plus v-loading="loading" :dataSource="list" :columns="columns" :rowAction="rowAction" :hasPagination="false" <table-plus v-loading="loading" :dataSource="list" :columns="columns" :rowAction="rowAction" :hasPagination="false"
style="margin-bottom: 15px; height: auto;" hideTag ref="table" static :hasActionBar="false"> style="margin-bottom: 15px; height: auto;" hideTag ref="table" static :hasActionBar="false">
@ -39,10 +39,6 @@ const data = computed(() => {
return result; return result;
}) })
watchEffect(() => {
console.log(data.value, 'data')
})
const getList = async () => { const getList = async () => {
loading.value = true loading.value = true
const res = await pollApi.getDetailNodeList({ pool_id: route.params.uid }) const res = await pollApi.getDetailNodeList({ pool_id: route.params.uid })

@ -65,10 +65,6 @@ import { getRangeOptions } from './getOptions';
const props = defineProps(['data']) const props = defineProps(['data'])
watchEffect(() => {
console.log(props.data, 'data2')
})
const end = new Date(); const end = new Date();
const start = new Date(); const start = new Date();
start.setTime(start.getTime() - 3600 * 1000); start.setTime(start.getTime() - 3600 * 1000);

@ -1,4 +1,4 @@
import { timeParse } from '@/utils'; import { timeParse, formatSmartPercentage } from '@/utils';
export const getRangeOptions = ({ export const getRangeOptions = ({
core = [], core = [],
@ -22,7 +22,8 @@ export const getRangeOptions = ({
params[i].marker + params[i].marker +
params[i].seriesName + params[i].seriesName +
' : ' + ' : ' +
(+params[i].value).toFixed(0) + // (+params[i].value).toFixed(0) +
formatSmartPercentage(params[i].value) +
`%<br/>`; `%<br/>`;
} }
@ -32,7 +33,7 @@ export const getRangeOptions = ({
grid: { grid: {
top: 37, // 上边距 top: 37, // 上边距
bottom: 20, // 下边距 bottom: 20, // 下边距
left: '7%', // 左边距 left: '10%', // 左边距
right: 10, // 右边距 right: 10, // 右边距
}, },
xAxis: { xAxis: {

@ -21,7 +21,7 @@
</div> </div>
</div> </div>
<div class="right"> <div class="right">
<el-button @click="sendRouteChange(`/admin/vgpu/poll/admin/${poolId}?name=${poolName}`)" <el-button @click="sendRouteChange(`/admin/vgpu/poll/admin/${poolId}?poolName=${poolName}`)"
type="text">查看详情</el-button> type="text">查看详情</el-button>
<template v-if="index === 0 && currentPage === 1"> <template v-if="index === 0 && currentPage === 1">
<el-button @click="sendRouteChange(linkUrl, 'open')" type="text">配置</el-button> <el-button @click="sendRouteChange(linkUrl, 'open')" type="text">配置</el-button>
@ -137,10 +137,6 @@ const paginatedList = computed(() => {
return list.value.slice(start, end) return list.value.slice(start, end)
}) })
// watchEffect(()=>{
// console.log(currentPage.value, pageSize.value, 88)
// })
// //
const handleSizeChange = (val) => { const handleSizeChange = (val) => {
pageSize.value = val pageSize.value = val

Loading…
Cancel
Save