main
youys 4 days ago
commit 48732e31b3

@ -57,20 +57,20 @@ const echartsRef = ref();
const totalTop = { const totalTop = {
title: `${props.title}资源分配率 Top5`, title: `${props.title}资源分配率 Top5`,
config: [ config: [
props.type === 'node' && { // props.type === 'node' && {
tab: 'CPU', // tab: 'CPU',
key: 'cpu', // key: 'cpu',
nameKey: 'instance', // nameKey: 'instance',
data: [], // data: [],
query: `topk(5, sum(hami_container_vcore_allocated) by (instance) / sum(hami_core_size) by (instance) * 100)`, // query: `topk(5, sum(hami_container_vcore_allocated) by (instance) / sum(hami_core_size) by (instance) * 100)`,
}, // },
props.type === 'node' && { // props.type === 'node' && {
tab: '内存', // tab: '',
key: 'internal', // key: 'internal',
nameKey: 'instance', // nameKey: 'instance',
data: [], // data: [],
query: `topk(5, sum(hami_container_vmemory_allocated) by (instance) / sum(hami_memory_size) by (instance) * 100)`, // query: `topk(5, sum(hami_container_vmemory_allocated) by (instance) / sum(hami_memory_size) by (instance) * 100)`,
}, // },
{ {
tab: 'vGPU', tab: 'vGPU',
key: 'vgpu', key: 'vgpu',

@ -44,7 +44,7 @@
<Block v-for="{ title, dataSource } in rangeConfig" :title="title" :key="title"> <Block v-for="{ title, dataSource } in rangeConfig" :title="title" :key="title">
<template #extra> <template #extra>
<time-picker v-model="times" type="datetimerange" size="small" /> <time-picker v-model="times" type="datetimerange" size="small" :key="`time-picker-${title}`" />
</template> </template>
<echarts-plus :options="getRangeOptions(dataSource)" style="height: 250px" /> <echarts-plus :options="getRangeOptions(dataSource)" style="height: 250px" />
</Block> </Block>

@ -342,19 +342,19 @@ const detailColumns = [
}, },
{ {
label: 'CPU大小', label: 'CPU大小',
value: 'coreTotal', value: 'cpuCores',
render: ({ coreTotal }) => ( render: ({ cpuCores }) => (
<span> <span>
{`${coreTotal}`} {`${cpuCores}`}
</span> </span>
), ),
}, },
{ {
label: '内存大小', label: '内存大小',
value: 'memoryTotal', value: 'totalMemory',
render: ({ memoryTotal }) => ( render: ({ totalMemory }) => (
<span> <span>
{`${bytesToGB(memoryTotal)}GiB`} {`${bytesToGB(totalMemory)}GiB`}
</span> </span>
), ),
}, },

@ -158,13 +158,13 @@ const columns = [
}, },
{ {
title: 'CPU', title: 'CPU',
dataIndex: 'coreTotal', dataIndex: 'cpuCores',
render: ({ coreTotal }) => `${coreTotal}`, render: ({ cpuCores }) => `${cpuCores}`,
}, },
{ {
title: '内存', title: '内存',
dataIndex: 'memoryTotal', dataIndex: 'totalMemory',
render: ({ memoryTotal }) => `${bytesToGB(memoryTotal)}GiB`, render: ({ totalMemory }) => `${bytesToGB(totalMemory)}GiB`,
}, },
{ {
title: '磁盘', title: '磁盘',

@ -81,13 +81,13 @@ const columns = [
}, },
{ {
title: 'CPU', title: 'CPU',
dataIndex: 'coreTotal', dataIndex: 'cpuCores',
render: ({ coreTotal }) => `${coreTotal}`, render: ({ cpuCores }) => `${cpuCores}`,
}, },
{ {
title: '内存', title: '内存',
dataIndex: 'memoryTotal', dataIndex: 'totalMemory',
render: ({ memoryTotal }) => `${bytesToGB(memoryTotal)}GiB`, render: ({ totalMemory }) => `${bytesToGB(totalMemory)}GiB`,
}, },
{ {
title: '磁盘', title: '磁盘',

@ -8,6 +8,8 @@
end-placeholder="结束时间" end-placeholder="结束时间"
unlink-panels unlink-panels
:shortcuts="type.includes('range') && shortcuts" :shortcuts="type.includes('range') && shortcuts"
:teleported="false"
:append-to-body="false"
class="date-picker" class="date-picker"
:disabled-date="disabledDate" :disabled-date="disabledDate"
@visible-change="onVisibleChange" @visible-change="onVisibleChange"
@ -18,7 +20,7 @@
<script setup lang="jsx"> <script setup lang="jsx">
import { computed, defineProps, defineEmits, ref } from 'vue'; import { computed, defineProps, defineEmits, ref } from 'vue';
// Props Emits // props emits
const props = defineProps({ const props = defineProps({
modelValue: {}, modelValue: {},
type: { type: String, default: 'date' }, type: { type: String, default: 'date' },
@ -26,16 +28,16 @@ const props = defineProps({
}); });
const emits = defineEmits(['update:modelValue']); const emits = defineEmits(['update:modelValue']);
// picker // ref
const pickerRef = ref(); const pickerRef = ref();
const visible = ref(false); const visible = ref(false);
// //
const onVisibleChange = (val) => { const onVisibleChange = (val) => {
visible.value = val; visible.value = val;
}; };
// //
const value = computed({ const value = computed({
get() { get() {
return props.modelValue; return props.modelValue;
@ -45,7 +47,7 @@ const value = computed({
}, },
}); });
// //
function genShortcut(text, hoursAgo) { function genShortcut(text, hoursAgo) {
return { return {
text, text,
@ -53,7 +55,7 @@ function genShortcut(text, hoursAgo) {
const end = new Date(); const end = new Date();
const start = new Date(end.getTime() - hoursAgo * 3600 * 1000); const start = new Date(end.getTime() - hoursAgo * 3600 * 1000);
// time-picker //
setTimeout(() => { setTimeout(() => {
if (visible.value) { if (visible.value) {
pickerRef.value?.handleClose?.(); pickerRef.value?.handleClose?.();
@ -65,7 +67,7 @@ function genShortcut(text, hoursAgo) {
}; };
} }
// //
const shortcuts = [ const shortcuts = [
genShortcut('前 1 小时', 1), genShortcut('前 1 小时', 1),
genShortcut('前 6 小时', 6), genShortcut('前 6 小时', 6),
@ -76,7 +78,7 @@ const shortcuts = [
genShortcut('前 1 周', 168), genShortcut('前 1 周', 168),
]; ];
// //
const disabledDate = (time) => { const disabledDate = (time) => {
return time.getTime() >= Date.now(); return time.getTime() >= Date.now();
}; };

Loading…
Cancel
Save