Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b5d513c6a | ||
|
|
6c718c4f38 | ||
|
|
5a2ab8a7ee | ||
|
|
0ea0c9ad8c | ||
|
|
7d4d8c46b8 | ||
|
|
a4636ed774 | ||
|
|
bb48e0912d | ||
|
|
a575d1a6e0 | ||
|
|
420d1ca8ff | ||
|
|
29554ec7ec | ||
|
|
9a8c0e7118 | ||
|
|
800af7ce4e | ||
|
|
78134a0e8b | ||
|
|
bad910b686 | ||
|
|
a7d1bd7487 | ||
|
|
20a10ac6b8 | ||
|
|
3a395e66c0 | ||
|
|
4e5cc0b642 | ||
|
|
fe2872bbb3 |
-8
@@ -10,14 +10,6 @@
|
|||||||
.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;
|
||||||
}
|
}
|
||||||
|
|||||||
+74
-150
@@ -20,7 +20,7 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body data-theme="light" data-gridlist="grid">
|
<body data-theme="light" data-gridlist="grid">
|
||||||
<header>
|
<header>
|
||||||
<section class="nav-bar clearfix">
|
<section class="nav-bar clearfix">
|
||||||
<figure class="logo">
|
<figure class="logo">
|
||||||
<a href="/">
|
<a href="/">
|
||||||
@@ -49,11 +49,11 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</section>
|
</section>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<div id="network">
|
<div id="network">
|
||||||
<div class="server-info-container" v-for='server in servers' :id="server.ID" style="font-size: .6em">
|
<div class="server-info-container" v-for='server in servers' :id="server.ID">
|
||||||
<div class="info-body" @click="redirectNetwork(server.ID)">
|
<div class="info-body" @click="redirectNetwork(server.ID)">
|
||||||
<ul class="server-info-body-container">
|
<ul class="server-info-body-container">
|
||||||
<li>
|
<li>
|
||||||
@@ -77,59 +77,60 @@
|
|||||||
<li><i class="fas fa-list-ul" title='{{tr "ListLayout"}}'></i><span>{{tr "ListLayout"}}</span></li>
|
<li><i class="fas fa-list-ul" title='{{tr "ListLayout"}}'></i><span>{{tr "ListLayout"}}</span></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<section class="dark-light-toggle">
|
<section class="dark-light-toggle">
|
||||||
<label class="switcher">
|
<label class="switcher">
|
||||||
<input type="checkbox" name="theme" id="dark-light" />
|
<input type="checkbox" name="theme" id="dark-light" />
|
||||||
<div>
|
<div>
|
||||||
<i class="fas fa-adjust"></i>
|
<i class="fas fa-adjust"></i>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- Back to top button -->
|
<!-- Back to top button -->
|
||||||
<a id="back-to-top"></a>
|
<a id="back-to-top"></a>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<div class="footer-container">
|
<div class="footer-container">
|
||||||
<div><a href="https://github.com/naiba/nezha" target="_blank">Powered by {{tr "NezhaMonitoring"}} · {{.Version}}</a>
|
<div><a href="https://github.com/naiba/nezha" target="_blank">Powered by {{tr "NezhaMonitoring"}} ·
|
||||||
|
{{.Version}}</a>
|
||||||
<p>© <span id="copyright-date">
|
<p>© <span id="copyright-date">
|
||||||
<script>document.getElementById('copyright-date').appendChild(document.createTextNode(new Date().getFullYear()))</script>
|
<script>document.getElementById('copyright-date').appendChild(document.createTextNode(new Date().getFullYear()))</script>
|
||||||
</span> · <a href="https://blog.jackiesung.com" target="_blank">Theme designed by Jackie Sung</a>
|
</span> · <a href="https://blog.jackiesung.com" target="_blank">Theme designed by Jackie Sung</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script src="/static/theme-daynight/js/main.js?v202102012266"></script>
|
<script src="/static/theme-daynight/js/main.js?v202102012266"></script>
|
||||||
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/vue/2.6.14/vue.min.js"></script>
|
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/vue/2.6.14/vue.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
|
||||||
|
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) {
|
// 基于准备好的dom,初始化echarts实例
|
||||||
MaxTCPPingValue = 1000;
|
const myChart = echarts.init(document.getElementById('monitor-info-container'));
|
||||||
}
|
|
||||||
new Vue({
|
// 使用刚指定的配置项和数据显示图表。
|
||||||
el: '#app',
|
var statusCards = new Vue({
|
||||||
|
el: '#network',
|
||||||
delimiters: ['@#', '#@'],
|
delimiters: ['@#', '#@'],
|
||||||
data: {
|
data: {
|
||||||
page: 'network',
|
|
||||||
defaultTemplate: {{.Conf.Site.Theme}},
|
|
||||||
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){
|
formatter: function (params) {
|
||||||
let result = params[0].axisValueLabel + "<br />";
|
let result = params[0].axisValueLabel + "<br />";
|
||||||
params.forEach(function(item){
|
params.forEach(function (item) {
|
||||||
result += item.marker + item.seriesName + ": " + item.value[1].toFixed(2) + " ms<br />";
|
result += item.marker + item.seriesName + ": " + item.value[1].toFixed(2) + " ms<br />";
|
||||||
})
|
})
|
||||||
return result;
|
return result;
|
||||||
@@ -149,11 +150,6 @@
|
|||||||
fontSize: 14
|
fontSize: 14
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
grid: {
|
|
||||||
left: '8%',
|
|
||||||
right: '8%',
|
|
||||||
},
|
|
||||||
backgroundColor: 'rgba(255, 255, 255, 0.8)',
|
|
||||||
toolbox: {
|
toolbox: {
|
||||||
feature: {
|
feature: {
|
||||||
dataZoom: {
|
dataZoom: {
|
||||||
@@ -165,7 +161,7 @@
|
|||||||
},
|
},
|
||||||
dataZoom: [
|
dataZoom: [
|
||||||
{
|
{
|
||||||
start: 0,
|
start: 94,
|
||||||
end: 100
|
end: 100
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -175,92 +171,41 @@
|
|||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value',
|
type: 'value',
|
||||||
boundaryGap: false
|
boundaryGap: [0, '100%']
|
||||||
},
|
},
|
||||||
series: [],
|
series: [],
|
||||||
|
}
|
||||||
},
|
},
|
||||||
chartOnOff: true,
|
|
||||||
},
|
|
||||||
mixins: [mixinsVue],
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.renderChart();
|
this.DarkMode();
|
||||||
this.parseMonitorInfo(monitorInfo);
|
this.parseMonitorInfo(monitorInfo);
|
||||||
window.addEventListener('resize', this.resizeHandle);
|
window.addEventListener('resize', this.resizeHandle);
|
||||||
},
|
},
|
||||||
destroyed () {
|
destroyed() {
|
||||||
window.removeEventListener('resize', this.resizeHandle)
|
window.removeEventListener('resize', this.resizeHandle)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getFontLogoClass(str) {
|
DarkMode() {
|
||||||
if (["almalinux",
|
const hour = new Date(Date.now()).getHours()
|
||||||
"alpine",
|
if (hour > 17 || hour < 4) {
|
||||||
"aosc",
|
document.querySelector("input[name=theme]").checked = true;
|
||||||
"apple",
|
document.getElementsByTagName("BODY")[0].setAttribute('data-theme', 'dark');
|
||||||
"archlinux",
|
document.getElementById("monitor-info-container").style.backgroundColor = "#1E1E1E";
|
||||||
"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) {
|
redirectNetwork(id) {
|
||||||
this.getMonitorHistory(id)
|
this.getMonitorHistory(id)
|
||||||
.then(function(monitorInfo) {
|
.then(function (monitorInfo) {
|
||||||
var vm = app.__vue__;
|
var vm = network.__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"
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -268,15 +213,6 @@
|
|||||||
let tSeries = [];
|
let tSeries = [];
|
||||||
let tLegendData = [];
|
let tLegendData = [];
|
||||||
var lcolors = ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'];
|
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 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++) {
|
for (let i = 0; i < monitorInfo.result.length; i++) {
|
||||||
var lcolor = lcolors[i % lcolors.length];
|
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 rgbaColorMarker = 'rgba(' + parseInt(lcolor.slice(1, 3), 16) + ',' + parseInt(lcolor.slice(3, 5), 16) + ',' + parseInt(lcolor.slice(5, 7), 16) + ',0.5)';
|
||||||
@@ -291,14 +227,22 @@
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
loss += 1;
|
loss += 1;
|
||||||
datal.push([monitorInfo.result[i].created_at[j], maxPing]);
|
datal.push({
|
||||||
|
xAxis: monitorInfo.result[i].created_at[j],
|
||||||
|
label: { show: false },
|
||||||
|
emphasis: { disabled: true },
|
||||||
|
lineStyle: {
|
||||||
|
type: "solid",
|
||||||
|
color: rgbaColorBar
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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) {
|
if (lossRate > 99) {
|
||||||
datal = [];
|
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({
|
||||||
name: legendName,
|
name: legendName,
|
||||||
@@ -306,6 +250,11 @@
|
|||||||
smooth: true,
|
smooth: true,
|
||||||
symbol: 'none',
|
symbol: 'none',
|
||||||
data: data,
|
data: data,
|
||||||
|
markLine: {
|
||||||
|
symbol: "none",
|
||||||
|
symbolSize: 0,
|
||||||
|
data: datal
|
||||||
|
},
|
||||||
markPoint: {
|
markPoint: {
|
||||||
data: [
|
data: [
|
||||||
{ type: 'max', symbol: 'pin', name: 'Max', itemStyle: { color: rgbaColorMarker }, symbolSize: 30, label: { fontSize: 8 } },
|
{ type: 'max', symbol: 'pin', name: 'Max', itemStyle: { color: rgbaColorMarker }, symbolSize: 30, label: { fontSize: 8 } },
|
||||||
@@ -313,64 +262,39 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
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;
|
||||||
this.option.legend.data = tLegendData;
|
this.option.legend.data = tLegendData;
|
||||||
this.myChart.clear();
|
myChart.clear();
|
||||||
this.myChart.setOption(this.option);
|
myChart.setOption(this.option);
|
||||||
},
|
},
|
||||||
this.option.title.text = monitorInfo.result[0].server_name;
|
resizeHandle() {
|
||||||
this.option.series = tSeries;
|
myChart.resize();
|
||||||
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>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
<style>
|
<style>
|
||||||
#network {
|
#network {
|
||||||
display: grid;
|
|
||||||
/*grid-template-columns: repeat(5, 1fr);*/
|
|
||||||
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
|
|
||||||
grid-gap: 1em;
|
|
||||||
width: 100%;
|
|
||||||
width: calc(100vw - 6em);
|
width: calc(100vw - 6em);
|
||||||
max-width: 1400px;
|
max-width: 1400px;
|
||||||
margin: 1em auto;
|
margin: 1em auto;
|
||||||
align-content: start;
|
}
|
||||||
}
|
|
||||||
#monitor-info-container{
|
#monitor-info-container {
|
||||||
margin: 0em auto;
|
margin: 0em auto;
|
||||||
align-content: start;
|
align-content: start;
|
||||||
background-color: #F1F1F2;
|
background-color: #F1F1F2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.server-info-container {
|
||||||
|
font-size: .6em;
|
||||||
|
width: fit-content;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
|||||||
+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">
|
||||||
<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"'
|
<i style="width: 22px;border-radius: 4px;" :class="'fi fi-' + server.Host.CountryCode"></i> <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"}}]')#@
|
||||||
|
|||||||
+14
-21
@@ -28,9 +28,6 @@
|
|||||||
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) {
|
|
||||||
MaxTCPPingValue = 1000;
|
|
||||||
}
|
|
||||||
new Vue({
|
new Vue({
|
||||||
el: '#app',
|
el: '#app',
|
||||||
delimiters: ['@#', '#@'],
|
delimiters: ['@#', '#@'],
|
||||||
@@ -186,15 +183,6 @@
|
|||||||
let tSeries = [];
|
let tSeries = [];
|
||||||
let tLegendData = [];
|
let tLegendData = [];
|
||||||
var lcolors = ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'];
|
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 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++) {
|
for (let i = 0; i < monitorInfo.result.length; i++) {
|
||||||
var lcolor = lcolors[i % lcolors.length];
|
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 rgbaColorMarker = 'rgba(' + parseInt(lcolor.slice(1, 3), 16) + ',' + parseInt(lcolor.slice(3, 5), 16) + ',' + parseInt(lcolor.slice(5, 7), 16) + ',0.5)';
|
||||||
@@ -209,7 +197,15 @@
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
loss += 1;
|
loss += 1;
|
||||||
datal.push([monitorInfo.result[i].created_at[j], maxPing]);
|
datal.push({
|
||||||
|
xAxis: monitorInfo.result[i].created_at[j],
|
||||||
|
label: { show: false },
|
||||||
|
emphasis: { disabled: true },
|
||||||
|
lineStyle: {
|
||||||
|
type: "solid",
|
||||||
|
color: rgbaColorBar
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lossRate = ((loss / monitorInfo.result[i].created_at.length) * 100).toFixed(1);
|
lossRate = ((loss / monitorInfo.result[i].created_at.length) * 100).toFixed(1);
|
||||||
@@ -224,6 +220,11 @@
|
|||||||
smooth: true,
|
smooth: true,
|
||||||
symbol: 'none',
|
symbol: 'none',
|
||||||
data: data,
|
data: data,
|
||||||
|
markLine: {
|
||||||
|
symbol: "none",
|
||||||
|
symbolSize :0,
|
||||||
|
data: datal
|
||||||
|
},
|
||||||
markPoint: {
|
markPoint: {
|
||||||
data: [
|
data: [
|
||||||
{ type: 'max', symbol: 'pin', name: 'Max', itemStyle: { color: rgbaColorMarker }, symbolSize: 30, label: { fontSize: 8 } },
|
{ type: 'max', symbol: 'pin', name: 'Max', itemStyle: { color: rgbaColorMarker }, symbolSize: 30, label: { fontSize: 8 } },
|
||||||
@@ -231,14 +232,6 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
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;
|
||||||
|
|||||||
+14
-21
@@ -55,9 +55,6 @@
|
|||||||
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) {
|
|
||||||
MaxTCPPingValue = 1000;
|
|
||||||
}
|
|
||||||
new Vue({
|
new Vue({
|
||||||
el: '#app',
|
el: '#app',
|
||||||
delimiters: ['@#', '#@'],
|
delimiters: ['@#', '#@'],
|
||||||
@@ -209,15 +206,6 @@
|
|||||||
let tSeries = [];
|
let tSeries = [];
|
||||||
let tLegendData = [];
|
let tLegendData = [];
|
||||||
var lcolors = ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'];
|
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 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++) {
|
for (let i = 0; i < monitorInfo.result.length; i++) {
|
||||||
var lcolor = lcolors[i % lcolors.length];
|
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 rgbaColorMarker = 'rgba(' + parseInt(lcolor.slice(1, 3), 16) + ',' + parseInt(lcolor.slice(3, 5), 16) + ',' + parseInt(lcolor.slice(5, 7), 16) + ',0.5)';
|
||||||
@@ -232,7 +220,15 @@
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
loss += 1;
|
loss += 1;
|
||||||
datal.push([monitorInfo.result[i].created_at[j], maxPing]);
|
datal.push({
|
||||||
|
xAxis: monitorInfo.result[i].created_at[j],
|
||||||
|
label: { show: false },
|
||||||
|
emphasis: { disabled: true },
|
||||||
|
lineStyle: {
|
||||||
|
type: "solid",
|
||||||
|
color: rgbaColorBar
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lossRate = ((loss / monitorInfo.result[i].created_at.length) * 100).toFixed(1);
|
lossRate = ((loss / monitorInfo.result[i].created_at.length) * 100).toFixed(1);
|
||||||
@@ -247,6 +243,11 @@
|
|||||||
smooth: true,
|
smooth: true,
|
||||||
symbol: 'none',
|
symbol: 'none',
|
||||||
data: data,
|
data: data,
|
||||||
|
markLine: {
|
||||||
|
symbol: "none",
|
||||||
|
symbolSize :0,
|
||||||
|
data: datal
|
||||||
|
},
|
||||||
markPoint: {
|
markPoint: {
|
||||||
data: [
|
data: [
|
||||||
{ type: 'max', symbol: 'pin', name: 'Max', itemStyle: { color: rgbaColorMarker }, symbolSize: 30, label: { fontSize: 8 } },
|
{ type: 'max', symbol: 'pin', name: 'Max', itemStyle: { color: rgbaColorMarker }, symbolSize: 30, label: { fontSize: 8 } },
|
||||||
@@ -254,14 +255,6 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
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;
|
||||||
|
|||||||
+14
-21
@@ -22,9 +22,6 @@
|
|||||||
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) {
|
|
||||||
MaxTCPPingValue = 1000;
|
|
||||||
}
|
|
||||||
new Vue({
|
new Vue({
|
||||||
el: '#app',
|
el: '#app',
|
||||||
delimiters: ['@#', '#@'],
|
delimiters: ['@#', '#@'],
|
||||||
@@ -172,15 +169,6 @@
|
|||||||
let tSeries = [];
|
let tSeries = [];
|
||||||
let tLegendData = [];
|
let tLegendData = [];
|
||||||
var lcolors = ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'];
|
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 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++) {
|
for (let i = 0; i < monitorInfo.result.length; i++) {
|
||||||
var lcolor = lcolors[i % lcolors.length];
|
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 rgbaColorMarker = 'rgba(' + parseInt(lcolor.slice(1, 3), 16) + ',' + parseInt(lcolor.slice(3, 5), 16) + ',' + parseInt(lcolor.slice(5, 7), 16) + ',0.5)';
|
||||||
@@ -195,7 +183,15 @@
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
loss += 1;
|
loss += 1;
|
||||||
datal.push([monitorInfo.result[i].created_at[j], maxPing]);
|
datal.push({
|
||||||
|
xAxis: monitorInfo.result[i].created_at[j],
|
||||||
|
label: { show: false },
|
||||||
|
emphasis: { disabled: true },
|
||||||
|
lineStyle: {
|
||||||
|
type: "solid",
|
||||||
|
color: rgbaColorBar
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lossRate = ((loss / monitorInfo.result[i].created_at.length) * 100).toFixed(1);
|
lossRate = ((loss / monitorInfo.result[i].created_at.length) * 100).toFixed(1);
|
||||||
@@ -210,6 +206,11 @@
|
|||||||
smooth: true,
|
smooth: true,
|
||||||
symbol: 'none',
|
symbol: 'none',
|
||||||
data: data,
|
data: data,
|
||||||
|
markLine: {
|
||||||
|
symbol: "none",
|
||||||
|
symbolSize :0,
|
||||||
|
data: datal
|
||||||
|
},
|
||||||
markPoint: {
|
markPoint: {
|
||||||
data: [
|
data: [
|
||||||
{ type: 'max', symbol: 'pin', name: 'Max', itemStyle: { color: rgbaColorMarker }, symbolSize: 30, label: { fontSize: 8 } },
|
{ type: 'max', symbol: 'pin', name: 'Max', itemStyle: { color: rgbaColorMarker }, symbolSize: 30, label: { fontSize: 8 } },
|
||||||
@@ -217,14 +218,6 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
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