main
youys 4 days ago
commit 48732e31b3

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

@ -44,7 +44,7 @@
<Block v-for="{ title, dataSource } in rangeConfig" :title="title" :key="title">
<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>
<echarts-plus :options="getRangeOptions(dataSource)" style="height: 250px" />
</Block>

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

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

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

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

Loading…
Cancel
Save