Merge branch 'master' into l10n_master

This commit is contained in:
naiba
2022-04-30 10:25:29 +08:00
committed by GitHub
33 changed files with 291 additions and 256 deletions

View File

@@ -1,3 +1,19 @@
let LANG = {
Add: "添加",
Edit: "修改",
AlarmRule: "报警规则",
Notification: "通知方式",
Server: "服务器",
Monitor: "监控",
Cron: "计划任务",
}
function updateLang(newLang) {
if (newLang) {
LANG = newLang;
}
}
function readableBytes(bytes) {
if (!bytes) {
return '0B'
@@ -105,11 +121,11 @@ function showFormModal(modelSelector, formID, URL, getData) {
function addOrEditAlertRule(rule) {
const modal = $(".rule.modal");
modal.children(".header").text((rule ? "修改" : "添加") + "报警规则");
modal.children(".header").text((rule ? LANG.Edit : LANG.Add) + ' ' + LANG.AlarmRule);
modal
.find(".nezha-primary-btn.button")
.html(
rule ? '修改<i class="edit icon"></i>' : '添加<i class="add icon"></i>'
rule ? LANG.Edit + '<i class="edit icon"></i>' : LANG.Add + '<i class="add icon"></i>'
);
modal.find("input[name=ID]").val(rule ? rule.ID : null);
modal.find("input[name=Name]").val(rule ? rule.Name : null);
@@ -125,13 +141,13 @@ function addOrEditAlertRule(rule) {
function addOrEditNotification(notification) {
const modal = $(".notification.modal");
modal.children(".header").text((notification ? "修改" : "添加") + "通知方式");
modal.children(".header").text((notification ? LANG.Edit : LANG.Add) + ' ' + LANG.Notification);
modal
.find(".nezha-primary-btn.button")
.html(
notification
? '修改<i class="edit icon"></i>'
: '添加<i class="add icon"></i>'
? LANG.Edit + '<i class="edit icon"></i>'
: LANG.Add + '<i class="add icon"></i>'
);
modal.find("input[name=ID]").val(notification ? notification.ID : null);
modal.find("input[name=Name]").val(notification ? notification.Name : null);
@@ -188,11 +204,11 @@ function post(path, params, method = 'post') {
function addOrEditServer(server, conf) {
const modal = $(".server.modal");
modal.children(".header").text((server ? "修改" : "添加") + "服务器");
modal.children(".header").text((server ? LANG.Edit : LANG.Add) + ' ' + LANG.Server);
modal
.find(".nezha-primary-btn.button")
.html(
server ? '修改<i class="edit icon"></i>' : '添加<i class="add icon"></i>'
server ? LANG.Edit + '<i class="edit icon"></i>' : LANG.Add + '<i class="add icon"></i>'
);
modal.find("input[name=id]").val(server ? server.ID : null);
modal.find("input[name=name]").val(server ? server.Name : null);
@@ -216,11 +232,11 @@ function addOrEditServer(server, conf) {
function addOrEditMonitor(monitor) {
const modal = $(".monitor.modal");
modal.children(".header").text((monitor ? "修改" : "添加") + "监控");
modal.children(".header").text((monitor ? LANG.Edit : LANG.Add) + ' ' + LANG.Monitor);
modal
.find(".nezha-primary-btn.button")
.html(
monitor ? '修改<i class="edit icon"></i>' : '添加<i class="add icon"></i>'
monitor ? LANG.Edit + '<i class="edit icon"></i>' : LANG.Add + '<i class="add icon"></i>'
);
modal.find("input[name=ID]").val(monitor ? monitor.ID : null);
modal.find("input[name=Name]").val(monitor ? monitor.Name : null);
@@ -257,11 +273,11 @@ function addOrEditMonitor(monitor) {
function addOrEditCron(cron) {
const modal = $(".cron.modal");
modal.children(".header").text((cron ? "修改" : "添加") + "计划任务");
modal.children(".header").text((cron ? LANG.Edit : LANG.Add) + ' ' + LANG.Cron);
modal
.find(".nezha-primary-btn.button")
.html(
cron ? '修改<i class="edit icon"></i>' : '添加<i class="add icon"></i>'
cron ? LANG.Edit + '<i class="edit icon"></i>' : LANG.Add + '<i class="add icon"></i>'
);
modal.find("input[name=ID]").val(cron ? cron.ID : null);
modal.find("input[name=Name]").val(cron ? cron.Name : null);

View File

@@ -1,16 +1,22 @@
{{define "common/footer"}}
<div class="ui inverted vertical footer segment">
<div class="ui center aligned is-size-7 container">
<b>&copy; <a style="color: white;" href="/">{{.Conf.Site.Brand}}</a></b> | <small>Powered by <a href="https://github.com/naiba/nezha"
style="color: white;" target="_blank">{{tr "nezhaMonitor"}}</a> {{.Version}}</small>
<b>&copy; <a style="color: white;" href="/">{{.Conf.Site.Brand}}</a></b> | <small>Powered by <a
href="https://github.com/naiba/nezha" style="color: white;" target="_blank">{{tr "NezhaMonitoring"}}</a>
{{.Version}}</small>
</div>
</div>
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.4.1/jquery.min.js"></script>
<script src="https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/semantic-ui/2.4.1/semantic.min.js"></script>
<script src="/static/semantic-ui-alerts.min.js"></script>
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/vue/2.6.12/vue.min.js"></script>
<script src="/static/main.js?v20220423"></script>
<script src="/static/main.js?v20220430"></script>
<script>
(function () {
updateLang({{.LANG }});
})();
</script>
</body>
</html>
{{end}}
{{end}}

View File

@@ -1,9 +1,9 @@
{{define "common/menu"}}
<div class="ui large top fixed menu nb-menu">
<div class="ui container">
<div class="item">
<a class="item" href="/">
<img src="/static/logo.svg?v20210804">
</div>
</a>
{{if .IsAdminPage}}
<a class='item{{if eq .MatchedPath "/server"}} active{{end}}' href="/server"><i class="server icon"></i>{{tr "Server"}}</a>
<a class='item{{if eq .MatchedPath "/monitor"}} active{{end}}' href="/monitor"><i class="rss icon"></i>{{tr "Services"}}</a>

View File

@@ -33,7 +33,7 @@
</div>
</div>
<div class="field">
<label>{{tr "NotificationMethod"}}}</label>
<label>{{tr "NotificationMethodGroup"}}}</label>
<input type="text" name="NotificationTag" placeholder="default">
</div>
<div class="field">

View File

@@ -45,7 +45,7 @@
</div>
</div>
<div class="field">
<label>{{tr "NotificationMethod"}}</label>
<label>{{tr "NotificationMethodGroup"}}</label>
<input type="text" name="NotificationTag" placeholder="default" />
</div>
<div class="field">

View File

@@ -13,7 +13,7 @@
<textarea name="RulesRaw"></textarea>
</div>
<div class="field">
<label>{{tr "NotificationMethod"}}</label>
<label>{{tr "NotificationMethodGroup"}}</label>
<input type="text" name="NotificationTag" placeholder="default">
</div>
<div class="field">

View File

@@ -17,7 +17,7 @@
<th>{{tr "Name"}}</th>
<th>{{tr "Scheduler"}}</th>
<th>{{tr "Command"}}</th>
<th>{{tr "NotificationMethod"}}</th>
<th>{{tr "NotificationMethodGroup"}}</th>
<th>{{tr "PushSuccessfully"}}</th>
<th>{{tr "Coverage"}}</th>
<th>{{tr "SpecificServers"}}</th>

View File

@@ -19,7 +19,7 @@
<th>{{tr "SpecificServers"}}</th>
<th>{{tr "Type"}}</th>
<th>{{tr "Duration"}}</th>
<th>{{tr "NotificationMethod"}}</th>
<th>{{tr "NotificationMethodGroup"}}</th>
<th>{{tr "Notification"}}</th>
<th>{{tr "Administration"}}</th>
</tr>
@@ -36,7 +36,7 @@
{{if eq $monitor.Type 1}}{{tr "SSLCertificate"}} {{else if eq $monitor.Type
2}} ICMP Ping {{else}} {{tr "TCPPort"}} {{end}}
</td>
<td>{{$monitor.Duration}}{{tr "Seconds"}}</td>
<td>{{$monitor.Duration}} {{tr "Seconds"}}</td>
<td>{{$monitor.NotificationTag}}</td>
<td>{{$monitor.Notify}}</td>
<td>

View File

@@ -57,7 +57,7 @@
<tr>
<th>ID</th>
<th>{{tr "Name"}}</th>
<th>{{tr "NotificationMethod"}}</th>
<th>{{tr "NotificationMethodGroup"}}</th>
<th>{{tr "Rules"}}</th>
<th>{{tr "Enable"}}</th>
<th>{{tr "Administration"}}</th>

View File

@@ -44,15 +44,11 @@
data-tooltip="{{tr "ClickToCopyTheInstallationCommand"}}">
<i class="linux icon"></i>
</button>
<button class="ui icon mini button" data-tooltip="{{tr "NotSupportedYet"}}">
<button class="ui icon green mini button"
data-clipboard-text="{{if $.Conf.GRPCHost}}set-ExecutionPolicy RemoteSigned;Invoke-WebRequest https://raw.githubusercontent.com/naiba/nezha/master/script/install.ps1 -OutFile C:\install.ps1;powershell.exe C:\install.ps1 {{$.Conf.GRPCHost}}:{{if $.Conf.ProxyGRPCPort}}{{$.Conf.ProxyGRPCPort}}{{else}}{{$.Conf.GRPCPort}}{{end}} {{$server.Secret}}{{if $.Conf.TLS}} --tls{{end}}{{else}}{{tr "NoDomainAlert"}}{{end}}"
data-tooltip="{{tr "ClickToCopyTheInstallationCommand"}}">
<i class="windows icon"></i>
</button>
<button class="ui icon mini button" data-tooltip="{{tr "NotSupportedYet"}}">
<i class="apple icon"></i>
</button>
</td>
<td style="word-break: break-word;">{{$server.Note}}</td>
<td>

View File

@@ -6,7 +6,7 @@
<form id="settingForm" class="ui large form" onsubmit="return false;">
<div class="field">
<label>{{tr "SiteTitle"}}</label>
<input type="text" name="Title" placeholder="{{tr "nezhaMonitor"}}" value="{{.Conf.Site.Brand}}">
<input type="text" name="Title" placeholder="{{tr "NezhaMonitoring"}}" value="{{.Conf.Site.Brand}}">
</div>
<div class="field">
<label>{{tr "AdministratorList"}}</label>
@@ -24,12 +24,21 @@
<option value="mdui" {{if eq .Conf.Site.Theme "mdui" }} selected="selected" {{end}}>Neko Mdui</option>
</select>
</div>
<div class="field">
<label>Language</label>
<select name="Language">
<option value="zh-CN" {{if eq .Conf.Language "zh-CN" }} selected="selected" {{end}}>
简体中文</option>
<option value="en-US" {{if eq .Conf.Language "en-US" }} selected="selected" {{end}}>
English</option>
</select>
</div>
<div class="field">
<label>{{tr "CustomCodes"}}</label>
<textarea name="CustomCode">{{.Conf.Site.CustomCode}}</textarea>
</div>
<div class="field">
<label>{{tr "AccessPassword"}}}</label>
<label>{{tr "AccessPassword"}}</label>
<input type="text" name="ViewPassword" placeholder="" value="{{.Conf.Site.ViewPassword}}">
</div>
<div class="field">
@@ -86,6 +95,7 @@
time: '3',
position: 'top-center',
});
window.location.reload()
} else {
$.suiAlert({
title: '',

View File

@@ -23,7 +23,7 @@
<section class="nav-bar clearfix">
<figure class="logo">
<a href="/">
<img src="/static/logo.svg?v20210804" alt='{{tr "nezhaMonitor"}}' width="50" height="50">
<img src="/static/logo.svg?v20210804" alt='{{tr "NezhaMonitoring"}}' width="50" height="50">
</a>
<a href="/">{{.Conf.Site.Brand}}</a>
</figure>
@@ -155,7 +155,7 @@
<footer>
<div class="footer-container">
<div><a href="https://github.com/naiba/nezha" target="_blank">Powered by {{tr "nezhaMonitor"}} · {{.Version}}</a>
<div><a href="https://github.com/naiba/nezha" target="_blank">Powered by {{tr "NezhaMonitoring"}} · {{.Version}}</a>
<p>&copy; <span id="copyright-date">
<script>document.getElementById('copyright-date').appendChild(document.createTextNode(new Date().getFullYear()))</script>
</span> · <a href="https://blog.jackiesung.com" target="_blank">Theme designed by Jackie Sung</a>
@@ -239,7 +239,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);

View File

@@ -118,7 +118,7 @@
<footer>
<div class="footer-container">
<div>
<a href="https://github.com/naiba/nezha" target="_blank">Powered by {{tr "nezhaMonitor"}} · {{.Version}}</a>
<a href="https://github.com/naiba/nezha" target="_blank">Powered by {{tr "NezhaMonitoring"}} · {{.Version}}</a>
<p>
&copy;
<span id="copyright-date"

View File

@@ -42,7 +42,7 @@
<footer>
<div class="footer-container">
<div>
<a href="https://github.com/naiba/nezha" target="_blank">Powered by {{tr "nezhaMonitor"}} · {{.Version}}</a>
<a href="https://github.com/naiba/nezha" target="_blank">Powered by {{tr "NezhaMonitoring"}} · {{.Version}}</a>
<p>
&copy;<span id="copyright-date"
><script>

View File

@@ -20,23 +20,23 @@
@#server.Name + (server.live?'':'[{{tr "Offline"}}]')#@
<i class="nezha-secondary-font info circle icon" style="height: 28px"></i>
<div class="ui content popup" style="margin-bottom: 0">
{{tr "Platform"}}:@#server.Host.Platform#@-@#server.Host.PlatformVersion#@
{{tr "Platform"}}: @#server.Host.Platform#@-@#server.Host.PlatformVersion#@
[<span
v-if="server.Host.Virtualization">@#server.Host.Virtualization#@:</span>@#server.Host.Arch#@]<br />
CPU:@#server.Host.CPU#@<br />
{{tr "DiskUsed"}}:@#formatByteSize(server.State.DiskUsed)#@/@#formatByteSize(server.Host.DiskTotal)#@<br />
{{tr "MemUsed"}}:@#formatByteSize(server.State.MemUsed)#@/@#formatByteSize(server.Host.MemTotal)#@<br />
{{tr "SwapUsed"}}:@#formatByteSize(server.State.SwapUsed)#@/@#formatByteSize(server.Host.SwapTotal)#@<br />
{{tr "NetTransfer"}}:<i
CPU: @#server.Host.CPU#@<br />
{{tr "DiskUsed"}}: @#formatByteSize(server.State.DiskUsed)#@/@#formatByteSize(server.Host.DiskTotal)#@<br />
{{tr "MemUsed"}}: @#formatByteSize(server.State.MemUsed)#@/@#formatByteSize(server.Host.MemTotal)#@<br />
{{tr "SwapUsed"}}: @#formatByteSize(server.State.SwapUsed)#@/@#formatByteSize(server.Host.SwapTotal)#@<br />
{{tr "NetTransfer"}}: <i
class="arrow alternate circle down outline icon"></i>@#formatByteSize(server.State.NetInTransfer)#@<i
class="arrow alternate circle up outline icon"></i>@#formatByteSize(server.State.NetOutTransfer)#@<br />
{{tr "Load"}}:@# toFixed2(server.State.Load1) #@/@# toFixed2(server.State.Load5) #@/@#
{{tr "Load"}}: @# toFixed2(server.State.Load1) #@/@# toFixed2(server.State.Load5) #@/@#
toFixed2(server.State.Load15) #@<br />
{{tr "ProcessCount"}}:@# server.State.ProcessCount #@<br />
{{tr "ConnCount"}}:TCP @# server.State.TcpConnCount #@ / UDP @# server.State.UdpConnCount #@<br />
{{tr "BootTime"}}:@# formatTimestamp(server.Host.BootTime) #@<br />
{{tr "LastActive"}}:@# new Date(server.LastActive).toLocaleString() #@<br />
{{tr "Version"}}:@#server.Host.Version#@<br />
{{tr "ProcessCount"}}: @# server.State.ProcessCount #@<br />
{{tr "ConnCount"}}: TCP @# server.State.TcpConnCount #@ / UDP @# server.State.UdpConnCount #@<br />
{{tr "BootTime"}}: @# formatTimestamp(server.Host.BootTime) #@<br />
{{tr "LastActive"}}: @# new Date(server.LastActive).toLocaleString() #@<br />
{{tr "Version"}}: @#server.Host.Version#@<br />
</div>
<div class="ui divider" style="margin-bottom: 5px"></div>
</div>
@@ -163,7 +163,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);

View File

@@ -135,7 +135,7 @@
</ul>
</div>
<footer>
<p style="text-align:center;padding: 15px;">Powered by <a href="https://github.com/naiba/nezha">{{tr "nezhaMonitor"}}</a> build ·
<p style="text-align:center;padding: 15px;">Powered by <a href="https://github.com/naiba/nezha">{{tr "NezhaMonitoring"}}</a> build ·
{{.Version}}
<a href="/service">{{tr "Services"}}</a>
<a href="/server">{{tr "AdminPanel"}}</a>
@@ -219,7 +219,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);

View File

@@ -5,7 +5,7 @@
<center>
<p>
<a href="/"><at>{{.Title}}</at></a>
Powered by <a href="https://github.com/naiba/nezha"><st>{{tr "nezhaMonitor"}}&lt;{{.Version}}&gt;</st></a>&nbsp;| Theme designed by Mikoy Chinese
Powered by <a href="https://github.com/naiba/nezha"><st>{{tr "NezhaMonitoring"}}&lt;{{.Version}}&gt;</st></a>&nbsp;| Theme designed by Mikoy Chinese
</p>
</center>
</div>

View File

@@ -178,7 +178,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);