Commit b973c8f1 authored by aiyion.prime's avatar aiyion.prime
Browse files

gluon-status-page: show bandwidth limits

parent edff676d
......@@ -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 -%>
......
......@@ -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"
......
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 ""
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 ""
......
......@@ -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": "Время работы",
......
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