💄 优化 server-status 主题

This commit is contained in:
naiba 2023-11-07 22:15:13 +08:00
parent e7c22968b6
commit 1c00cc8e3b
13 changed files with 24 additions and 65 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.6&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.6&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.7&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.7&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>

2
go.mod
View File

@ -20,6 +20,7 @@ require (
github.com/patrickmn/go-cache v2.1.0+incompatible github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/robfig/cron/v3 v3.0.1 github.com/robfig/cron/v3 v3.0.1
github.com/samber/lo v1.38.1 github.com/samber/lo v1.38.1
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.17.0 github.com/spf13/viper v1.17.0
github.com/stretchr/testify v1.8.4 github.com/stretchr/testify v1.8.4
github.com/xanzy/go-gitlab v0.93.1 github.com/xanzy/go-gitlab v0.93.1
@ -71,7 +72,6 @@ require (
github.com/sourcegraph/conc v0.3.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.10.0 // indirect github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect github.com/ugorji/go/codec v1.2.11 // indirect

View File

@ -607,17 +607,5 @@ other = "Info"
[HideForGuest] [HideForGuest]
other = "No display to visitors" other = "No display to visitors"
[Feature] [Menu]
other = "Menu" other = "Menu"
[SitePV]
other = "Total page views"
[SitePVUnit]
other = "Page views"
[SiteUV]
other = "Total visitors"
[SiteUVUnit]
other = "Visitors"

View File

@ -607,17 +607,5 @@ other = "Información"
[HideForGuest] [HideForGuest]
other = "No se muestra a los visitantes" other = "No se muestra a los visitantes"
[Feature] [Menu]
other = "Características" other = "Menú"
[SitePV]
other = "Número total de visitas al sitio"
[SitePVUnit]
other = "visitas"
[SiteUV]
other = "Número total de visitantes únicos al sitio"
[SiteUVUnit]
other = "visitantes únicos"

View File

@ -607,17 +607,5 @@ other = "信息"
[HideForGuest] [HideForGuest]
other = "对游客隐藏" other = "对游客隐藏"
[Feature] [Menu]
other = "功能" other = "菜单"
[SitePV]
other = "本站总访问量"
[SitePVUnit]
other = "次"
[SiteUV]
other = "本站总访客数"
[SiteUVUnit]
other = "人次"

View File

@ -607,7 +607,7 @@ other = "訊息"
[HideForGuest] [HideForGuest]
other = "對遊客隱藏" other = "對遊客隱藏"
[Feature] [Menu]
other = "功能" other = "功能"
[SitePV] [SitePV]

View File

@ -227,7 +227,7 @@
secondToDate(s) { secondToDate(s) {
var d = Math.floor(s / 3600 / 24); var d = Math.floor(s / 3600 / 24);
if (d > 0) { if (d > 0) {
return d + " {{tr "Day"}}" return d + ' {{tr "Day"}}'
} }
var h = Math.floor(s / 3600 % 24); var h = Math.floor(s / 3600 % 24);
var m = Math.floor(s / 60 % 60); var m = Math.floor(s / 60 % 60);

View File

@ -2,12 +2,7 @@
<div class="container"> <div class="container">
<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 {{ .Title }} | Theme <a href="https://github.com/cppla/ServerStatus">ServerStatus</a> | Powered by <a
href="https://github.com/naiba/nezha">{{tr "NezhaMonitoring"}}</a> href="https://github.com/naiba/nezha">{{tr "NezhaMonitoring"}}</a> {{.Version}}
</p>
<p style="text-align: center; font-size: 10px;">
<span id="busuanzi_container_site_pv" style="display: none">
{{tr "SitePV" }} <span id="busuanzi_value_site_pv"></span> {{tr "SitePVUnit" }} | {{tr "SiteUV" }} <span id="busuanzi_value_site_uv"></span> {{tr "SiteUVUnit" }}
</span>
</p> </p>
</div> </div>
{{end}} {{end}}

View File

@ -9,15 +9,17 @@
<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">{{ .Title }}</a> <a href="/" class="navbar-brand">{{.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">
<li class="dropdown">
<a data-toggle="dropdown" class="dropdown-toggle" href="#">{{tr "Feature" }}<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="/">{{tr "Home" }}</a></li> <li><a href="/">{{tr "Home" }}</a></li>
<li><a href="/service">{{tr "Services" }}</a></li> <li><a href="/service">{{tr "Services" }}</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a data-toggle="dropdown" href="#">{{tr "Menu" }}<b class="caret"></b></a>
<ul class="dropdown-menu">
{{if .Admin}} {{if .Admin}}
<li><a href="/server">{{tr "AdminPanel" }} ({{.Admin.Name}})</a></li> <li><a href="/server">{{tr "AdminPanel" }} ({{.Admin.Name}})</a></li>
{{else}} {{else}}

View File

@ -28,8 +28,6 @@
<script src="/static/theme-server-status/js/bootstrap.min.js"></script> <script src="/static/theme-server-status/js/bootstrap.min.js"></script>
<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script> <script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
<script src="/static/theme-server-status/js/mixin.js"></script> <script src="/static/theme-server-status/js/mixin.js"></script>
<!-- custom code 引入这段代码即可开启卜算子统计 -->
<!--<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>-->
</head> </head>
<body> <body>
{{end}} {{end}}

View File

@ -214,7 +214,7 @@
secondToDate(s) { secondToDate(s) {
const d = Math.floor(s / 3600 / 24); const d = Math.floor(s / 3600 / 24);
if (d > 0) { if (d > 0) {
return d + "天" return d + ' {{tr "Day"}}'
} }
const h = Math.floor(s / 3600 % 24); const h = Math.floor(s / 3600 % 24);
const m = Math.floor(s / 60 % 60); const m = Math.floor(s / 60 % 60);
@ -269,7 +269,7 @@
ws.onmessage = (evt) => { ws.onmessage = (evt) => {
let jsonData = evt.data let jsonData = evt.data
const data = JSON.parse(jsonData) const data = JSON.parse(jsonData)
for (let i = 0; i < data.servers.length; i++) { for (let i = 0; i < data.servers?.length; i++) {
const ns = data.servers[i]; const ns = data.servers[i];
if (!ns.Host) { if (!ns.Host) {
data.servers[i].live = false data.servers[i].live = false
@ -291,7 +291,7 @@
}, },
handleNodes(servers) { handleNodes(servers) {
let nodes = [] let nodes = []
servers.forEach(server => { servers?.forEach(server => {
let platform = server.Host.Platform let platform = server.Host.Platform
if (this.isWindowsPlatform(server.Host.Platform)) { if (this.isWindowsPlatform(server.Host.Platform)) {
platform = "windows" platform = "windows"

View File

@ -45,7 +45,7 @@
</div> </div>
<div class="ui container"> <div class="ui container">
<div class="service-status"> <div class="service-status" style="margin-bottom: 20px;">
{{if .CycleTransferStats}} {{if .CycleTransferStats}}
<h2 style="text-align: center;">{{tr "CycleTransferStats"}}</h2> <h2 style="text-align: center;">{{tr "CycleTransferStats"}}</h2>

View File

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