nezha/resource/template/theme-default/service.html
2021-01-16 13:17:11 +08:00

43 lines
2.2 KiB
HTML

{{define "theme-default/service"}}
{{template "common/header" .}}
{{template "common/menu" .}}
<div class="nb-container">
<div class="ui container">
<div class="ui segment service-status">
<table class="ui celled table">
<thead>
<tr>
<th class="ui center aligned">名称</th>
<th class="ui center aligned">30天在线率</th>
<th class="ui center aligned">详情</th>
<th class="ui center aligned">状态</th>
</tr>
</thead>
<tbody>
{{range $service := .Services}}
<tr>
<td class="ui center aligned">{{$service.Monitor.Name}}</td>
<td class="ui center aligned">{{divU64 $service.TotalUp (addU64 $service.TotalUp $service.TotalDown)}}%</td>
<td class="ui center aligned">{{range $i,$d := $service.Delay}}
<div class="ui icon button{{if gt (add (index $service.Up $i) (index $service.Down $i)) 0}}
{{if gt (div (index $service.Down $i) (add (index $service.Up $i) (index $service.Down $i))) 30.0}}danger
{{else if gt (div (index $service.Down $i) (add (index $service.Up $i) (index $service.Down $i))) 10.0}}
warning{{else}}good{{end}}
{{end}}" data-tooltip="{{dayBefore $i}},平均延迟:{{$d}}ms">
<i class="delay"></i>
</div> {{end}}</td>
<td class="ui center aligned">
<div class="round{{if gt (addU64 $service.TotalUp $service.TotalDown) 0}}
{{if gt (divU64 $service.TotalDown (addU64 $service.TotalUp $service.TotalDown)) 30.0}}danger{{else if gt (divU64 $service.TotalDown (addU64 $service.TotalUp $service.TotalDown)) 10.0}}warning{{else}}good{{end}}
{{end}}">
<i></i> {{if gt (addU64 $service.TotalUp $service.TotalDown) 0}} {{if gt (divU64 $service.TotalDown (addU64 $service.TotalUp $service.TotalDown)) 30.0}}故障 {{else if gt (divU64 $service.TotalDown (addU64 $service.TotalUp $service.TotalDown)) 10.0}} 低可用{{else}}良好{{end}} {{else}}无数据 {{end}}
</div></td>
</tr> {{end}}
</tbody>
</table>
</div>
</div>
</div>
{{template "common/footer" .}}
{{end}}