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) { getDetailNodeList(data) {
return { return {
url: apiPrefix + '/v1/resource/pool/detail', url: apiPrefix + '/v1/resource/pool/detail',

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

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

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

Loading…
Cancel
Save