Unverified Commit 20f665b1 authored by David Bauer's avatar David Bauer Committed by GitHub
Browse files

Merge pull request #2217 from AiyionPrime/status_page_bandwidth_limit

gluon-status-page: add bandwidth limit
parents 278f6c3b b973c8f1
...@@ -64,6 +64,16 @@ ...@@ -64,6 +64,16 @@
return v and translate('enabled') or translate('disabled') return v and translate('enabled') or translate('disabled')
end 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) local function statistics(key, format)
return string.format('<span data-statistics="%s" data-format="%s"></span>', pcdata(key), pcdata(format or 'id')) return string.format('<span data-statistics="%s" data-format="%s"></span>', pcdata(key), pcdata(format or 'id'))
end end
...@@ -122,6 +132,17 @@ ...@@ -122,6 +132,17 @@
<br /><%| nodeinfo.network.mesh_vpn.provider %> <br /><%| nodeinfo.network.mesh_vpn.provider %>
<%- end %> <%- end %>
</dd> </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 %> <%- end %>
<dt><%:Site%></dt><dd><%| site.site_name() %></dd> <dt><%:Site%></dt><dd><%| site.site_name() %></dd>
<% if nodeinfo.system.domain_code then -%> <% if nodeinfo.system.domain_code then -%>
......
...@@ -28,6 +28,9 @@ msgstr "1 Tag" ...@@ -28,6 +28,9 @@ msgstr "1 Tag"
msgid "Automatic updates" msgid "Automatic updates"
msgstr "Automatische Updates" msgstr "Automatische Updates"
msgid "Bandwidth limit"
msgstr "Bandbreitenlimit"
msgid "Channel" msgid "Channel"
msgstr "Kanal" msgstr "Kanal"
...@@ -43,6 +46,9 @@ msgstr "Entfernung" ...@@ -43,6 +46,9 @@ msgstr "Entfernung"
msgid "Domain" msgid "Domain"
msgstr "Domäne" msgstr "Domäne"
msgid "downstream"
msgstr "Downstream"
msgid "Error" msgid "Error"
msgstr "Fehler" msgstr "Fehler"
...@@ -124,6 +130,9 @@ msgstr "" ...@@ -124,6 +130,9 @@ msgstr ""
msgid "Transmitted" msgid "Transmitted"
msgstr "Gesendet" msgstr "Gesendet"
msgid "upstream"
msgstr "Upstream"
msgid "Uptime" msgid "Uptime"
msgstr "Laufzeit" msgstr "Laufzeit"
......
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"
...@@ -19,6 +19,9 @@ msgstr "" ...@@ -19,6 +19,9 @@ msgstr ""
msgid "Automatic updates" msgid "Automatic updates"
msgstr "" msgstr ""
msgid "Bandwidth limit"
msgstr ""
msgid "Channel" msgid "Channel"
msgstr "" msgstr ""
...@@ -34,6 +37,9 @@ msgstr "" ...@@ -34,6 +37,9 @@ msgstr ""
msgid "Domain" msgid "Domain"
msgstr "" msgstr ""
msgid "downstream"
msgstr ""
msgid "Error" msgid "Error"
msgstr "" msgstr ""
...@@ -115,6 +121,9 @@ msgstr "" ...@@ -115,6 +121,9 @@ msgstr ""
msgid "Transmitted" msgid "Transmitted"
msgstr "" msgstr ""
msgid "upstream"
msgstr ""
msgid "Uptime" msgid "Uptime"
msgstr "" msgstr ""
......
...@@ -10,6 +10,7 @@ if we ever add Russion to gluon-web, the following strings can be reused: ...@@ -10,6 +10,7 @@ if we ever add Russion to gluon-web, the following strings can be reused:
"Primary MAC": "Основной MAC", "Primary MAC": "Основной MAC",
"IP Address": "IP Адрес", "IP Address": "IP Адрес",
"Automatic updates": "Автоматические обновления", "Automatic updates": "Автоматические обновления",
"Bandwidth limit": "Ограничение пропускной способности",
"Overview": "Обзор", "Overview": "Обзор",
"used": "используется", "used": "используется",
"Uptime": "Время работы", "Uptime": "Время работы",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment