💄 优化 server status 主题

This commit is contained in:
naiba 2023-11-08 13:17:42 +08:00
parent b6c2410b41
commit ce2e5439f7
7 changed files with 59 additions and 51 deletions

View File

@ -4,7 +4,7 @@
<br> <br>
<small><i>LOGO designed by <a href="https://xio.ng" target="_blank">熊大</a> .</i></small> <small><i>LOGO designed by <a href="https://xio.ng" target="_blank">熊大</a> .</i></small>
<br><br> <br><br>
<img src="https://img.shields.io/github/actions/workflow/status/naiba/nezha/dashboard.yml?branch=master&label=Dash%20v0.15.8&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/github/v/release/nezhahq/agent?color=brightgreen&label=Agent&style=for-the-badge&logo=github">&nbsp;<img src="https://img.shields.io/github/actions/workflow/status/nezhahq/agent/agent.yml?branch=v0.15.8&label=Agent%20CI&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/badge/Installer-v0.15.0-brightgreen?style=for-the-badge&logo=linux"> <img src="https://img.shields.io/github/actions/workflow/status/naiba/nezha/dashboard.yml?branch=master&label=Dash%20v0.15.9&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/github/v/release/nezhahq/agent?color=brightgreen&label=Agent&style=for-the-badge&logo=github">&nbsp;<img src="https://img.shields.io/github/actions/workflow/status/nezhahq/agent/agent.yml?branch=v0.15.11&label=Agent%20CI&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/badge/Installer-v0.15.0-brightgreen?style=for-the-badge&logo=linux">
<br> <br>
<br> <br>
<p>:trollface: <b>Nezha Monitoring: Self-hostable, lightweight, servers and websites monitoring and O&M tool.</b></p> <p>:trollface: <b>Nezha Monitoring: Self-hostable, lightweight, servers and websites monitoring and O&M tool.</b></p>

View File

@ -1,8 +1,8 @@
{{define "theme-server-status/content-footer"}} {{define "theme-server-status/content-footer"}}
<div class="container"> <footer class="container" style="padding-bottom: 2rem;">
<p style="text-align: center; font-size: 10px;"> <p style="text-align: center; font-size: 10px;">
{{ .Title }} | Theme <a href="https://github.com/cppla/ServerStatus">ServerStatus</a> | Powered by <a {{ .Conf.Site.Brand }} | Theme <a href="https://github.com/cppla/ServerStatus">ServerStatus</a> | Powered by <a
href="https://github.com/naiba/nezha">{{tr "NezhaMonitoring"}}</a> {{.Version}} href="https://github.com/naiba/nezha">{{tr "NezhaMonitoring"}}</a> {{.Version}}
</p> </p>
</div> </footer>
{{end}} {{end}}

View File

@ -9,7 +9,10 @@
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
<a href="/" class="navbar-brand">{{.Conf.Site.Brand}}</a> <a href="/" class="navbar-brand">
<img src="/static/logo.svg?v20210804" style="height: 2rem;display: inline-block;">
{{.Conf.Site.Brand}}
</a>
</div> </div>
<div class="navbar-collapse collapse"> <div class="navbar-collapse collapse">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">

View File

@ -15,6 +15,7 @@
rel="stylesheet"/> rel="stylesheet"/>
<link rel="stylesheet" type="text/css" <link rel="stylesheet" type="text/css"
href="https://cdn.staticfile.org/semantic-ui/2.4.1/semantic.min.css"> href="https://cdn.staticfile.org/semantic-ui/2.4.1/semantic.min.css">
<link rel="shortcut icon" type="image/png" href="/static/logo.svg?v20210804" />
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="/static/theme-server-status/js/html5shiv.js"></script> <script src="/static/theme-server-status/js/html5shiv.js"></script>

View File

@ -70,7 +70,7 @@
<div style="display: flex;align-items: center;justify-content: center;flex-direction: column;"> <div style="display: flex;align-items: center;justify-content: center;flex-direction: column;">
<div style="display: flex;align-items: flex-start;justify-content: center;flex-direction: column; width: 450px;max-width: 90vw"> <div style="display: flex;align-items: flex-start;justify-content: center;flex-direction: column; width: 450px;max-width: 90vw">
<span class="node-cell-expand"> <span class="node-cell-expand">
<span class="node-cell-expand-label">系统:</span> <span class="node-cell-expand-label">{{tr "Platform"}}:</span>
@#node.host.Platform#@ @#node.host.Platform#@
</span> </span>
<span class="node-cell-expand" v-if="node.host.CPU"> <span class="node-cell-expand" v-if="node.host.CPU">

View File

@ -44,51 +44,55 @@
</table> </table>
</div> </div>
<div class="ui container" style="margin-bottom: 20px;"> <div class="container" style="margin-bottom: 20px;padding:unset">
{{if .CycleTransferStats}} {{if .CycleTransferStats}}
<h2 style="text-align: center;">{{tr "CycleTransferStats"}}</h2> <h4 style="text-align: center;">{{tr "CycleTransferStats"}}</h4>
<table class="table table-striped"> <div class="table-responsive content">
<thead> <table class="table table-striped table-condensed">
<tr> <thead>
<th>ID</th> <tr>
<th>{{tr "Rules"}}</th> <th>ID</th>
<th>{{tr "Server"}}</th> <th>{{tr "Rules"}}</th>
<th>{{tr "From"}}</th> <th>{{tr "Server"}}</th>
<th>{{tr "To"}}</th> <th>{{tr "From"}}</th>
<th>MAX</th> <th>{{tr "To"}}</th>
<th>MIN</th> <th>MAX</th>
<th>{{tr "NextCheck"}}</th> <th>MIN</th>
<th>{{tr "CurrentUsage"}}</th> <th>{{tr "NextCheck"}}</th>
<th class='ui center aligned'>{{tr "Transleft"}}</th> <th>{{tr "CurrentUsage"}}</th>
</tr> <th class='ui center aligned'>{{tr "Transleft"}}</th>
</thead> </tr>
<tbody> </thead>
{{range $id, $stats := .CycleTransferStats}} <tbody>
{{range $innerId, $transfer := $stats.Transfer}} {{range $id, $stats := .CycleTransferStats}}
{{$TransLeftPercent := TransLeftPercent (UintToFloat $transfer) (UintToFloat $stats.Max)}} {{range $innerId, $transfer := $stats.Transfer}}
<tr> {{$TransLeftPercent := TransLeftPercent (UintToFloat $transfer) (UintToFloat $stats.Max)}}
<td>{{$id}}</td> <tr>
<td>{{$stats.Name}}</td> <td>{{$id}}</td>
<td>{{index $stats.ServerName $innerId}}</td> <td>{{$stats.Name}}</td>
<td>{{$stats.From|tf}}</td> <td>{{index $stats.ServerName $innerId}}</td>
<td>{{$stats.To|tf}}</td> <td>{{$stats.From|tf}}</td>
<td>{{$stats.Max|bf}}</td> <td>{{$stats.To|tf}}</td>
<td>{{$stats.Min|bf}}</td> <td>{{$stats.Max|bf}}</td>
<td>{{(index $stats.NextUpdate $innerId)|sft}}</td> <td>{{$stats.Min|bf}}</td>
<td>{{$transfer|bf}}</td> <td>{{(index $stats.NextUpdate $innerId)|sft}}</td>
<td> <td>{{$transfer|bf}}</td>
<div class="ui progress {{TransClassName $TransLeftPercent}}" <td>
style=" background: rgba(0,0,0,.1); background-color: rgba(0,0,0,.1)!important; height: 25px; margin: unset !important"> <div class="ui progress {{TransClassName $TransLeftPercent}}"
<div class="bar" style=" background: rgba(0,0,0,.1); background-color: rgba(0,0,0,.1)!important; height: 25px; margin: unset !important">
style="transition-duration: 300ms; min-width: unset; background-color: rgb(10, 148, 242); width: {{$TransLeftPercent}}% !important"></div> <div class="bar"
<small style="position: relative; top: -2em;">{{TransLeft $stats.Max $transfer}} / style="transition-duration: 300ms; min-width: unset; background-color: rgb(10, 148, 242); width: {{$TransLeftPercent}}% !important">
{{$TransLeftPercent}} %</small></div> </div>
</td> <small style="position: relative; top: -2em;">{{TransLeft $stats.Max $transfer}} /
</tr> {{$TransLeftPercent}} %</small>
{{end}} </div>
{{end}} </td>
</tbody> </tr>
</table> {{end}}
{{end}}
</tbody>
</table>
</div>
{{end}} {{end}}
</div> </div>
{{template "theme-server-status/content-footer" .}} {{template "theme-server-status/content-footer" .}}

View File

@ -12,7 +12,7 @@ import (
"github.com/naiba/nezha/pkg/utils" "github.com/naiba/nezha/pkg/utils"
) )
var Version = "v0.15.8" // !!记得修改 README 中的 badge 版本!! var Version = "v0.15.9" // !!记得修改 README 中的 badge 版本!!
var ( var (
Conf *model.Config Conf *model.Config