🐛 修复无法编辑已创建服务监控

This commit is contained in:
naiba 2021-04-22 22:18:55 +08:00
parent 585cf538d0
commit b69b069f27
6 changed files with 15 additions and 15 deletions

View File

@ -1,7 +1,7 @@
<div align="center" style="background-color: white">
<img width="500" style="max-width:100%" src="https://raw.githubusercontent.com/naiba/nezha/master/resource/static/brand.png" title="哪吒监控">
<br><br>
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.6.3&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github">&nbsp;<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/badge/Installer-v0.4.10-brightgreen?style=for-the-badge&logo=linux">
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.6.4&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github">&nbsp;<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/badge/Installer-v0.4.10-brightgreen?style=for-the-badge&logo=linux">
<br>
<p>:trollface: 哪吒监控 一站式轻监控轻运维系统。支持系统状态、HTTP(SSL 证书变更、即将到期、到期)、TCP、Ping 监控报警,命令批量执行和计划任务。</p>
</div>

View File

@ -201,8 +201,8 @@ function addOrEditMonitor(monitor) {
}
var servers;
if (monitor) {
servers = monitor.SkipServersRaw || "[]";
const serverList = JSON.parse(servers);
servers = monitor.SkipServersRaw;
const serverList = JSON.parse(servers || "[]");
const node = modal.find("i.dropdown.icon");
for (let i = 0; i < serverList.length; i++) {
node.after(
@ -237,7 +237,7 @@ function addOrEditCron(cron) {
var servers;
if (cron) {
servers = cron.ServersRaw;
const serverList = JSON.parse(servers);
const serverList = JSON.parse(servers || "[]");
const node = modal.find("i.dropdown.icon");
for (let i = 0; i < serverList.length; i++) {
node.after(

View File

@ -9,7 +9,7 @@
<script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.1/dist/semantic.min.js"></script>
<script src="/static/semantic-ui-alerts.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.min.js"></script>
<script src="/static/main.js?v202104222126"></script>
<script src="/static/main.js?v202104222216"></script>
</body>
</html>

View File

@ -1,6 +1,5 @@
{{define "dashboard/monitor"}}
{{template "common/header" .}}
{{template "common/menu" .}}
{{define "dashboard/monitor"}} {{template "common/header" .}} {{template
"common/menu" .}}
<div class="nb-container">
<div class="ui container">
<div class="ui grid">
@ -18,10 +17,10 @@
<tr>
<th>ID</th>
<th>名称</th>
<th>通知</th>
<th>目标</th>
<th>类型</th>
<th>跳过的服务器</th>
<th>类型</th>
<th>通知</th>
<th>管理</th>
</tr>
</thead>
@ -30,13 +29,13 @@
<tr>
<td>{{$monitor.ID}}</td>
<td>{{$monitor.Name}}</td>
<td>{{$monitor.Notify}}</td>
<td>{{$monitor.Target}}</td>
<td>{{$monitor.SkipServersRaw}}</td>
<td>
{{if eq $monitor.Type 1}}HTTP(S)/SSL证书 {{else if eq $monitor.Type
2}} ICMP Ping {{else}} TCP 端口 {{end}}
</td>
<td>{{$monitor.SkipServersRaw}}</td>
<td>{{$monitor.Notify}}</td>
<td>
<div class="ui mini icon buttons">
<button
@ -59,8 +58,7 @@
</table>
</div>
</div>
{{template "component/monitor"}}
{{template "common/footer" .}}
{{template "component/monitor"}} {{template "common/footer" .}}
<script>
$(".checkbox").checkbox();
</script>

View File

@ -13,7 +13,7 @@ import (
pb "github.com/naiba/nezha/proto"
)
var Version = "v0.6.3" // !!记得修改 README 中的 badge 版本!!
var Version = "v0.6.4" // !!记得修改 README 中的 badge 版本!!
const (
SnapshotDelay = 3

View File

@ -180,8 +180,10 @@ func (ss *ServiceSentinel) LoadStats() map[uint64]*model.ServiceItemResponse {
for i := 0; i < len(v); i++ {
if v[i].Successful {
msm[k].Up[29]++
msm[k].TotalUp++
} else {
msm[k].Down[29]++
msm[k].TotalDown++
}
msm[k].Delay[29] = (msm[k].Delay[29]*float32(msm[k].Up[29]) + v[i].Delay) / float32(msm[k].Up[29]+1)
}