2024-10-11 16:46:08 +08:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { onMounted, ref } from 'vue';
|
2024-10-23 15:46:11 +08:00
|
|
|
import Info from '@/views/monitor/server/info.vue';
|
|
|
|
import { fetchSystemHealthList, fetchSystemInfo } from '@/api/v1/actuator';
|
2024-10-11 16:46:08 +08:00
|
|
|
import { $t } from '@/plugins/i18n';
|
2024-10-23 15:46:11 +08:00
|
|
|
import { svg } from '@/views/monitor/server/utils/columns';
|
|
|
|
import ListCard from '@/views/monitor/server/list-card.vue';
|
2024-10-11 16:46:08 +08:00
|
|
|
|
2024-10-23 15:46:11 +08:00
|
|
|
// 系统健康状态
|
2024-10-11 16:46:08 +08:00
|
|
|
const datalist = ref([]);
|
2024-10-23 15:46:11 +08:00
|
|
|
// 系统运行信息
|
|
|
|
const info = ref({ java: { vendor: {}, runtime: {}, jvm: {} }, os: {} });
|
2024-10-11 16:46:08 +08:00
|
|
|
const loading = ref(false);
|
|
|
|
|
|
|
|
/** 获取系统服务数据 */
|
|
|
|
const onSearch = async () => {
|
|
|
|
loading.value = true;
|
|
|
|
|
2024-10-23 15:46:11 +08:00
|
|
|
// 获取系统运行状态信息
|
2024-10-11 16:46:08 +08:00
|
|
|
const result = await fetchSystemHealthList();
|
|
|
|
datalist.value = Object.entries(result.components).map(([key, value]: any) => ({
|
|
|
|
type: key,
|
|
|
|
key: `${key}`,
|
|
|
|
status: value.status === 'UP',
|
|
|
|
details: value.details && Object.entries(value.details).map(([key, value]: any) => ({ key, value })),
|
|
|
|
}));
|
|
|
|
|
2024-10-23 15:46:11 +08:00
|
|
|
// 系统信息
|
|
|
|
info.value = await fetchSystemInfo();
|
|
|
|
|
2024-10-11 16:46:08 +08:00
|
|
|
loading.value = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
onSearch();
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div v-loading="loading" :element-loading-svg="svg" element-loading-svg-view-box="-10, -10, 50, 50">
|
2024-10-23 15:46:11 +08:00
|
|
|
<el-empty v-if="false" :description="$t('no_server')" />
|
|
|
|
|
2024-10-11 16:46:08 +08:00
|
|
|
<el-row :gutter="16">
|
2024-10-23 15:46:11 +08:00
|
|
|
<info v-if="info.java.jvm" :info="info" />
|
2024-10-11 16:46:08 +08:00
|
|
|
<el-col v-for="(product, index) in datalist" :key="index" :lg="6" :md="8" :sm="12" :xl="4" :xs="24">
|
|
|
|
<ListCard :product="product" />
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</div>
|
|
|
|
</template>
|