Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e54060e527 | ||
|
|
ca14674c36 | ||
|
|
1e27fb9413 | ||
|
|
460483fdef | ||
|
|
3a733c85ad |
@@ -47,25 +47,27 @@ You can change the dashboard language in the settings page (`/setting`) after th
|
|||||||
<a href="https://github.com/lemoeo" title="Lemoe"><img src="https://avatars.githubusercontent.com/u/18618627?v=4" width="50;" alt="Lemoe"/></a>
|
<a href="https://github.com/lemoeo" title="Lemoe"><img src="https://avatars.githubusercontent.com/u/18618627?v=4" width="50;" alt="Lemoe"/></a>
|
||||||
<a href="https://github.com/cantoblanco" title="Kris"><img src="https://avatars.githubusercontent.com/u/116849421?v=4" width="50;" alt="Kris"/></a>
|
<a href="https://github.com/cantoblanco" title="Kris"><img src="https://avatars.githubusercontent.com/u/116849421?v=4" width="50;" alt="Kris"/></a>
|
||||||
<a href="https://github.com/nap0o" title="nap0o"><img src="https://avatars.githubusercontent.com/u/144927971?v=4" width="50;" alt="nap0o"/></a>
|
<a href="https://github.com/nap0o" title="nap0o"><img src="https://avatars.githubusercontent.com/u/144927971?v=4" width="50;" alt="nap0o"/></a>
|
||||||
<a href="https://github.com/spiritLHLS" title="spiritlhl"><img src="https://avatars.githubusercontent.com/u/103393591?v=4" width="50;" alt="spiritlhl"/></a>
|
|
||||||
<a href="https://github.com/liuyanxi975" title="刘颜溪"><img src="https://avatars.githubusercontent.com/u/24417037?v=4" width="50;" alt="刘颜溪"/></a>
|
|
||||||
<a href="https://github.com/CosmosZ-code" title="CosmosZ-code"><img src="https://avatars.githubusercontent.com/u/81398224?v=4" width="50;" alt="CosmosZ-code"/></a>
|
<a href="https://github.com/CosmosZ-code" title="CosmosZ-code"><img src="https://avatars.githubusercontent.com/u/81398224?v=4" width="50;" alt="CosmosZ-code"/></a>
|
||||||
<a href="https://github.com/uubulb" title="UUBulb"><img src="https://avatars.githubusercontent.com/u/35923940?v=4" width="50;" alt="UUBulb"/></a>
|
<a href="https://github.com/liuyanxi975" title="刘颜溪"><img src="https://avatars.githubusercontent.com/u/24417037?v=4" width="50;" alt="刘颜溪"/></a>
|
||||||
<a href="https://github.com/lvgj-stack" title="Ko no dio"><img src="https://avatars.githubusercontent.com/u/38449861?v=4" width="50;" alt="Ko no dio"/></a>
|
<a href="https://github.com/spiritLHLS" title="spiritlhl"><img src="https://avatars.githubusercontent.com/u/103393591?v=4" width="50;" alt="spiritlhl"/></a>
|
||||||
<a href="https://github.com/hhhkkk520" title="Kris"><img src="https://avatars.githubusercontent.com/u/52115472?v=4" width="50;" alt="Kris"/></a>
|
|
||||||
<a href="https://github.com/1ridic" title="1ridic"><img src="https://avatars.githubusercontent.com/u/88495501?v=4" width="50;" alt="1ridic"/></a>
|
<a href="https://github.com/1ridic" title="1ridic"><img src="https://avatars.githubusercontent.com/u/88495501?v=4" width="50;" alt="1ridic"/></a>
|
||||||
|
<a href="https://github.com/hhhkkk520" title="Kris"><img src="https://avatars.githubusercontent.com/u/52115472?v=4" width="50;" alt="Kris"/></a>
|
||||||
|
<a href="https://github.com/lvgj-stack" title="Ko no dio"><img src="https://avatars.githubusercontent.com/u/38449861?v=4" width="50;" alt="Ko no dio"/></a>
|
||||||
|
<a href="https://github.com/uubulb" title="UUBulb"><img src="https://avatars.githubusercontent.com/u/35923940?v=4" width="50;" alt="UUBulb"/></a>
|
||||||
<a href="https://github.com/Mmx233" title="Mmx"><img src="https://avatars.githubusercontent.com/u/36563672?v=4" width="50;" alt="Mmx"/></a>
|
<a href="https://github.com/Mmx233" title="Mmx"><img src="https://avatars.githubusercontent.com/u/36563672?v=4" width="50;" alt="Mmx"/></a>
|
||||||
<a href="https://github.com/rootmelo92118" title="rootmelo92118"><img src="https://avatars.githubusercontent.com/u/32770959?v=4" width="50;" alt="rootmelo92118"/></a>
|
<a href="https://github.com/rootmelo92118" title="rootmelo92118"><img src="https://avatars.githubusercontent.com/u/32770959?v=4" width="50;" alt="rootmelo92118"/></a>
|
||||||
|
<a href="https://github.com/xykt" title="xykt"><img src="https://avatars.githubusercontent.com/u/152045469?v=4" width="50;" alt="xykt"/></a>
|
||||||
<a href="https://github.com/iilemon" title="Sean"><img src="https://avatars.githubusercontent.com/u/33201711?v=4" width="50;" alt="Sean"/></a>
|
<a href="https://github.com/iilemon" title="Sean"><img src="https://avatars.githubusercontent.com/u/33201711?v=4" width="50;" alt="Sean"/></a>
|
||||||
<a href="https://github.com/fscarmen" title="fscarmen"><img src="https://avatars.githubusercontent.com/u/62703343?v=4" width="50;" alt="fscarmen"/></a>
|
<a href="https://github.com/fscarmen" title="fscarmen"><img src="https://avatars.githubusercontent.com/u/62703343?v=4" width="50;" alt="fscarmen"/></a>
|
||||||
<a href="https://github.com/ch8o" title="no-name-now"><img src="https://avatars.githubusercontent.com/u/9103372?v=4" width="50;" alt="no-name-now"/></a>
|
<a href="https://github.com/ch8o" title="no-name-now"><img src="https://avatars.githubusercontent.com/u/9103372?v=4" width="50;" alt="no-name-now"/></a>
|
||||||
|
<a href="https://github.com/HsukqiLee" title="HsukqiLee"><img src="https://avatars.githubusercontent.com/u/79034142?v=4" width="50;" alt="HsukqiLee"/></a>
|
||||||
<a href="https://github.com/DarcJC" title="Darc Z."><img src="https://avatars.githubusercontent.com/u/53445798?v=4" width="50;" alt="Darc Z."/></a>
|
<a href="https://github.com/DarcJC" title="Darc Z."><img src="https://avatars.githubusercontent.com/u/53445798?v=4" width="50;" alt="Darc Z."/></a>
|
||||||
<a href="https://github.com/Creling" title="Creling"><img src="https://avatars.githubusercontent.com/u/43109504?v=4" width="50;" alt="Creling"/></a>
|
<a href="https://github.com/Creling" title="Creling"><img src="https://avatars.githubusercontent.com/u/43109504?v=4" width="50;" alt="Creling"/></a>
|
||||||
<a href="https://github.com/coreff" title="Core F"><img src="https://avatars.githubusercontent.com/u/38347122?v=4" width="50;" alt="Core F"/></a>
|
<a href="https://github.com/coreff" title="Core F"><img src="https://avatars.githubusercontent.com/u/38347122?v=4" width="50;" alt="Core F"/></a>
|
||||||
<a href="https://github.com/colour93" title="玖叁"><img src="https://avatars.githubusercontent.com/u/64313711?v=4" width="50;" alt="玖叁"/></a>
|
<a href="https://github.com/colour93" title="玖叁"><img src="https://avatars.githubusercontent.com/u/64313711?v=4" width="50;" alt="玖叁"/></a>
|
||||||
<a href="https://github.com/arkylin" title="凌"><img src="https://avatars.githubusercontent.com/u/35104502?v=4" width="50;" alt="凌"/></a>
|
<a href="https://github.com/arkylin" title="凌"><img src="https://avatars.githubusercontent.com/u/35104502?v=4" width="50;" alt="凌"/></a>
|
||||||
<a href="https://github.com/ysicing" title="缘生"><img src="https://avatars.githubusercontent.com/u/8605565?v=4" width="50;" alt="缘生"/></a>
|
<a href="https://github.com/ysicing" title="缘生"><img src="https://avatars.githubusercontent.com/u/8605565?v=4" width="50;" alt="缘生"/></a>
|
||||||
<a href="https://github.com/xykt" title="xykt"><img src="https://avatars.githubusercontent.com/u/152045469?v=4" width="50;" alt="xykt"/></a>
|
<a href="https://github.com/sunnywangzi" title="wang"><img src="https://avatars.githubusercontent.com/u/88769439?v=4" width="50;" alt="wang"/></a>
|
||||||
<a href="https://github.com/unclezs" title="unclezs"><img src="https://avatars.githubusercontent.com/u/42318775?v=4" width="50;" alt="unclezs"/></a>
|
<a href="https://github.com/unclezs" title="unclezs"><img src="https://avatars.githubusercontent.com/u/42318775?v=4" width="50;" alt="unclezs"/></a>
|
||||||
<a href="https://github.com/yuanweize" title="I"><img src="https://avatars.githubusercontent.com/u/30067203?v=4" width="50;" alt="I"/></a>
|
<a href="https://github.com/yuanweize" title="I"><img src="https://avatars.githubusercontent.com/u/30067203?v=4" width="50;" alt="I"/></a>
|
||||||
<a href="https://github.com/guoyongchang" title="guoyongchang"><img src="https://avatars.githubusercontent.com/u/10484506?v=4" width="50;" alt="guoyongchang"/></a>
|
<a href="https://github.com/guoyongchang" title="guoyongchang"><img src="https://avatars.githubusercontent.com/u/10484506?v=4" width="50;" alt="guoyongchang"/></a>
|
||||||
@@ -76,7 +78,6 @@ You can change the dashboard language in the settings page (`/setting`) after th
|
|||||||
<a href="https://github.com/MartijnLindeman" title="Martijn Lindeman"><img src="https://avatars.githubusercontent.com/u/78365708?v=4" width="50;" alt="Martijn Lindeman"/></a>
|
<a href="https://github.com/MartijnLindeman" title="Martijn Lindeman"><img src="https://avatars.githubusercontent.com/u/78365708?v=4" width="50;" alt="Martijn Lindeman"/></a>
|
||||||
<a href="https://github.com/KorenKrita" title="KorenKrita"><img src="https://avatars.githubusercontent.com/u/22239339?v=4" width="50;" alt="KorenKrita"/></a>
|
<a href="https://github.com/KorenKrita" title="KorenKrita"><img src="https://avatars.githubusercontent.com/u/22239339?v=4" width="50;" alt="KorenKrita"/></a>
|
||||||
<a href="https://github.com/techotaku" title="Ian Li"><img src="https://avatars.githubusercontent.com/u/1948179?v=4" width="50;" alt="Ian Li"/></a>
|
<a href="https://github.com/techotaku" title="Ian Li"><img src="https://avatars.githubusercontent.com/u/1948179?v=4" width="50;" alt="Ian Li"/></a>
|
||||||
<a href="https://github.com/HsukqiLee" title="HsukqiLee"><img src="https://avatars.githubusercontent.com/u/79034142?v=4" width="50;" alt="HsukqiLee"/></a>
|
|
||||||
<a href="https://github.com/GreenTeodoro839" title="GreenTeodoro839"><img src="https://avatars.githubusercontent.com/u/77104800?v=4" width="50;" alt="GreenTeodoro839"/></a>
|
<a href="https://github.com/GreenTeodoro839" title="GreenTeodoro839"><img src="https://avatars.githubusercontent.com/u/77104800?v=4" width="50;" alt="GreenTeodoro839"/></a>
|
||||||
<a href="https://github.com/Es-dese" title="Esdese"><img src="https://avatars.githubusercontent.com/u/71542548?v=4" width="50;" alt="Esdese"/></a>
|
<a href="https://github.com/Es-dese" title="Esdese"><img src="https://avatars.githubusercontent.com/u/71542548?v=4" width="50;" alt="Esdese"/></a>
|
||||||
<a href="https://github.com/wwng2333" title="Crazy"><img src="https://avatars.githubusercontent.com/u/17147265?v=4" width="50;" alt="Crazy"/></a><!--GAMFC_DELIMITER_END-->
|
<a href="https://github.com/wwng2333" title="Crazy"><img src="https://avatars.githubusercontent.com/u/17147265?v=4" width="50;" alt="Crazy"/></a><!--GAMFC_DELIMITER_END-->
|
||||||
|
|||||||
+8
@@ -10,6 +10,14 @@
|
|||||||
.ui.card>.content>.header:not(.ui),.ui.cards>.card>.content>.header:not(.ui) {
|
.ui.card>.content>.header:not(.ui),.ui.cards>.card>.content>.header:not(.ui) {
|
||||||
margin-top:0.4em !important;
|
margin-top:0.4em !important;
|
||||||
}
|
}
|
||||||
|
.ui.card>.content>.header,.ui.cards>.card>.content>.header {
|
||||||
|
padding-top: 0.5rem;
|
||||||
|
display: flex;
|
||||||
|
color: rgba(0, 0, 0, .85);
|
||||||
|
align-items: center;
|
||||||
|
padding-bottom: .2em;
|
||||||
|
border-bottom: 1px solid rgba(0, 0, 0, .2);
|
||||||
|
}
|
||||||
.ui.menu .item>img:not(.ui){
|
.ui.menu .item>img:not(.ui){
|
||||||
width: 2.2rem;
|
width: 2.2rem;
|
||||||
}
|
}
|
||||||
|
|||||||
+228
-127
@@ -107,149 +107,250 @@
|
|||||||
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/limonte-sweetalert2/11.4.4/sweetalert2.all.min.js"></script>
|
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/limonte-sweetalert2/11.4.4/sweetalert2.all.min.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const monitorInfo = JSON.parse('{{.MonitorInfos}}');
|
const monitorInfo = JSON.parse('{{.MonitorInfos}}');
|
||||||
const initData = JSON.parse('{{.Servers}}').servers;
|
const initData = JSON.parse('{{.Servers}}').servers;
|
||||||
let MaxTCPPingValue = {{.Conf.MaxTCPPingValue}};
|
let MaxTCPPingValue = {{.Conf.MaxTCPPingValue}};
|
||||||
if (MaxTCPPingValue == null) {
|
if (MaxTCPPingValue == null) {
|
||||||
MaxTCPPingValue = 1000;
|
MaxTCPPingValue = 1000;
|
||||||
}
|
}
|
||||||
// 基于准备好的dom,初始化echarts实例
|
new Vue({
|
||||||
var myChart = echarts.init(document.getElementById('monitor-info-container'));
|
el: '#app',
|
||||||
// 使用刚指定的配置项和数据显示图表。
|
delimiters: ['@#', '#@'],
|
||||||
var statusCards = new Vue({
|
data: {
|
||||||
el: '#network',
|
page: 'network',
|
||||||
delimiters: ['@#', '#@'],
|
defaultTemplate: {{.Conf.Site.Theme}},
|
||||||
data: {
|
templates: {{.Themes}},
|
||||||
servers: initData,
|
servers: initData,
|
||||||
cache: [],
|
option: {
|
||||||
option: {
|
tooltip: {
|
||||||
tooltip: {
|
trigger: 'axis',
|
||||||
trigger: 'axis',
|
position: function (pt) {
|
||||||
position: function (pt) {
|
return [pt[0], '10%'];
|
||||||
return [pt[0], '10%'];
|
|
||||||
},
|
|
||||||
formatter: function(params){
|
|
||||||
let result = params[0].axisValueLabel + "<br />";
|
|
||||||
params.forEach(function(item){
|
|
||||||
result += item.marker + item.seriesName + ": " + item.value[1].toFixed(2) + " ms<br />";
|
|
||||||
})
|
|
||||||
return result;
|
|
||||||
},
|
|
||||||
confine: true,
|
|
||||||
transitionDuration: 0
|
|
||||||
},
|
},
|
||||||
title: {
|
formatter: function(params){
|
||||||
left: 'center',
|
let result = params[0].axisValueLabel + "<br />";
|
||||||
text: "",
|
params.forEach(function(item){
|
||||||
textStyle: {}
|
result += item.marker + item.seriesName + ": " + item.value[1].toFixed(2) + " ms<br />";
|
||||||
|
})
|
||||||
|
return result;
|
||||||
},
|
},
|
||||||
legend: {
|
confine: true,
|
||||||
top: '5%',
|
transitionDuration: 0
|
||||||
data: [],
|
},
|
||||||
textStyle: {
|
title: {
|
||||||
fontSize: 14
|
left: 'center',
|
||||||
}
|
text: "",
|
||||||
},
|
textStyle: {}
|
||||||
toolbox: {
|
},
|
||||||
feature: {
|
legend: {
|
||||||
dataZoom: {
|
top: '5%',
|
||||||
yAxisIndex: 'none'
|
data: [],
|
||||||
},
|
textStyle: {
|
||||||
restore: {},
|
fontSize: 14
|
||||||
saveAsImage: {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
dataZoom: [
|
|
||||||
{
|
|
||||||
start: 94,
|
|
||||||
end: 100
|
|
||||||
}
|
|
||||||
],
|
|
||||||
xAxis: {
|
|
||||||
type: 'time',
|
|
||||||
boundaryGap: false
|
|
||||||
},
|
|
||||||
yAxis: {
|
|
||||||
type: 'value',
|
|
||||||
boundaryGap: [0, '100%']
|
|
||||||
},
|
|
||||||
series: [],
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.DarkMode();
|
|
||||||
this.parseMonitorInfo(monitorInfo);
|
|
||||||
window.addEventListener('resize', this.resizeHandle);
|
|
||||||
},
|
|
||||||
destroyed () {
|
|
||||||
window.removeEventListener('resize', this.resizeHandle)
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
DarkMode() {
|
|
||||||
const hour = new Date(Date.now()).getHours()
|
|
||||||
if (hour > 17 || hour < 4) {
|
|
||||||
document.querySelector("input[name=theme]").checked = true;
|
|
||||||
document.getElementsByTagName("BODY")[0].setAttribute('data-theme', 'dark');
|
|
||||||
document.getElementById("monitor-info-container").style.backgroundColor = "#1E1E1E";
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
redirectNetwork(id) {
|
grid: {
|
||||||
|
left: '8%',
|
||||||
|
right: '8%',
|
||||||
|
},
|
||||||
|
backgroundColor: 'rgba(255, 255, 255, 0.8)',
|
||||||
|
toolbox: {
|
||||||
|
feature: {
|
||||||
|
dataZoom: {
|
||||||
|
yAxisIndex: 'none'
|
||||||
|
},
|
||||||
|
restore: {},
|
||||||
|
saveAsImage: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
dataZoom: [
|
||||||
|
{
|
||||||
|
start: 0,
|
||||||
|
end: 100
|
||||||
|
}
|
||||||
|
],
|
||||||
|
xAxis: {
|
||||||
|
type: 'time',
|
||||||
|
boundaryGap: false
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
type: 'value',
|
||||||
|
boundaryGap: false
|
||||||
|
},
|
||||||
|
series: [],
|
||||||
|
},
|
||||||
|
chartOnOff: true,
|
||||||
|
},
|
||||||
|
mixins: [mixinsVue],
|
||||||
|
mounted() {
|
||||||
|
this.renderChart();
|
||||||
|
this.parseMonitorInfo(monitorInfo);
|
||||||
|
window.addEventListener('resize', this.resizeHandle);
|
||||||
|
},
|
||||||
|
destroyed () {
|
||||||
|
window.removeEventListener('resize', this.resizeHandle)
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getFontLogoClass(str) {
|
||||||
|
if (["almalinux",
|
||||||
|
"alpine",
|
||||||
|
"aosc",
|
||||||
|
"apple",
|
||||||
|
"archlinux",
|
||||||
|
"archlabs",
|
||||||
|
"artix",
|
||||||
|
"budgie",
|
||||||
|
"centos",
|
||||||
|
"coreos",
|
||||||
|
"debian",
|
||||||
|
"deepin",
|
||||||
|
"devuan",
|
||||||
|
"docker",
|
||||||
|
"elementary",
|
||||||
|
"fedora",
|
||||||
|
"ferris",
|
||||||
|
"flathub",
|
||||||
|
"freebsd",
|
||||||
|
"gentoo",
|
||||||
|
"gnu-guix",
|
||||||
|
"illumos",
|
||||||
|
"kali-linux",
|
||||||
|
"linuxmint",
|
||||||
|
"mageia",
|
||||||
|
"mandriva",
|
||||||
|
"manjaro",
|
||||||
|
"nixos",
|
||||||
|
"openbsd",
|
||||||
|
"opensuse",
|
||||||
|
"pop-os",
|
||||||
|
"raspberry-pi",
|
||||||
|
"redhat",
|
||||||
|
"rocky-linux",
|
||||||
|
"sabayon",
|
||||||
|
"slackware",
|
||||||
|
"snappy",
|
||||||
|
"solus",
|
||||||
|
"tux",
|
||||||
|
"ubuntu",
|
||||||
|
"void",
|
||||||
|
"zorin"].indexOf(str)
|
||||||
|
> -1) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
if (['openwrt', 'linux', "immortalwrt"].indexOf(str) > -1) {
|
||||||
|
return 'tux';
|
||||||
|
}
|
||||||
|
if (str == 'amazon') {
|
||||||
|
return 'redhat';
|
||||||
|
}
|
||||||
|
if (str == 'arch') {
|
||||||
|
return 'archlinux';
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
redirectNetwork(id) {
|
||||||
this.getMonitorHistory(id)
|
this.getMonitorHistory(id)
|
||||||
.then(function(monitorInfo) {
|
.then(function(monitorInfo) {
|
||||||
var vm = network.__vue__;
|
var vm = app.__vue__;
|
||||||
vm.parseMonitorInfo(monitorInfo);
|
vm.parseMonitorInfo(monitorInfo);
|
||||||
})
|
})
|
||||||
.catch(function(error){
|
.catch(function(error){
|
||||||
window.location.href = "/404";
|
window.location.href = "/404";
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getMonitorHistory(id) {
|
getMonitorHistory(id) {
|
||||||
return $.ajax({
|
return $.ajax({
|
||||||
url: "/api/v1/monitor/"+id,
|
url: "/api/v1/monitor/"+id,
|
||||||
method: "GET"
|
method: "GET"
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
parseMonitorInfo(monitorInfo) {
|
parseMonitorInfo(monitorInfo) {
|
||||||
let tSeries = [];
|
let tSeries = [];
|
||||||
let tLegendData = [];
|
let tLegendData = [];
|
||||||
for (let i = 0; i < monitorInfo.result.length; i++) {
|
var lcolors = ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'];
|
||||||
let loss = 0;
|
let maxPing = 0;
|
||||||
let data = [];
|
for (let i = 0; i < monitorInfo.result.length; i++) {
|
||||||
for (let j = 0; j < monitorInfo.result[i].created_at.length; j++) {
|
for (let j = 0; j < monitorInfo.result[i].created_at.length; j++) {
|
||||||
avgDelay = monitorInfo.result[i].avg_delay[j];
|
avgDelay = Math.round(monitorInfo.result[i].avg_delay[j]);
|
||||||
if (avgDelay > 0.9 * MaxTCPPingValue) {
|
if ( avgDelay < MaxTCPPingValue && avgDelay > maxPing) {
|
||||||
loss += 1
|
maxPing = avgDelay;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let i = 0; i < monitorInfo.result.length; i++) {
|
||||||
|
var lcolor = lcolors[i % lcolors.length];
|
||||||
|
var rgbaColorMarker = 'rgba(' + parseInt(lcolor.slice(1, 3), 16) + ',' + parseInt(lcolor.slice(3, 5), 16) + ',' + parseInt(lcolor.slice(5, 7), 16) + ',0.5)';
|
||||||
|
var rgbaColorBar = 'rgba(' + parseInt(lcolor.slice(1, 3), 16) + ',' + parseInt(lcolor.slice(3, 5), 16) + ',' + parseInt(lcolor.slice(5, 7), 16) + ',0.35)';
|
||||||
|
let loss = 0;
|
||||||
|
let data = [];
|
||||||
|
let datal = [];
|
||||||
|
for (let j = 0; j < monitorInfo.result[i].created_at.length; j++) {
|
||||||
|
avgDelay = Math.round(monitorInfo.result[i].avg_delay[j]);
|
||||||
|
if (avgDelay > 0 && avgDelay < MaxTCPPingValue) {
|
||||||
data.push([monitorInfo.result[i].created_at[j], avgDelay]);
|
data.push([monitorInfo.result[i].created_at[j], avgDelay]);
|
||||||
}
|
}
|
||||||
lossRate = ((loss / monitorInfo.result[i].created_at.length) * 100).toFixed(1);
|
else {
|
||||||
legendName = monitorInfo.result[i].monitor_name +" "+ lossRate + "%";
|
loss += 1;
|
||||||
tLegendData.push(legendName);
|
datal.push([monitorInfo.result[i].created_at[j], maxPing]);
|
||||||
tSeries.push({
|
}
|
||||||
name: legendName,
|
|
||||||
type: 'line',
|
|
||||||
smooth: true,
|
|
||||||
symbol: 'none',
|
|
||||||
data: data
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
this.option.title.text = monitorInfo.result[0].server_name;
|
lossRate = ((loss / monitorInfo.result[i].created_at.length) * 100).toFixed(1);
|
||||||
this.option.series = tSeries;
|
if (lossRate > 99) {
|
||||||
this.option.legend.data = tLegendData;
|
datal = [];
|
||||||
const hour = new Date(Date.now()).getHours()
|
|
||||||
if (hour > 17 || hour < 4) {
|
|
||||||
this.option.legend.textStyle.color = "#F1F1F2";
|
|
||||||
this.option.title.textStyle.color = "#ccc";
|
|
||||||
}
|
}
|
||||||
myChart.clear();
|
legendName = monitorInfo.result[i].monitor_name +" "+ lossRate + "%";
|
||||||
myChart.setOption(this.option);
|
tLegendData.push(legendName);
|
||||||
},
|
tSeries.push({
|
||||||
resizeHandle () {
|
name: legendName,
|
||||||
this.myChart.resize();
|
type: 'line',
|
||||||
},
|
smooth: true,
|
||||||
}
|
symbol: 'none',
|
||||||
});
|
data: data,
|
||||||
</script>
|
markPoint: {
|
||||||
|
data: [
|
||||||
|
{ type: 'max', symbol: 'pin', name: 'Max', itemStyle: { color: rgbaColorMarker }, symbolSize: 30, label: { fontSize: 8 } },
|
||||||
|
{ type: 'min', symbol: 'pin', name: 'Min', itemStyle: { color: rgbaColorMarker }, symbolSize: 30, label: { fontSize: 8, offset: [0, 7.5] }, symbolRotate: 180 }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tSeries.push({
|
||||||
|
name: legendName,
|
||||||
|
type: 'bar',
|
||||||
|
smooth: true,
|
||||||
|
symbol: 'none',
|
||||||
|
data: datal,
|
||||||
|
itemStyle: { color: rgbaColorBar }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.option.title.text = monitorInfo.result[0].server_name;
|
||||||
|
this.option.series = tSeries;
|
||||||
|
this.option.legend.data = tLegendData;
|
||||||
|
this.myChart.clear();
|
||||||
|
this.myChart.setOption(this.option);
|
||||||
|
},
|
||||||
|
this.option.title.text = monitorInfo.result[0].server_name;
|
||||||
|
this.option.series = tSeries;
|
||||||
|
this.option.legend.data = tLegendData;
|
||||||
|
this.myChart.clear();
|
||||||
|
this.myChart.setOption(this.option);
|
||||||
|
},
|
||||||
|
isWindowsPlatform(str) {
|
||||||
|
return str.includes('Windows')
|
||||||
|
},
|
||||||
|
renderChart() {
|
||||||
|
this.myChart = echarts.init(this.$refs.chartDom);
|
||||||
|
this.myChart.setOption(this.option);
|
||||||
|
},
|
||||||
|
resizeHandle () {
|
||||||
|
this.myChart.resize();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
this.myChart.dispose();
|
||||||
|
this.myChart = null;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
<style>
|
<style>
|
||||||
#network {
|
#network {
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
<div v-for="server in group.data" :id="server.ID" class="ui card">
|
<div v-for="server in group.data" :id="server.ID" class="ui card">
|
||||||
<div class="content" v-if="server.Host" style="margin-top: 10px; padding-bottom: 5px">
|
<div class="content" v-if="server.Host" style="margin-top: 10px; padding-bottom: 5px">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<i :class="'fi fi-' + server.Host.CountryCode"></i> <i v-if='server.Host.Platform == "darwin"'
|
<img v-if="server.Host.CountryCode" style="border-radius: 5px;width:22px;" :src="'https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/6.6.5/flags/4x3/'+server.Host.CountryCode + '.svg'" alt="国家"/> <i v-if='server.Host.Platform == "darwin"'
|
||||||
class="apple icon"></i><i v-else-if='isWindowsPlatform(server.Host.Platform)'
|
class="apple icon"></i><i v-else-if='isWindowsPlatform(server.Host.Platform)'
|
||||||
class="windows icon"></i><i v-else :class="'fl-' + getFontLogoClass(server.Host.Platform)"></i>
|
class="windows icon"></i><i v-else :class="'fl-' + getFontLogoClass(server.Host.Platform)"></i>
|
||||||
@#server.Name + (server.live?'':'[{{tr "Offline"}}]')#@
|
@#server.Name + (server.live?'':'[{{tr "Offline"}}]')#@
|
||||||
|
|||||||
+32
-6
@@ -185,19 +185,37 @@
|
|||||||
parseMonitorInfo(monitorInfo) {
|
parseMonitorInfo(monitorInfo) {
|
||||||
let tSeries = [];
|
let tSeries = [];
|
||||||
let tLegendData = [];
|
let tLegendData = [];
|
||||||
|
var lcolors = ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'];
|
||||||
|
let maxPing = 0;
|
||||||
for (let i = 0; i < monitorInfo.result.length; i++) {
|
for (let i = 0; i < monitorInfo.result.length; i++) {
|
||||||
|
for (let j = 0; j < monitorInfo.result[i].created_at.length; j++) {
|
||||||
|
avgDelay = Math.round(monitorInfo.result[i].avg_delay[j]);
|
||||||
|
if ( avgDelay < MaxTCPPingValue && avgDelay > maxPing) {
|
||||||
|
maxPing = avgDelay;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let i = 0; i < monitorInfo.result.length; i++) {
|
||||||
|
var lcolor = lcolors[i % lcolors.length];
|
||||||
|
var rgbaColorMarker = 'rgba(' + parseInt(lcolor.slice(1, 3), 16) + ',' + parseInt(lcolor.slice(3, 5), 16) + ',' + parseInt(lcolor.slice(5, 7), 16) + ',0.5)';
|
||||||
|
var rgbaColorBar = 'rgba(' + parseInt(lcolor.slice(1, 3), 16) + ',' + parseInt(lcolor.slice(3, 5), 16) + ',' + parseInt(lcolor.slice(5, 7), 16) + ',0.35)';
|
||||||
let loss = 0;
|
let loss = 0;
|
||||||
let data = [];
|
let data = [];
|
||||||
|
let datal = [];
|
||||||
for (let j = 0; j < monitorInfo.result[i].created_at.length; j++) {
|
for (let j = 0; j < monitorInfo.result[i].created_at.length; j++) {
|
||||||
avgDelay = Math.round(monitorInfo.result[i].avg_delay[j]);
|
avgDelay = Math.round(monitorInfo.result[i].avg_delay[j]);
|
||||||
if (avgDelay > 0.9 * MaxTCPPingValue) {
|
if (avgDelay > 0 && avgDelay < MaxTCPPingValue) {
|
||||||
loss += 1
|
|
||||||
}
|
|
||||||
if (avgDelay > 0) {
|
|
||||||
data.push([monitorInfo.result[i].created_at[j], avgDelay]);
|
data.push([monitorInfo.result[i].created_at[j], avgDelay]);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
loss += 1;
|
||||||
|
datal.push([monitorInfo.result[i].created_at[j], maxPing]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
lossRate = ((loss / monitorInfo.result[i].created_at.length) * 100).toFixed(1);
|
lossRate = ((loss / monitorInfo.result[i].created_at.length) * 100).toFixed(1);
|
||||||
|
if (lossRate > 99) {
|
||||||
|
datal = [];
|
||||||
|
}
|
||||||
legendName = monitorInfo.result[i].monitor_name +" "+ lossRate + "%";
|
legendName = monitorInfo.result[i].monitor_name +" "+ lossRate + "%";
|
||||||
tLegendData.push(legendName);
|
tLegendData.push(legendName);
|
||||||
tSeries.push({
|
tSeries.push({
|
||||||
@@ -208,11 +226,19 @@
|
|||||||
data: data,
|
data: data,
|
||||||
markPoint: {
|
markPoint: {
|
||||||
data: [
|
data: [
|
||||||
{ type: 'max', symbol: 'pin', name: 'Max', itemStyle: { color: '#f00' } },
|
{ type: 'max', symbol: 'pin', name: 'Max', itemStyle: { color: rgbaColorMarker }, symbolSize: 30, label: { fontSize: 8 } },
|
||||||
{ type: 'min', symbol: 'pin', name: 'Min', itemStyle: { color: '#0f0' } }
|
{ type: 'min', symbol: 'pin', name: 'Min', itemStyle: { color: rgbaColorMarker }, symbolSize: 30, label: { fontSize: 8, offset: [0, 7.5] }, symbolRotate: 180 }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
tSeries.push({
|
||||||
|
name: legendName,
|
||||||
|
type: 'bar',
|
||||||
|
smooth: true,
|
||||||
|
symbol: 'none',
|
||||||
|
data: datal,
|
||||||
|
itemStyle: { color: rgbaColorBar }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
this.option.title.text = monitorInfo.result[0].server_name;
|
this.option.title.text = monitorInfo.result[0].server_name;
|
||||||
this.option.series = tSeries;
|
this.option.series = tSeries;
|
||||||
|
|||||||
+33
-7
@@ -208,19 +208,37 @@
|
|||||||
parseMonitorInfo(monitorInfo) {
|
parseMonitorInfo(monitorInfo) {
|
||||||
let tSeries = [];
|
let tSeries = [];
|
||||||
let tLegendData = [];
|
let tLegendData = [];
|
||||||
|
var lcolors = ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'];
|
||||||
|
let maxPing = 0;
|
||||||
for (let i = 0; i < monitorInfo.result.length; i++) {
|
for (let i = 0; i < monitorInfo.result.length; i++) {
|
||||||
|
for (let j = 0; j < monitorInfo.result[i].created_at.length; j++) {
|
||||||
|
avgDelay = Math.round(monitorInfo.result[i].avg_delay[j]);
|
||||||
|
if ( avgDelay < MaxTCPPingValue && avgDelay > maxPing) {
|
||||||
|
maxPing = avgDelay;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let i = 0; i < monitorInfo.result.length; i++) {
|
||||||
|
var lcolor = lcolors[i % lcolors.length];
|
||||||
|
var rgbaColorMarker = 'rgba(' + parseInt(lcolor.slice(1, 3), 16) + ',' + parseInt(lcolor.slice(3, 5), 16) + ',' + parseInt(lcolor.slice(5, 7), 16) + ',0.5)';
|
||||||
|
var rgbaColorBar = 'rgba(' + parseInt(lcolor.slice(1, 3), 16) + ',' + parseInt(lcolor.slice(3, 5), 16) + ',' + parseInt(lcolor.slice(5, 7), 16) + ',0.35)';
|
||||||
let loss = 0;
|
let loss = 0;
|
||||||
let data = [];
|
let data = [];
|
||||||
|
let datal = [];
|
||||||
for (let j = 0; j < monitorInfo.result[i].created_at.length; j++) {
|
for (let j = 0; j < monitorInfo.result[i].created_at.length; j++) {
|
||||||
avgDelay = Math.round(monitorInfo.result[i].avg_delay[j]);
|
avgDelay = Math.round(monitorInfo.result[i].avg_delay[j]);
|
||||||
if (avgDelay > 0.9 * MaxTCPPingValue) {
|
if (avgDelay > 0 && avgDelay < MaxTCPPingValue) {
|
||||||
loss += 1
|
|
||||||
}
|
|
||||||
if (avgDelay > 0) {
|
|
||||||
data.push([monitorInfo.result[i].created_at[j], avgDelay]);
|
data.push([monitorInfo.result[i].created_at[j], avgDelay]);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
loss += 1;
|
||||||
|
datal.push([monitorInfo.result[i].created_at[j], maxPing]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
lossRate = ((loss / monitorInfo.result[i].created_at.length) * 100).toFixed(1);
|
lossRate = ((loss / monitorInfo.result[i].created_at.length) * 100).toFixed(1);
|
||||||
|
if (lossRate > 99) {
|
||||||
|
datal = [];
|
||||||
|
}
|
||||||
legendName = monitorInfo.result[i].monitor_name +" "+ lossRate + "%";
|
legendName = monitorInfo.result[i].monitor_name +" "+ lossRate + "%";
|
||||||
tLegendData.push(legendName);
|
tLegendData.push(legendName);
|
||||||
tSeries.push({
|
tSeries.push({
|
||||||
@@ -230,12 +248,20 @@
|
|||||||
symbol: 'none',
|
symbol: 'none',
|
||||||
data: data,
|
data: data,
|
||||||
markPoint: {
|
markPoint: {
|
||||||
data: [
|
data: [
|
||||||
{ type: 'max', symbol: 'pin', name: 'Max', itemStyle: { color: '#f00' } },
|
{ type: 'max', symbol: 'pin', name: 'Max', itemStyle: { color: rgbaColorMarker }, symbolSize: 30, label: { fontSize: 8 } },
|
||||||
{ type: 'min', symbol: 'pin', name: 'Min', itemStyle: { color: '#0f0' } }
|
{ type: 'min', symbol: 'pin', name: 'Min', itemStyle: { color: rgbaColorMarker }, symbolSize: 30, label: { fontSize: 8, offset: [0, 7.5] }, symbolRotate: 180 }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
tSeries.push({
|
||||||
|
name: legendName,
|
||||||
|
type: 'bar',
|
||||||
|
smooth: true,
|
||||||
|
symbol: 'none',
|
||||||
|
data: datal,
|
||||||
|
itemStyle: { color: rgbaColorBar }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
this.option.title.text = monitorInfo.result[0].server_name;
|
this.option.title.text = monitorInfo.result[0].server_name;
|
||||||
this.option.series = tSeries;
|
this.option.series = tSeries;
|
||||||
|
|||||||
+32
-6
@@ -171,19 +171,37 @@
|
|||||||
parseMonitorInfo(monitorInfo) {
|
parseMonitorInfo(monitorInfo) {
|
||||||
let tSeries = [];
|
let tSeries = [];
|
||||||
let tLegendData = [];
|
let tLegendData = [];
|
||||||
|
var lcolors = ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'];
|
||||||
|
let maxPing = 0;
|
||||||
for (let i = 0; i < monitorInfo.result.length; i++) {
|
for (let i = 0; i < monitorInfo.result.length; i++) {
|
||||||
|
for (let j = 0; j < monitorInfo.result[i].created_at.length; j++) {
|
||||||
|
avgDelay = Math.round(monitorInfo.result[i].avg_delay[j]);
|
||||||
|
if ( avgDelay < MaxTCPPingValue && avgDelay > maxPing) {
|
||||||
|
maxPing = avgDelay;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let i = 0; i < monitorInfo.result.length; i++) {
|
||||||
|
var lcolor = lcolors[i % lcolors.length];
|
||||||
|
var rgbaColorMarker = 'rgba(' + parseInt(lcolor.slice(1, 3), 16) + ',' + parseInt(lcolor.slice(3, 5), 16) + ',' + parseInt(lcolor.slice(5, 7), 16) + ',0.5)';
|
||||||
|
var rgbaColorBar = 'rgba(' + parseInt(lcolor.slice(1, 3), 16) + ',' + parseInt(lcolor.slice(3, 5), 16) + ',' + parseInt(lcolor.slice(5, 7), 16) + ',0.35)';
|
||||||
let loss = 0;
|
let loss = 0;
|
||||||
let data = [];
|
let data = [];
|
||||||
|
let datal = [];
|
||||||
for (let j = 0; j < monitorInfo.result[i].created_at.length; j++) {
|
for (let j = 0; j < monitorInfo.result[i].created_at.length; j++) {
|
||||||
avgDelay = Math.round(monitorInfo.result[i].avg_delay[j]);
|
avgDelay = Math.round(monitorInfo.result[i].avg_delay[j]);
|
||||||
if (avgDelay > 0.9 * MaxTCPPingValue) {
|
if (avgDelay > 0 && avgDelay < MaxTCPPingValue) {
|
||||||
loss += 1
|
|
||||||
}
|
|
||||||
if (avgDelay > 0) {
|
|
||||||
data.push([monitorInfo.result[i].created_at[j], avgDelay]);
|
data.push([monitorInfo.result[i].created_at[j], avgDelay]);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
loss += 1;
|
||||||
|
datal.push([monitorInfo.result[i].created_at[j], maxPing]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
lossRate = ((loss / monitorInfo.result[i].created_at.length) * 100).toFixed(1);
|
lossRate = ((loss / monitorInfo.result[i].created_at.length) * 100).toFixed(1);
|
||||||
|
if (lossRate > 99) {
|
||||||
|
datal = [];
|
||||||
|
}
|
||||||
legendName = monitorInfo.result[i].monitor_name +" "+ lossRate + "%";
|
legendName = monitorInfo.result[i].monitor_name +" "+ lossRate + "%";
|
||||||
tLegendData.push(legendName);
|
tLegendData.push(legendName);
|
||||||
tSeries.push({
|
tSeries.push({
|
||||||
@@ -194,11 +212,19 @@
|
|||||||
data: data,
|
data: data,
|
||||||
markPoint: {
|
markPoint: {
|
||||||
data: [
|
data: [
|
||||||
{ type: 'max', symbol: 'pin', name: 'Max', itemStyle: { color: '#f00' } },
|
{ type: 'max', symbol: 'pin', name: 'Max', itemStyle: { color: rgbaColorMarker }, symbolSize: 30, label: { fontSize: 8 } },
|
||||||
{ type: 'min', symbol: 'pin', name: 'Min', itemStyle: { color: '#0f0' } }
|
{ type: 'min', symbol: 'pin', name: 'Min', itemStyle: { color: rgbaColorMarker }, symbolSize: 30, label: { fontSize: 8, offset: [0, 7.5] }, symbolRotate: 180 }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
tSeries.push({
|
||||||
|
name: legendName,
|
||||||
|
type: 'bar',
|
||||||
|
smooth: true,
|
||||||
|
symbol: 'none',
|
||||||
|
data: datal,
|
||||||
|
itemStyle: { color: rgbaColorBar }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
this.option.title.text = monitorInfo.result[0].server_name;
|
this.option.title.text = monitorInfo.result[0].server_name;
|
||||||
this.option.series = tSeries;
|
this.option.series = tSeries;
|
||||||
|
|||||||
Reference in New Issue
Block a user