update code
parent
707b181c17
commit
e77b7c344a
|
@ -0,0 +1,54 @@
|
||||||
|
import request from "@/utils/request";
|
||||||
|
const list=(pageSize,pageIndex)=>{
|
||||||
|
return request({
|
||||||
|
url: `/connections?page_num=${pageIndex}&page_size=${pageSize}`,
|
||||||
|
method: "get"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const add=(data)=>{
|
||||||
|
return request({
|
||||||
|
url: `/connections`,
|
||||||
|
method: "post",
|
||||||
|
data:data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const deleteConnect=(id)=>{
|
||||||
|
return request({
|
||||||
|
url: `/connections/${id}`,
|
||||||
|
method: "delete"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const detail=(id)=>{
|
||||||
|
return request({
|
||||||
|
url: `/connections/${id}`,
|
||||||
|
method: "get"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const updatAll=(id,data)=>{
|
||||||
|
return request({
|
||||||
|
url: `/connections/${id}/all`,
|
||||||
|
method: "put",
|
||||||
|
data:data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateInfo=(id,data)=>{
|
||||||
|
return request({
|
||||||
|
url: `/connections/${id}/info`,
|
||||||
|
method: "put",
|
||||||
|
data:data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
list,
|
||||||
|
add,
|
||||||
|
deleteConnect,
|
||||||
|
detail,
|
||||||
|
updatAll,
|
||||||
|
updateInfo
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
import request from "@/utils/request";
|
||||||
|
const serverState=()=>{
|
||||||
|
return request({
|
||||||
|
url: "/logs/server_state",
|
||||||
|
method: "get"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
serverState
|
||||||
|
}
|
|
@ -1,29 +1,29 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="service-status">
|
<div class="service-status">
|
||||||
<div class="sv-chart">
|
<div class="sv-chart" >
|
||||||
<div :id="id" :class="className" :style="{ height, width }">
|
<div :id="id" :class="className" :style="{ height, width }">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="chart-title">内核温度</div>
|
<div class="chart-title">内核温度</div>
|
||||||
<div class="chart-bars">
|
<div class="chart-bars" v-if="serverInfo">
|
||||||
<div class="chart-bar">
|
<div class="chart-bar">
|
||||||
<div class="bar-title">内存</div>
|
<div class="bar-title">内存</div>
|
||||||
<div class="chart-line">
|
<div class="chart-line">
|
||||||
<div class="chart-line-inner" style="width:75%"></div>
|
<div class="chart-line-inner" :style="'width:'+serverInfo.memory_usage*100.0/16.0/1024.0+'%'"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="bar-title">75%</div>
|
<div class="bar-title">75%</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="chart-bar">
|
<div class="chart-bar">
|
||||||
<div class="bar-title">CPU</div>
|
<div class="bar-title">CPU</div>
|
||||||
<div class="chart-line">
|
<div class="chart-line">
|
||||||
<div class="chart-line-inner" style="width:45%"></div>
|
<div class="chart-line-inner" :style="'width:'+serverInfo.cpu_usage+'%'"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="bar-title">45%</div>
|
<div class="bar-title">45%</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="chart-bar">
|
<div class="chart-bar">
|
||||||
<div class="bar-title">硬盘</div>
|
<div class="bar-title">硬盘</div>
|
||||||
<div class="chart-line">
|
<div class="chart-line">
|
||||||
<div class="chart-line-inner" style="width:65%"></div>
|
<div class="chart-line-inner" :style="'width:'+serverInfo.storage_usage+'%'"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="bar-title">65%</div>
|
<div class="bar-title">65%</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -33,6 +33,9 @@
|
||||||
|
|
||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
import * as echarts from "echarts";
|
import * as echarts from "echarts";
|
||||||
|
import LogApi from '@/api/log'
|
||||||
|
let tempurature=ref<any>(0);
|
||||||
|
let serverInfo=ref<any>(null);
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -51,15 +54,10 @@ const props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: "200px",
|
default: "200px",
|
||||||
required: true,
|
required: true,
|
||||||
},
|
}
|
||||||
val: {
|
|
||||||
type: Number,
|
|
||||||
default: 77.5,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const options = {
|
let options = reactive( {
|
||||||
grid: {
|
grid: {
|
||||||
left: "20%",
|
left: "20%",
|
||||||
right: "20%",
|
right: "20%",
|
||||||
|
@ -130,13 +128,20 @@ const options = {
|
||||||
},
|
},
|
||||||
data: [
|
data: [
|
||||||
{
|
{
|
||||||
value: props.val
|
value: tempurature.value
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
});
|
||||||
|
const loadLog=()=>{
|
||||||
|
LogApi.serverState().then(d=>{
|
||||||
|
serverInfo.value=d.data.data
|
||||||
|
tempurature.value=serverInfo.value.tempurature/10.0;
|
||||||
|
options.series[0].data[0].value=tempurature.value;
|
||||||
|
chart.value.setOption(options);
|
||||||
|
});
|
||||||
|
}
|
||||||
const chart = ref<any>("");
|
const chart = ref<any>("");
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 图表初始化
|
// 图表初始化
|
||||||
|
@ -150,6 +155,7 @@ onMounted(() => {
|
||||||
window.addEventListener("resize", () => {
|
window.addEventListener("resize", () => {
|
||||||
chart.value.resize();
|
chart.value.resize();
|
||||||
});
|
});
|
||||||
|
loadLog();
|
||||||
});
|
});
|
||||||
|
|
||||||
onActivated(() => {
|
onActivated(() => {
|
||||||
|
|
|
@ -114,7 +114,6 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive } from 'vue'
|
|
||||||
import ModelFlow from './components/ModelFlow.vue'
|
import ModelFlow from './components/ModelFlow.vue'
|
||||||
import IndexNotice from './components/IndexNotice.vue'
|
import IndexNotice from './components/IndexNotice.vue'
|
||||||
import ServiceStatus from './components/ServiceStatus.vue'
|
import ServiceStatus from './components/ServiceStatus.vue'
|
||||||
|
@ -125,24 +124,8 @@ let svTemp = ref(55.5)
|
||||||
let rd = () => { return +("" + Math.random()).substring(3, 5) };
|
let rd = () => { return +("" + Math.random()).substring(3, 5) };
|
||||||
let rd2 = () => { return +("" + Math.random()).substring(3, 4) };
|
let rd2 = () => { return +("" + Math.random()).substring(3, 4) };
|
||||||
let topInfos = ref<any>(null);
|
let topInfos = ref<any>(null);
|
||||||
|
let devInfos = ref<any>(null);
|
||||||
|
|
||||||
|
|
||||||
let devInfos = ref<any>(null)
|
|
||||||
/*
|
|
||||||
[
|
|
||||||
{ id: 1001, name: '设备名称1', netType: 'network001', modelName: '模型名称', state: 'offline', temperature: rd(), memory: rd(), cpu: rd() },
|
|
||||||
{ id: 1002, name: '设备名称2', netType: 'network001', modelName: '模型名称', state: 'compile', temperature: rd(), memory: rd(), cpu: rd() },
|
|
||||||
{ id: 1003, name: '设备名称3', netType: 'network001', modelName: '模型名称', state: 'free', temperature: rd(), memory: rd(), cpu: rd() },
|
|
||||||
{ id: 1004, name: '设备名称4', netType: 'network001', modelName: '模型名称', state: 'inferencing', temperature: rd(), memory: rd(), cpu: rd() },
|
|
||||||
{ id: 1005, name: '设备名称5', netType: 'network001', modelName: '模型名称', state: 'noreg', temperature: rd(), memory: rd(), cpu: rd() },
|
|
||||||
{ id: 1006, name: '设备名称6', netType: 'network001', modelName: '模型名称', state: 'publish', temperature: rd(), memory: rd(), cpu: rd() },
|
|
||||||
{ id: 1007, name: '设备名称1', netType: 'network001', modelName: '模型名称', state: 'training', temperature: rd(), memory: rd(), cpu: rd() },
|
|
||||||
{ id: 1008, name: '设备名称2', netType: 'network001', modelName: '模型名称', state: 'updating', temperature: rd(), memory: rd(), cpu: rd() },
|
|
||||||
{ id: 1009, name: '设备名称3', netType: 'network001', modelName: '模型名称', state: 'offline', temperature: rd(), memory: rd(), cpu: rd() },
|
|
||||||
{ id: 1010, name: '设备名称4', netType: 'network001', modelName: '模型名称', state: 'training', temperature: rd(), memory: rd(), cpu: rd() },
|
|
||||||
{ id: 1011, name: '设备名称5', netType: 'network001', modelName: '模型名称', state: 'training', temperature: rd(), memory: rd(), cpu: rd() },
|
|
||||||
{ id: 1012, name: '设备名称6', netType: 'network001', modelName: '模型名称', state: 'training', temperature: rd(), memory: rd(), cpu: rd() },
|
|
||||||
]*/
|
|
||||||
const winWidth = ref(0)
|
const winWidth = ref(0)
|
||||||
const isSmallScreen = computed(() => {
|
const isSmallScreen = computed(() => {
|
||||||
return winWidth.value < 1440;
|
return winWidth.value < 1440;
|
||||||
|
@ -172,16 +155,12 @@ const getState = (e: any) => {
|
||||||
|
|
||||||
return "升级中";
|
return "升级中";
|
||||||
}
|
}
|
||||||
onMounted(() => {
|
const loadDevice=()=>{
|
||||||
winWidth.value = window.outerWidth;
|
|
||||||
window.onresize = () => {
|
|
||||||
setTimeout(() => {
|
|
||||||
winWidth.value = window.outerWidth;
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
DeviceAPI.getStatus().then(d => {
|
DeviceAPI.getStatus().then(d => {
|
||||||
devInfos.value=d.data.data.device_status_list||[];
|
devInfos.value=d.data.data.device_status_list||[];
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
const loadInfo=()=>{
|
||||||
InfoApi.statistics().then(d => {
|
InfoApi.statistics().then(d => {
|
||||||
topInfos.value = [
|
topInfos.value = [
|
||||||
{ title: '模型总数', count: d.data.total_model_count, ucnt: d.data.user_model_count, clsName: 'c1', icon: "images/nav/nav1.png" },
|
{ title: '模型总数', count: d.data.total_model_count, ucnt: d.data.user_model_count, clsName: 'c1', icon: "images/nav/nav1.png" },
|
||||||
|
@ -193,6 +172,17 @@ onMounted(() => {
|
||||||
];
|
];
|
||||||
|
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
onMounted(() => {
|
||||||
|
winWidth.value = window.outerWidth;
|
||||||
|
window.onresize = () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
winWidth.value = window.outerWidth;
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
loadDevice();
|
||||||
|
loadInfo();
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -132,42 +132,42 @@
|
||||||
let devInfos = reactive([
|
let devInfos = reactive([
|
||||||
{ id: 1001, name: 'NPU-TC-01', netType: 'network001', modelName: 'N/A', state: 'offline', temperature: '31', memory: rd3(), cpu: rd3(), },
|
{ id: 1001, name: 'NPU-TC-01', netType: 'network001', modelName: 'N/A', state: 'offline', temperature: '31', memory: rd3(), cpu: rd3(), },
|
||||||
{ id: 1002, name: 'GPU-B101', netType: 'network001', modelName: 'N/A', state: 'compile', temperature: '46', memory: rd3(), cpu: rd3(), },
|
{ id: 1002, name: 'GPU-B101', netType: 'network001', modelName: 'N/A', state: 'compile', temperature: '46', memory: rd3(), cpu: rd3(), },
|
||||||
{ id: 1003, name: 'CPU-SW-02', netType: 'network001', modelName: 'N/A', state: 'free', temperature: '37', memory: rd3(), cpu: rd3(), },
|
{ id: 1003, name: 'CPU-SW-02', netType: 'network001', modelName: 'N/A', state: 'idle', temperature: '37', memory: rd3(), cpu: rd3(), },
|
||||||
{ id: 1004, name: 'CPU-SW-01', netType: 'network001', modelName: 'pagerank_01', state: 'inferencing', temperature: '34', memory: rd3(), cpu: rd3(), },
|
{ id: 1004, name: 'CPU-SW-01', netType: 'network001', modelName: 'pagerank_01', state: 'infer', temperature: '34', memory: rd3(), cpu: rd3(), },
|
||||||
{ id: 1005, name: 'FPGA-FD-01', netType: 'network001', modelName: 'Obj_detect_01', state: 'noreg', temperature: '42', memory: rd3(), cpu: rd3(), },
|
{ id: 1005, name: 'FPGA-FD-01', netType: 'network001', modelName: 'Obj_detect_01', state: 'unregist', temperature: '42', memory: rd3(), cpu: rd3(), },
|
||||||
{ id: 1006, name: 'GPU-MR-01', netType: 'network001', modelName: 'llm_01', state: 'publish', temperature: '40', memory: rd3(), cpu: rd3(), },
|
{ id: 1006, name: 'GPU-MR-01', netType: 'network001', modelName: 'llm_01', state: 'download', temperature: '40', memory: rd3(), cpu: rd3(), },
|
||||||
{ id: 1007, name: 'FPGA-FD-02', netType: 'network001', modelName: 'Obj_detect_01', state: 'training', temperature: '39', memory: rd3(), cpu: rd3(), },
|
{ id: 1007, name: 'FPGA-FD-02', netType: 'network001', modelName: 'Obj_detect_01', state: 'train', temperature: '39', memory: rd3(), cpu: rd3(), },
|
||||||
{ id: 1008, name: 'CPU-SW-03', netType: 'network001', modelName: 'pagerank_01', state: 'updating',temperature: '38', memory: rd3(), cpu: rd3(), },
|
{ id: 1008, name: 'CPU-SW-03', netType: 'network001', modelName: 'pagerank_01', state: 'upgrade',temperature: '38', memory: rd3(), cpu: rd3(), },
|
||||||
])
|
])
|
||||||
const winWidth=ref(0)
|
const winWidth=ref(0)
|
||||||
const isSmallScreen=computed(()=>{
|
const isSmallScreen=computed(()=>{
|
||||||
return winWidth.value<1440;
|
return winWidth.value<1440;
|
||||||
});
|
});
|
||||||
const getState=(e:any)=>{
|
const getState = (e: any) => {
|
||||||
if(e=="offline"){
|
if (e == "offline") {
|
||||||
return "离线";
|
return "离线";
|
||||||
}
|
|
||||||
if(e=="compile"){
|
|
||||||
return "编译中";
|
|
||||||
}
|
|
||||||
if(e=="free"){
|
|
||||||
return "空闲";
|
|
||||||
}
|
|
||||||
if(e=="inferencing"){
|
|
||||||
return "推理中";
|
|
||||||
}
|
|
||||||
if(e=="noreg"){
|
|
||||||
return "未注册";
|
|
||||||
}
|
|
||||||
if(e=="publish"){
|
|
||||||
return "部署中";
|
|
||||||
}
|
|
||||||
if(e=="training"){
|
|
||||||
return "训练中";
|
|
||||||
}
|
|
||||||
|
|
||||||
return "升级中";
|
|
||||||
}
|
}
|
||||||
|
if (e == "compile") {
|
||||||
|
return "编译中";
|
||||||
|
}
|
||||||
|
if (e == "idle") {
|
||||||
|
return "空闲";
|
||||||
|
}
|
||||||
|
if (e == "infer") {
|
||||||
|
return "推理中";
|
||||||
|
}
|
||||||
|
if (e == "unregist") {
|
||||||
|
return "未注册";
|
||||||
|
}
|
||||||
|
if (e == "download") {
|
||||||
|
return "部署中";
|
||||||
|
}
|
||||||
|
if (e == "train") {
|
||||||
|
return "训练中";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "升级中";
|
||||||
|
}
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
winWidth.value=window.outerWidth;
|
winWidth.value=window.outerWidth;
|
||||||
window.onresize=()=>{
|
window.onresize=()=>{
|
||||||
|
|
|
@ -40,7 +40,7 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
|
||||||
"@": pathSrc,
|
"@": pathSrc,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
base: "/ai",
|
base: "/ai/",
|
||||||
css: {
|
css: {
|
||||||
// CSS 预处理器
|
// CSS 预处理器
|
||||||
preprocessorOptions: {
|
preprocessorOptions: {
|
||||||
|
|
Loading…
Reference in New Issue