Merge pull request #2217 from AiyionPrime/status_page_bandwidth_limit

gluon-status-page: add bandwidth limit
This commit is contained in:
David Bauer 2021-06-08 01:37:36 +02:00 committed by GitHub
commit 20f665b16d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 0 deletions

View File

@ -64,6 +64,16 @@
return v and translate('enabled') or translate('disabled')
end
local function formatBits(bits)
local units = {[0]='', 'k', 'M', 'G'}
local pow = math.floor(math.log(math.max(math.abs(bits), 1)) / math.log(1000))
local known_pow = math.min(pow, #units)
local significand = bits/(1000^known_pow)
return string.format('%g %sbit', significand, units[known_pow])
end
local function statistics(key, format)
return string.format('<span data-statistics="%s" data-format="%s"></span>', pcdata(key), pcdata(format or 'id'))
end
@ -122,6 +132,17 @@
<br /><%| nodeinfo.network.mesh_vpn.provider %>
<%- end %>
</dd>
<% if nodeinfo.network.mesh_vpn.bandwidth_limit.enabled then -%>
<dt><%:Bandwidth limit%></dt>
<dd>
<% if nodeinfo.network.mesh_vpn.bandwidth_limit.egress then -%>
<%| formatBits(nodeinfo.network.mesh_vpn.bandwidth_limit.egress*1000) %>/s <%:upstream%><br />
<%- end %>
<% if nodeinfo.network.mesh_vpn.bandwidth_limit.ingress then -%>
<%| formatBits(nodeinfo.network.mesh_vpn.bandwidth_limit.ingress*1000) %>/s <%:downstream%>
<%- end %>
</dd>
<%- end %>
<%- end %>
<dt><%:Site%></dt><dd><%| site.site_name() %></dd>
<% if nodeinfo.system.domain_code then -%>

View File

@ -28,6 +28,9 @@ msgstr "1 Tag"
msgid "Automatic updates"
msgstr "Automatische Updates"
msgid "Bandwidth limit"
msgstr "Bandbreitenlimit"
msgid "Channel"
msgstr "Kanal"
@ -43,6 +46,9 @@ msgstr "Entfernung"
msgid "Domain"
msgstr "Domäne"
msgid "downstream"
msgstr "Downstream"
msgid "Error"
msgstr "Fehler"
@ -124,6 +130,9 @@ msgstr ""
msgid "Transmitted"
msgstr "Gesendet"
msgid "upstream"
msgstr "Upstream"
msgid "Uptime"
msgstr "Laufzeit"

View File

@ -0,0 +1,10 @@
Draft for french translation, taken from gluon-config-mode-mesh-vpn
msgid ""
msgstr ""
msgid "downstream"
msgstr "débit déscendant"
msgid "upstream"
msgstr "débit ascendant"

View File

@ -19,6 +19,9 @@ msgstr ""
msgid "Automatic updates"
msgstr ""
msgid "Bandwidth limit"
msgstr ""
msgid "Channel"
msgstr ""
@ -34,6 +37,9 @@ msgstr ""
msgid "Domain"
msgstr ""
msgid "downstream"
msgstr ""
msgid "Error"
msgstr ""
@ -115,6 +121,9 @@ msgstr ""
msgid "Transmitted"
msgstr ""
msgid "upstream"
msgstr ""
msgid "Uptime"
msgstr ""

View File

@ -10,6 +10,7 @@ if we ever add Russion to gluon-web, the following strings can be reused:
"Primary MAC": "Основной MAC",
"IP Address": "IP Адрес",
"Automatic updates": "Автоматические обновления",
"Bandwidth limit": "Ограничение пропускной способности",
"Overview": "Обзор",
"used": "используется",
"Uptime": "Время работы",