main
陈博文 4 days ago
parent 9f6ded361c
commit 870463072f

@ -43,6 +43,14 @@ class pollApi {
});
}
remove(data) {
return request({
url: apiPrefix + '/v1/resource/pool/removeNode',
method: 'POST',
data,
});
}
getDetailNodeList(data) {
return {
url: apiPrefix + '/v1/resource/pool/detail',

@ -172,11 +172,6 @@ const columns = [
dataIndex: 'diskSize',
render: ({ diskSize }) => `${bytesToGB(diskSize)}GiB`,
},
{
title: '所属资源池',
dataIndex: 'resourcePools',
render: ({ resourcePools }) => `${resourcePools.join('、')}`,
},
{
title: '显卡数量',
dataIndex: 'cardCnt',
@ -221,57 +216,23 @@ const rowAction = [
},
},
{
title: '禁用',
hidden: (row) => !row.isSchedulable,
title: '移除',
onClick: async (row) => {
ElMessageBox.confirm(`认对该节点进行禁用操作`, '操作确认', {
ElMessageBox.confirm(`定要移除当前节点吗`, '操作确认', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
try {
await nodeApi.stop(
await pollApi.remove(
{
nodeName: row.name,
status: 'DISABLED'
node_id: row.nodeId,
}
).then(
() => {
setTimeout(() => {
ElMessage.success('节点禁用成功');
table.value.fetchData();
}, 500);
}
)
} catch (error) {
ElMessage.error(error.message);
}
})
.catch(() => { });
},
},
{
title: '开启',
hidden: (row) => row.isSchedulable,
disabled: (row) => row.isExternal,
onClick: async (row) => {
ElMessageBox.confirm(`确认对该节点进行开启调度操作?`, '操作确认', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
try {
await nodeApi.stop(
{
nodeName: row.name,
status: 'ENABLE'
}
).then(
() => {
setTimeout(() => {
ElMessage.success('节点开启调度成功');
ElMessage.success('节点移除成功');
table.value.fetchData();
}, 500);
}
@ -523,7 +484,6 @@ onMounted(async () => {
</script>
<style scoped lang="scss">
.card-gauges {
margin: 0;
padding: 0;

@ -64,7 +64,7 @@ import { onMounted, ref, watch, watchEffect } from 'vue';
import useInstantVector from '~/vgpu/hooks/useInstantVector';
import cardApi from '~/vgpu/api/card';
import { QuestionFilled } from '@element-plus/icons-vue';
import { roundToDecimal, timeParse, calculateDuration } from '@/utils';
import { roundToDecimal, timeParse, calculateDuration, bytesToGB } from '@/utils';
import taskApi from '~/vgpu/api/task';
import BlockBox from '@/components/BlockBox.vue';
import Gauge from '~/vgpu/components/gauge.vue';
@ -164,11 +164,23 @@ const columns = [
value: 'type',
},
{
label: '可分配算力',
label: '分配CPU',
value: 'requestedCpuCores',
render: ({ requestedCpuCores }) => <span>{requestedCpuCores} </span>,
},
{
label: '分配内存',
value: 'requestedMemory',
render: ({ requestedMemory }) => <span>{bytesToGB(requestedMemory)} </span>,
},
{
label: '分配算力',
value: 'allocatedCores',
},
{
label: '可分配显存',
label: '分配显存',
value: 'allocatedMem',
render: ({ allocatedMem }) =>
allocatedMem ? (

@ -569,8 +569,11 @@ export const clearEdges = (items) =>
// 字节转GB
export const bytesToGB = (bytes) => {
if (bytes === '' || bytes === undefined || bytes === null) {
return '';
}
return Math.round(bytes / (1024 * 1024 * 1024));
}
};
export function parseUrl(url) {
const [pathname, queryString] = url.split('?');

Loading…
Cancel
Save