首页改造完成,待添加系统信息
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
<div id="app" style="width: 100%">
|
||||
<div class="page-header">
|
||||
<div class="page-title">控制台</div>
|
||||
<div class="page-header-btn">
|
||||
<el-button icon="el-icon-info" size="mini" style="margin-right: 1rem;" type="primary" @click="showInfo">平台信息
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-row style="width: 100%">
|
||||
<el-col :xl="{ span: 8 }" :lg="{ span: 8 }" :md="{ span: 12 }" :sm="{ span: 12 }" :xs="{ span: 24 }" >
|
||||
@@ -14,7 +18,7 @@
|
||||
<el-col :xl="{ span: 8 }" :lg="{ span: 8 }" :md="{ span: 12 }" :sm="{ span: 12 }" :xs="{ span: 24 }" >
|
||||
<div class="control-cell" id="WorkThreadsLoad" >
|
||||
<div style="width:100%; height:100%; ">
|
||||
<consoleMem ref="consoleMem"></consoleMem>
|
||||
<consoleResource ref="consoleResource"></consoleResource>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
@@ -28,26 +32,25 @@
|
||||
<el-col :xl="{ span: 8 }" :lg="{ span: 8 }" :md="{ span: 12 }" :sm="{ span: 12 }" :xs="{ span: 24 }" >
|
||||
<div class="control-cell" id="WorkThreadsLoad" >
|
||||
<div style="width:100%; height:100%; ">
|
||||
<consoleCPU></consoleCPU>
|
||||
|
||||
<consoleMem ref="consoleMem"></consoleMem>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :xl="{ span: 8 }" :lg="{ span: 8 }" :md="{ span: 12 }" :sm="{ span: 12 }" :xs="{ span: 24 }" >
|
||||
<div class="control-cell" id="WorkThreadsLoad" >
|
||||
<div style="width:100%; height:100%; ">
|
||||
<consoleCPU></consoleCPU>
|
||||
<consoleNodeLoad ref="consoleNodeLoad"></consoleNodeLoad>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :xl="{ span: 8 }" :lg="{ span: 8 }" :md="{ span: 12 }" :sm="{ span: 12 }" :xs="{ span: 24 }" >
|
||||
<div class="control-cell" id="WorkThreadsLoad" >
|
||||
<div style="width:100%; height:100%; ">
|
||||
<consoleCPU></consoleCPU>
|
||||
<consoleDisk ref="consoleDisk"></consoleDisk>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
|
||||
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
@@ -57,6 +60,9 @@ import uiHeader from '../layout/UiHeader.vue'
|
||||
import consoleCPU from './console/ConsoleCPU.vue'
|
||||
import consoleMem from './console/ConsoleMEM.vue'
|
||||
import consoleNet from './console/ConsoleNet.vue'
|
||||
import consoleNodeLoad from './console/ConsoleNodeLoad.vue'
|
||||
import consoleDisk from './console/ConsoleDisk.vue'
|
||||
import consoleResource from './console/ConsoleResource.vue'
|
||||
|
||||
import echarts from 'echarts';
|
||||
|
||||
@@ -67,7 +73,10 @@ export default {
|
||||
uiHeader,
|
||||
consoleCPU,
|
||||
consoleMem,
|
||||
consoleNet
|
||||
consoleNet,
|
||||
consoleNodeLoad,
|
||||
consoleDisk,
|
||||
consoleResource,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -76,7 +85,10 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.getSystemInfo();
|
||||
this.getLoad();
|
||||
this.getResourceInfo();
|
||||
this.loopForSystemInfo();
|
||||
|
||||
},
|
||||
destroyed() {
|
||||
},
|
||||
@@ -87,8 +99,10 @@ export default {
|
||||
}
|
||||
this.timer = setTimeout(()=>{
|
||||
this.getSystemInfo();
|
||||
this.getLoad();
|
||||
this.timer = null;
|
||||
this.loopForSystemInfo()
|
||||
this.getResourceInfo()
|
||||
}, 2000)
|
||||
},
|
||||
getSystemInfo: function (){
|
||||
@@ -99,11 +113,38 @@ export default {
|
||||
if (res.data.code === 0) {
|
||||
this.$refs.consoleCPU.setData(res.data.data.cpu)
|
||||
this.$refs.consoleMem.setData(res.data.data.mem)
|
||||
this.$refs.consoleNet.setData(res.data.data.net)
|
||||
this.$refs.consoleNet.setData(res.data.data.net, res.data.data.netTotal)
|
||||
this.$refs.consoleDisk.setData(res.data.data.disk)
|
||||
}
|
||||
}).catch( (error)=> {
|
||||
});
|
||||
},
|
||||
getLoad: function (){
|
||||
this.$axios({
|
||||
method: 'get',
|
||||
url: `/api/server/media_server/load`,
|
||||
}).then( (res)=> {
|
||||
if (res.data.code === 0) {
|
||||
this.$refs.consoleNodeLoad.setData(res.data.data)
|
||||
}
|
||||
}).catch( (error)=> {
|
||||
});
|
||||
},
|
||||
getResourceInfo: function (){
|
||||
this.$axios({
|
||||
method: 'get',
|
||||
url: `/api/server/resource/info`,
|
||||
}).then( (res)=> {
|
||||
if (res.data.code === 0) {
|
||||
this.$refs.consoleResource.setData(res.data.data)
|
||||
}
|
||||
}).catch( (error)=> {
|
||||
});
|
||||
},
|
||||
showInfo: function (){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div id="consoleCPU" style="width: 100%; height: 100%; background: #FFFFFF; text-align: center">
|
||||
<ve-line :data="chartData" :extend="extend" width="100%" height="100%" :legend-visible="false"></ve-line>
|
||||
<ve-line ref="consoleCPU" :data="chartData" :extend="extend" width="100%" height="100%" :legend-visible="false"></ve-line>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -59,7 +59,8 @@ export default {
|
||||
trigger: 'axis',
|
||||
formatter: (data)=>{
|
||||
console.log(data)
|
||||
return moment(data[0].data[0]).format("HH:mm:ss") + "</br> 使用:" + (data[0].data[1]*100).toFixed(2) + "%";
|
||||
return moment(data[0].data[0]).format("HH:mm:ss") + "</br> "
|
||||
+ data[0].marker + "使用:" + (data[0].data[1]*100).toFixed(2) + "%";
|
||||
}
|
||||
},
|
||||
series: {
|
||||
@@ -84,14 +85,17 @@ export default {
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
||||
|
||||
},
|
||||
mounted() {
|
||||
// setInterval(()=>{
|
||||
// // console.log(111111)
|
||||
// for (let i = 0; i < this.chartData.rows.length; i++) {
|
||||
// this.chartData.rows[i].销售额 += 1000;
|
||||
// }
|
||||
// },1000)
|
||||
this.$nextTick(_ => {
|
||||
setTimeout(()=>{
|
||||
this.$refs.consoleCPU.echarts.resize()
|
||||
}, 100)
|
||||
})
|
||||
},
|
||||
destroyed() {
|
||||
},
|
||||
|
||||
81
web_src/src/components/console/ConsoleDisk.vue
Normal file
81
web_src/src/components/console/ConsoleDisk.vue
Normal file
@@ -0,0 +1,81 @@
|
||||
<template>
|
||||
<div id="ConsoleNet" style="width: 100%; height: 100%; background: #FFFFFF; text-align: center">
|
||||
<ve-bar ref="ConsoleNet" :data="chartData" :extend="extend" :settings="chartSettings" width="100%" height="100%" ></ve-bar>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
import moment from "moment/moment";
|
||||
|
||||
export default {
|
||||
name: 'ConsoleNet',
|
||||
data() {
|
||||
return {
|
||||
chartData: {
|
||||
columns: ['path','free','use'],
|
||||
rows: []
|
||||
},
|
||||
chartSettings: {
|
||||
stack: {
|
||||
'xxx': ['free', 'use']
|
||||
},
|
||||
labelMap: {
|
||||
'free': '剩余',
|
||||
'use': '已使用'
|
||||
},
|
||||
},
|
||||
extend: {
|
||||
title: {
|
||||
show: true,
|
||||
text: "磁盘",
|
||||
left: "center",
|
||||
top: 20,
|
||||
},
|
||||
grid: {
|
||||
show: true,
|
||||
right: "30px",
|
||||
containLabel: true,
|
||||
},
|
||||
series: {
|
||||
barWidth: 30
|
||||
},
|
||||
legend: {
|
||||
left: "center",
|
||||
bottom: "15px",
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
formatter: (data)=>{
|
||||
console.log(data)
|
||||
let relVal = "";
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
relVal += data[i].marker + data[i].seriesName + ":" + data[i].value.toFixed(2) + "GB"
|
||||
if (i < data.length - 1) {
|
||||
relVal += "</br>";
|
||||
}
|
||||
}
|
||||
return relVal;
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(_ => {
|
||||
setTimeout(()=>{
|
||||
this.$refs.ConsoleNet.echarts.resize()
|
||||
}, 100)
|
||||
})
|
||||
},
|
||||
destroyed() {
|
||||
},
|
||||
methods: {
|
||||
setData: function(data) {
|
||||
this.chartData.rows = data;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div id="ConsoleMEM" style="width: 100%; height: 100%; background: #FFFFFF; text-align: center">
|
||||
<ve-line :data="chartData" :extend="extend" width="100%" height="100%" :legend-visible="false"></ve-line>
|
||||
<ve-line ref="ConsoleMEM" :data="chartData" :extend="extend" width="100%" height="100%" :legend-visible="false"></ve-line>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -59,7 +59,7 @@ export default {
|
||||
trigger: 'axis',
|
||||
formatter: (data)=>{
|
||||
console.log(data)
|
||||
return moment(data[0].data[0]).format("HH:mm:ss") + "</br> 使用:" + (data[0].data[1]*100).toFixed(2) + "%";
|
||||
return moment(data[0].data[0]).format("HH:mm:ss") + "</br>"+ data[0].marker +" 使用:" + (data[0].data[1]*100).toFixed(2) + "%";
|
||||
}
|
||||
},
|
||||
series: {
|
||||
@@ -86,12 +86,11 @@ export default {
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
// setInterval(()=>{
|
||||
// // console.log(111111)
|
||||
// for (let i = 0; i < this.chartData.rows.length; i++) {
|
||||
// this.chartData.rows[i].销售额 += 1000;
|
||||
// }
|
||||
// },1000)
|
||||
this.$nextTick(_ => {
|
||||
setTimeout(()=>{
|
||||
this.$refs.ConsoleMEM.echarts.resize()
|
||||
}, 100)
|
||||
})
|
||||
},
|
||||
destroyed() {
|
||||
},
|
||||
@@ -99,7 +98,6 @@ export default {
|
||||
setData: function(data) {
|
||||
this.chartData .rows = data;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div id="ConsoleMediaServer" style="width: 100%; height: 100%; background: #FFFFFF; text-align: center">
|
||||
<ve-histogram :data="chartData" :extend="extend" :settings="chartSettings" width="100%" height="100%" ></ve-histogram>
|
||||
<ve-histogram ref="ConsoleMEM" :data="chartData" :extend="extend" :settings="chartSettings" width="100%" height="100%" ></ve-histogram>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -66,12 +66,11 @@ export default {
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
// setInterval(()=>{
|
||||
// // console.log(111111)
|
||||
// for (let i = 0; i < this.chartData.rows.length; i++) {
|
||||
// this.chartData.rows[i].销售额 += 1000;
|
||||
// }
|
||||
// },1000)
|
||||
this.$nextTick(_ => {
|
||||
setTimeout(()=>{
|
||||
this.$refs.ConsoleMEM.echarts.resize()
|
||||
}, 100)
|
||||
})
|
||||
},
|
||||
destroyed() {
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div id="ConsoleNet" style="width: 100%; height: 100%; background: #FFFFFF; text-align: center">
|
||||
<ve-line :data="chartData" :extend="extend" :settings="chartSettings" width="100%" height="100%" ></ve-line>
|
||||
<ve-line ref="ConsoleNet" :data="chartData" :extend="extend" :settings="chartSettings" width="100%" height="100%" ></ve-line>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -14,7 +14,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
chartData: {
|
||||
columns: ['time', 'in', 'out'],
|
||||
columns: ['time','out','in'],
|
||||
rows: []
|
||||
},
|
||||
chartSettings: {
|
||||
@@ -48,13 +48,18 @@ export default {
|
||||
showMaxLabel: true,
|
||||
},
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
min: 0,
|
||||
max: 1000,
|
||||
splitNumber: 6,
|
||||
position: "left",
|
||||
silent: true,
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
formatter: (data)=>{
|
||||
console.log(parseFloat(data[0].data[1]).toFixed(2))
|
||||
console.log(parseFloat(data[1].data[1]).toFixed(2))
|
||||
console.log("############")
|
||||
return "下载:" + parseFloat(data[0].data[1]).toFixed(2) + "Mbps" + "</br> 上传:" + parseFloat(data[1].data[1]).toFixed(2) + "Mbps";
|
||||
return data[1].marker + "下载:" + parseFloat(data[1].data[1]).toFixed(2) + "Mbps" + "</br> "+ data[0].marker +" 上传:" + parseFloat(data[0].data[1]).toFixed(2) + "Mbps";
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
@@ -65,19 +70,18 @@ export default {
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
// setInterval(()=>{
|
||||
// // console.log(111111)
|
||||
// for (let i = 0; i < this.chartData.rows.length; i++) {
|
||||
// this.chartData.rows[i].销售额 += 1000;
|
||||
// }
|
||||
// },1000)
|
||||
this.$nextTick(_ => {
|
||||
setTimeout(()=>{
|
||||
this.$refs.ConsoleNet.echarts.resize()
|
||||
}, 100)
|
||||
})
|
||||
},
|
||||
destroyed() {
|
||||
},
|
||||
methods: {
|
||||
setData: function(data) {
|
||||
console.log(data)
|
||||
setData: function(data, total) {
|
||||
this.chartData .rows = data;
|
||||
this.extend.yAxis.max= total;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
63
web_src/src/components/console/ConsoleNodeLoad.vue
Normal file
63
web_src/src/components/console/ConsoleNodeLoad.vue
Normal file
@@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<div id="ConsoleNodeLoad" style="width: 100%; height: 100%; background: #FFFFFF; text-align: center">
|
||||
<ve-histogram ref="consoleNodeLoad" :data="chartData" :extend="extend" :settings="chartSettings" width="100%" height="100%" :legend-visible="true"></ve-histogram>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
import moment from "moment/moment";
|
||||
|
||||
export default {
|
||||
name: 'ConsoleNodeLoad',
|
||||
data() {
|
||||
return {
|
||||
chartData: {
|
||||
columns: ['id', 'push', 'proxy', 'gbReceive', 'gbSend'],
|
||||
rows: []
|
||||
},
|
||||
chartSettings: {
|
||||
labelMap: {
|
||||
'push': '直播推流',
|
||||
'proxy': '拉流代理',
|
||||
'gbReceive': '国标收流',
|
||||
'gbSend': '国标推流',
|
||||
},
|
||||
},
|
||||
extend: {
|
||||
title: {
|
||||
show: true,
|
||||
text: "节点负载",
|
||||
left: "center",
|
||||
top: 20,
|
||||
|
||||
},
|
||||
legend: {
|
||||
left: "center",
|
||||
bottom: "15px",
|
||||
},
|
||||
label: {
|
||||
show: true,
|
||||
position: "top"
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(_ => {
|
||||
setTimeout(()=>{
|
||||
this.$refs.consoleNodeLoad.echarts.resize()
|
||||
}, 100)
|
||||
})
|
||||
},
|
||||
destroyed() {
|
||||
},
|
||||
methods: {
|
||||
setData: function(data) {
|
||||
this.chartData .rows = data;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
86
web_src/src/components/console/ConsoleResource.vue
Normal file
86
web_src/src/components/console/ConsoleResource.vue
Normal file
@@ -0,0 +1,86 @@
|
||||
<template >
|
||||
<div id="consoleResource" style="width: 100%; height: 100%; background: #FFFFFF; text-align: center">
|
||||
<div style="width: 50%;height: 50%; float:left; ">
|
||||
<el-progress :width="100" :stroke-width="8" type="circle" :percentage="deviceInfo.online/deviceInfo.total*100" style="margin-top: 20px; font-size: 18px"></el-progress>
|
||||
<div class="resourceInfo">
|
||||
设备总数:{{deviceInfo.total}}<br/>
|
||||
在线数:{{deviceInfo.online}}
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 50%;height: 50%; float:left; ">
|
||||
<el-progress :width="100" :stroke-width="10" type="circle" :percentage="channelInfo.online/channelInfo.total*100" style="margin-top: 20px"></el-progress>
|
||||
<div class="resourceInfo">
|
||||
通道总数:{{channelInfo.total}}<br/>
|
||||
在线数:{{channelInfo.online}}
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 50%;height: 50%; float:left; ">
|
||||
<el-progress :width="100" :stroke-width="10" type="circle" :percentage="pushInfo.online/pushInfo.total*100" style="margin-top: 20px"></el-progress>
|
||||
<div class="resourceInfo">
|
||||
推流总数:{{pushInfo.total}}<br/>
|
||||
在线数:{{pushInfo.online}}
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 50%;height: 50%; float:left; ">
|
||||
<el-progress :width="100" :stroke-width="10" type="circle" :percentage="proxyInfo.online/proxyInfo.total*100" style="margin-top: 20px"></el-progress>
|
||||
<div class="resourceInfo">
|
||||
拉流代理总数:{{proxyInfo.total}}<br/>
|
||||
在线数:{{proxyInfo.online}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'consoleResource',
|
||||
data() {
|
||||
return {
|
||||
deviceInfo: {
|
||||
total: 0,
|
||||
online: 0
|
||||
},
|
||||
channelInfo: {
|
||||
total: 0,
|
||||
online: 0
|
||||
},
|
||||
pushInfo: {
|
||||
total: 0,
|
||||
online: 0
|
||||
},
|
||||
proxyInfo: {
|
||||
total: 0,
|
||||
online: 0
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
||||
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
destroyed() {
|
||||
},
|
||||
methods: {
|
||||
setData: function(data) {
|
||||
this.deviceInfo = data.device;
|
||||
this.channelInfo = data.channel;
|
||||
this.pushInfo = data.push;
|
||||
this.proxyInfo = data.proxy;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.resourceInfo{
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
font-size: 12px
|
||||
}
|
||||
.el-progress__text {
|
||||
font-size: 18px !important;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user