Merge pull request #59 from ilay1678/master

优化服务监控布局

Co-authored-by: ilay1678 <7021399+ilay1678@users.noreply.github.com>
This commit is contained in:
naiba 2021-01-16 13:56:05 +08:00 committed by GitHub
commit 3d330e7248
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,37 +4,37 @@
<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}}
<div class="ui grid">
<div class="three wide column">
<p>{{$service.Monitor.Name}}</p>
<p>30天在线率{{divU64 $service.TotalDown (addU64 $service.TotalUp $service.TotalDown)}}%</p>
</div>
<div class="eleven wide column">
{{range $i,$d := $service.Delay}}
<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}}
</div>
<div class="two wide column round{{if gt (addU64 $service.TotalUp $service.TotalDown) 0}}
</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>
</div>
<div class="ui divider"></div>
{{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>