mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-05 05:00:05 +00:00
@@ -23,12 +23,14 @@
|
||||
const initData = JSON.parse('{{.Servers}}').servers;
|
||||
let MaxTCPPingValue = {{.MaxTCPPingValue}};
|
||||
if (MaxTCPPingValue == null) {
|
||||
MaxTCPPingValue = 300;
|
||||
MaxTCPPingValue = 1000;
|
||||
}
|
||||
new Vue({
|
||||
el: '#app',
|
||||
delimiters: ['@#', '#@'],
|
||||
data: {
|
||||
page: 'network',
|
||||
templates: {{.Themes}},
|
||||
servers: initData,
|
||||
option: {
|
||||
tooltip: {
|
||||
@@ -70,7 +72,7 @@
|
||||
},
|
||||
dataZoom: [
|
||||
{
|
||||
start: 94,
|
||||
start: 0,
|
||||
end: 100
|
||||
}
|
||||
],
|
||||
@@ -80,19 +82,16 @@
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
boundaryGap: [0, '100%']
|
||||
boundaryGap: false
|
||||
},
|
||||
series: [],
|
||||
},
|
||||
chartOnOff: true,
|
||||
},
|
||||
mixins: [mixinsVue],
|
||||
created() {
|
||||
this.initTheme();
|
||||
},
|
||||
mounted() {
|
||||
this.renderChart();
|
||||
this.parseMonitorInfo(monitorInfo);
|
||||
this.parseMonitorInfo(monitorInfo);
|
||||
},
|
||||
methods: {
|
||||
getFontLogoClass(str) {
|
||||
@@ -153,15 +152,15 @@
|
||||
return '';
|
||||
},
|
||||
redirectNetwork(id) {
|
||||
this.getMonitorHistory(id)
|
||||
.then(function(monitorInfo) {
|
||||
var vm = app.__vue__;
|
||||
vm.parseMonitorInfo(monitorInfo);
|
||||
})
|
||||
.catch(function(error){
|
||||
window.location.href = "/404";
|
||||
})
|
||||
},
|
||||
this.getMonitorHistory(id)
|
||||
.then(function(monitorInfo) {
|
||||
var vm = app.__vue__;
|
||||
vm.parseMonitorInfo(monitorInfo);
|
||||
})
|
||||
.catch(function(error){
|
||||
window.location.href = "/404";
|
||||
})
|
||||
},
|
||||
getMonitorHistory(id) {
|
||||
return $.ajax({
|
||||
url: "/api/v1/monitor/"+id,
|
||||
@@ -175,11 +174,13 @@
|
||||
let loss = 0;
|
||||
let data = [];
|
||||
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) {
|
||||
loss += 1
|
||||
}
|
||||
data.push([monitorInfo.result[i].created_at[j], avgDelay]);
|
||||
if (avgDelay > 0) {
|
||||
data.push([monitorInfo.result[i].created_at[j], avgDelay]);
|
||||
}
|
||||
}
|
||||
lossRate = ((loss / monitorInfo.result[i].created_at.length) * 100).toFixed(1);
|
||||
legendName = monitorInfo.result[i].monitor_name +" "+ lossRate + "%";
|
||||
@@ -189,7 +190,13 @@
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
data: data
|
||||
data: data,
|
||||
markPoint: {
|
||||
data: [
|
||||
{ type: 'max', symbol: 'pin', name: 'Max', itemStyle: { color: '#f00' } },
|
||||
{ type: 'min', symbol: 'pin', name: 'Min', itemStyle: { color: '#0f0' } }
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
this.option.title.text = monitorInfo.result[0].server_name;
|
||||
@@ -214,4 +221,3 @@
|
||||
</script>
|
||||
{{template "theme-server-status/footer" .}}
|
||||
{{end}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user