Skip to content

Commit

Permalink
💄 优化 server-status 主题
Browse files Browse the repository at this point in the history
  • Loading branch information
naiba committed Nov 7, 2023
1 parent e7c2296 commit 1c00cc8
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 65 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<br>
<small><i>LOGO designed by <a href="https://xio.ng" target="_blank">熊大</a> .</i></small>
<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>
<p>:trollface: <b>Nezha Monitoring: Self-hostable, lightweight, servers and websites monitoring and O&M tool.</b></p>
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ require (
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/robfig/cron/v3 v3.0.1
github.com/samber/lo v1.38.1
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.17.0
github.com/stretchr/testify v1.8.4
github.com/xanzy/go-gitlab v0.93.1
Expand Down Expand Up @@ -71,7 +72,6 @@ require (
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.10.0 // 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/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
Expand Down
14 changes: 1 addition & 13 deletions resource/l10n/en-US.toml
Original file line number Diff line number Diff line change
Expand Up @@ -607,17 +607,5 @@ other = "Info"
[HideForGuest]
other = "No display to visitors"

[Feature]
[Menu]
other = "Menu"

[SitePV]
other = "Total page views"

[SitePVUnit]
other = "Page views"

[SiteUV]
other = "Total visitors"

[SiteUVUnit]
other = "Visitors"
16 changes: 2 additions & 14 deletions resource/l10n/es-ES.toml
Original file line number Diff line number Diff line change
Expand Up @@ -607,17 +607,5 @@ other = "Información"
[HideForGuest]
other = "No se muestra a los visitantes"

[Feature]
other = "Características"

[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"
[Menu]
other = "Menú"
16 changes: 2 additions & 14 deletions resource/l10n/zh-CN.toml
Original file line number Diff line number Diff line change
Expand Up @@ -607,17 +607,5 @@ other = "信息"
[HideForGuest]
other = "对游客隐藏"

[Feature]
other = "功能"

[SitePV]
other = "本站总访问量"

[SitePVUnit]
other = ""

[SiteUV]
other = "本站总访客数"

[SiteUVUnit]
other = "人次"
[Menu]
other = "菜单"
2 changes: 1 addition & 1 deletion resource/l10n/zh-TW.toml
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ other = "訊息"
[HideForGuest]
other = "對遊客隱藏"

[Feature]
[Menu]
other = "功能"

[SitePV]
Expand Down
2 changes: 1 addition & 1 deletion resource/template/theme-default/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
secondToDate(s) {
var d = Math.floor(s / 3600 / 24);
if (d > 0) {
return d + " {{tr "Day"}}"
return d + ' {{tr "Day"}}'
}
var h = Math.floor(s / 3600 % 24);
var m = Math.floor(s / 60 % 60);
Expand Down
7 changes: 1 addition & 6 deletions resource/template/theme-server-status/content-footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
<div class="container">
<p style="text-align: center; font-size: 10px;">
{{ .Title }} | Theme <a href="https://github.com/cppla/ServerStatus">ServerStatus</a> | Powered by <a
href="https://github.com/naiba/nezha">{{tr "NezhaMonitoring"}}</a>
</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>
href="https://github.com/naiba/nezha">{{tr "NezhaMonitoring"}}</a> {{.Version}}
</p>
</div>
{{end}}
16 changes: 9 additions & 7 deletions resource/template/theme-server-status/content-nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,30 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="#" class="navbar-brand">{{ .Title }}</a>
<a href="/" class="navbar-brand">{{.Conf.Site.Brand}}</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="/">{{tr "Home" }}</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" class="dropdown-toggle" href="#">{{tr "Feature" }}<b class="caret"></b></a>
<a data-toggle="dropdown" href="#">{{tr "Menu" }}<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="/">{{tr "Home" }}</a></li>
<li><a href="/service">{{tr "Services" }}</a></li>
{{if .Admin}}
<li><a href="/server">{{tr "AdminPanel" }} ({{.Admin.Name}})</a></li>
{{else}}
<li><a href="/login">{{tr "Login" }}</a></li>
{{end}}
<li><a href="#" @click="setSystemTheme">{{tr "SystemMode" }}
<span style="color: #fff" v-if="isSystemTheme"> ✔️</span></a>
<span style="color: #fff" v-if="isSystemTheme"> ✔️</span></a>
</li>
<li><a href="#" @click="setTheme('dark', true)">{{tr "DarkMode" }}
<span v-if="theme === 'dark' && !isSystemTheme"> ✔️</span></a>
<span v-if="theme === 'dark' && !isSystemTheme"> ✔️</span></a>
</li>
<li><a href="#" @click="setTheme('light', true)">{{tr "LightMode" }}
<span v-if="theme === 'light' && !isSystemTheme"> ✔️</span></a>
<span v-if="theme === 'light' && !isSystemTheme"> ✔️</span></a>
</li>
</ul>
</li>
Expand Down
2 changes: 0 additions & 2 deletions resource/template/theme-server-status/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
<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="/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>
<body>
{{end}}
6 changes: 3 additions & 3 deletions resource/template/theme-server-status/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
secondToDate(s) {
const d = Math.floor(s / 3600 / 24);
if (d > 0) {
return d + "天"
return d + ' {{tr "Day"}}'
}
const h = Math.floor(s / 3600 % 24);
const m = Math.floor(s / 60 % 60);
Expand Down Expand Up @@ -269,7 +269,7 @@
ws.onmessage = (evt) => {
let jsonData = evt.data
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];
if (!ns.Host) {
data.servers[i].live = false
Expand All @@ -291,7 +291,7 @@
},
handleNodes(servers) {
let nodes = []
servers.forEach(server => {
servers?.forEach(server => {
let platform = server.Host.Platform
if (this.isWindowsPlatform(server.Host.Platform)) {
platform = "windows"
Expand Down
2 changes: 1 addition & 1 deletion resource/template/theme-server-status/service.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</div>

<div class="ui container">
<div class="service-status">
<div class="service-status" style="margin-bottom: 20px;">
{{if .CycleTransferStats}}

<h2 style="text-align: center;">{{tr "CycleTransferStats"}}</h2>
Expand Down
2 changes: 1 addition & 1 deletion service/singleton/singleton.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/naiba/nezha/pkg/utils"
)

var Version = "v0.15.6" // !!记得修改 README 中的 badge 版本!!
var Version = "v0.15.7" // !!记得修改 README 中的 badge 版本!!

var (
Conf *model.Config
Expand Down

0 comments on commit 1c00cc8

Please sign in to comment.