6437b6bf35
扩展NdmServerDiagInfo数据类型,新增网卡和IP信息字段,并在服务器诊断面板展示相关网络状态详情
64 lines
2.3 KiB
Vue
64 lines
2.3 KiB
Vue
<script setup lang="ts">
|
|
import { type NdmServerDiagInfo, type NdmServerResultVO, type Station } from '@/apis';
|
|
import { DeviceCommonCard, DeviceHardwareCard, DeviceHeaderCard, ServerAlive, ServerHighAvailable, ServerStreamPush, type DeviceCommonCardProps } from '@/components';
|
|
import destr from 'destr';
|
|
import { NFlex } from 'naive-ui';
|
|
import { computed, toRefs } from 'vue';
|
|
|
|
const props = defineProps<{
|
|
ndmDevice: NdmServerResultVO;
|
|
station: Station;
|
|
}>();
|
|
|
|
const { ndmDevice, station } = toRefs(props);
|
|
|
|
const lastDiagInfo = computed(() => {
|
|
const result = destr<any>(ndmDevice.value.lastDiagInfo);
|
|
if (!result) return null;
|
|
if (typeof result !== 'object') return null;
|
|
return result as NdmServerDiagInfo;
|
|
});
|
|
|
|
const commonInfo = computed<DeviceCommonCardProps['commonInfo']>(() => {
|
|
const { ipAddress } = ndmDevice.value;
|
|
const { ethInfo, ipInfo } = lastDiagInfo.value ?? {};
|
|
|
|
let operStatus = '-';
|
|
if (!!ethInfo?.operStatus) {
|
|
operStatus = ethInfo?.operStatus === '1' ? '正常' : '异常';
|
|
}
|
|
|
|
return [
|
|
{
|
|
title: '设备网卡信息',
|
|
items: [
|
|
{ label: 'IP地址', value: ipAddress || '-' },
|
|
{ label: '子网掩码', value: ipInfo?.mASK || '-' },
|
|
{ label: 'MAC地址', value: ethInfo?.macAddress || '-' },
|
|
{ label: '连接速率', value: ethInfo?.speed || '-' },
|
|
{ label: 'MTU', value: ethInfo?.mTU || '-' },
|
|
{ label: '运行状态', value: operStatus },
|
|
],
|
|
},
|
|
];
|
|
});
|
|
|
|
const cpuUsage = computed(() => lastDiagInfo.value?.commInfo?.CPU使用率);
|
|
const memUsage = computed(() => lastDiagInfo.value?.commInfo?.内存使用率);
|
|
const diskUsage = computed(() => lastDiagInfo.value?.commInfo?.磁盘使用率);
|
|
const runningTime = computed(() => lastDiagInfo.value?.commInfo?.系统运行时间);
|
|
</script>
|
|
|
|
<template>
|
|
<NFlex vertical>
|
|
<ServerHighAvailable :ndm-device="ndmDevice" :station="station" />
|
|
<DeviceHeaderCard :ndm-device="ndmDevice" :station="station" />
|
|
<DeviceCommonCard :common-info="commonInfo" />
|
|
<DeviceHardwareCard running-time-label="服务器运行时间" :cpu-usage="cpuUsage" :mem-usage="memUsage" :disk-usage="diskUsage" :running-time="runningTime" />
|
|
<ServerAlive :ndm-device="ndmDevice" :station="station" />
|
|
<ServerStreamPush :ndm-device="ndmDevice" :station="station" />
|
|
</NFlex>
|
|
</template>
|
|
|
|
<style scoped lang="scss"></style>
|