new servers page

master
alice 4 years ago
parent 4b9d6371bd
commit a6d15ac90b

@ -40,6 +40,8 @@ def get_locations():
for (_), loc in locations: for (_), loc in locations:
code = loc['country_code'].upper() code = loc['country_code'].upper()
loc['country_name'] = countries_d.get(code, code) loc['country_name'] = countries_d.get(code, code)
loc['load_percent'] = (loc['usage'].get('net', 0) / (loc['bandwidth'] / 1e6)) * 100
return locations return locations
@ -448,12 +450,7 @@ def status(request):
locations = get_locations() locations = get_locations()
ctx = { ctx = {
'title': _("Status"), 'title': _("Servers"),
'n_users': VPNUser.objects.filter(expiration__gte=timezone.now()).count(),
'n_sess': django_lcore.count_active_sessions(),
'n_gws': sum(len(l['servers']) for cc, l in locations),
'n_countries': len(set(cc for cc, l in locations)),
'total_bw': sum(l['bandwidth'] for cc, l in locations),
'locations': locations, 'locations': locations,
} }
return render(request, 'lambdainst/status.html', ctx) return render(request, 'lambdainst/status.html', ctx)

@ -11,6 +11,8 @@ html, body {
body { body {
margin: 0 auto; margin: 0 auto;
background: #eee; background: #eee;
display: flex;
flex-direction: column;
} }
html, button, input, select, textarea, html, button, input, select, textarea,
@ -229,12 +231,11 @@ header .site-menu a{
.content { .content {
padding: 0em 2em 3em 2em; padding: 0em 2em 3em 2em;
background: #fff; flex-grow: 1;
overflow: auto; min-height: min-content;
}
-webkit-box-shadow: -1px 1px 2px -1px rgba(0,0,0,0.53); .content.pure-g {
-moz-box-shadow: -1px 1px 2px -1px rgba(0,0,0,0.53); justify-content: center;
box-shadow: -1px 1px 2px -1px rgba(0,0,0,0.53);
} }
.content h1 { .content h1 {
@ -246,6 +247,12 @@ header .site-menu a{
.content h2 { .content h2 {
font-size: 1.5em; font-size: 1.5em;
font-weight: normal; font-weight: normal;
font-weight: 400;
text-align: center;
font-family: 'Arvo', serif;
font-size: 1.6em;
margin: 1em;
} }
.content h3 { .content h3 {
@ -816,12 +823,16 @@ a.home-signup-button {
#gateways table { #gateways table {
width: 100%; width: 100%;
} }
#gateways td {
padding: 10px;
}
#gateways table thead td { #gateways table thead td {
text-align: center; text-align: center;
font-size: 1.1em; font-size: 1.1em;
font-weight: 600;
border: 1px solid #bbb; border: 1px solid #bbb;
border-top: 0; border-top: 0;
color: #1c619a;
background: #ddd;
} }
#gateways table thead tr td:first-child { #gateways table thead tr td:first-child {
border-left: 0; border-left: 0;
@ -830,11 +841,9 @@ a.home-signup-button {
border-right: 0; border-right: 0;
} }
#gateways table tbody tr td:first-child { #gateways table tbody tr td:first-child {
font-size: 1.2em;
border-left: 0; border-left: 0;
} }
#gateways table tbody tr td { #gateways table tbody tr td {
padding: 10px;
border: 1px solid #bbb; border: 1px solid #bbb;
} }
#gateways table tbody tr td:first-child { #gateways table tbody tr td:first-child {
@ -849,17 +858,15 @@ a.home-signup-button {
#gateways table tbody tr:nth-child(even) { #gateways table tbody tr:nth-child(even) {
background: #eee; background: #eee;
} }
#gateways table tr td:not(:first-child) {
width: 20%;
}
#gateways table tr td .td-info {
display: block;
font-size: 0.8em;
font-weight: normal;
}
#gateways .host_name { #gateways .host_name {
font-family: monospace; font-family: monospace;
} }
#gateways td {
white-space: nowrap;
}
#gateways .right {
text-align: right;
}
/***************************************************/ /***************************************************/

@ -57,7 +57,7 @@
{{gateway_locations|json_script:"locations-data"}} {{gateway_locations|json_script:"locations-data"}}
<script type="text/javascript" src="{% static 'js/map.js' %}"></script> <script type="text/javascript" src="{% static 'js/map.js' %}"></script>
<p class="more"> <p class="more">
<a href="/servers">more on our infrastructure</a> <a href="/status">more on our infrastructure</a>
</p> </p>
</div> </div>

@ -4,58 +4,36 @@
{% load bw %} {% load bw %}
{% block content %} {% block content %}
<div class="content" id="gateways"> <div class="pure-g content">
<h1>{% trans 'Our Servers' %}</h1> <div class="pure-u-1 pure-u-xl-2-3" id="gateways">
<h2>{% trans 'Our Servers' %}</h2>
<ul>
<li>
{% blocktrans trimmed with n_users=n_users %}
We have <em>{{ n_users }}</em> active users.
{% endblocktrans %}
{% blocktrans trimmed with n_sess=n_sess %}
<em>{{ n_sess }}</em> are using our VPN right now.
{% endblocktrans %}
</li>
<li>
{% blocktrans trimmed with n_gw=n_gw n_countries=n_countries %}
They are connected to <em>{{ n_gws }}</em> servers spread across
<em>{{ n_countries }}</em> countries to provide a low-latency
and secure access anywhere in the world.
{% endblocktrans %}
</li>
<li>
{% with total_bw|bwformat as total_bw_f %}
{% blocktrans trimmed with total_bw=total_bw_f %}
Our network has a total bandwidth of <em>{{ total_bw }}</em> and
all our servers are DDoS-protected.
{% endblocktrans %}
{% endwith %}
</li>
</ul>
<h2>{% trans 'Locations' %}</h2>
<table> <table>
<thead> <thead>
<tr><td>{% trans 'Location' %}</td> <tr><td>{% trans 'Location' %}</td>
<td>{% trans 'Hostname' %}</td> <td>{% trans 'Hostname' %}</td>
<td>{% trans 'Servers' %}</td> <td>{% trans 'Servers' %}</td>
<td>{% trans 'Bandwidth' %}</td> <td>{% trans 'Load' %}</td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for country, d in locations %} {% for country, d in locations %}
<tr><td>{{ d.country_name }}</td> <tr><td class="left">{{ d.country_name }}</td>
<td class="host_line"> <td class="left host_line">
<span class="host_name">{{ d.hostname }}</span> <span class="host_name">{{ d.hostname }}</span>
</td> </td>
<td>{{ d.servers|length }}</td> <td class="right">{{ d.servers|length }}</td>
<td>{{ d.bandwidth|bwformat }}</td> <td class="right">
{{ d.load_percent|floatformat:1 }}%
of
{{ d.bandwidth|bwformat }}
</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
</div> </div>
<script type="text/javascript" src="/static/ping.js"></script> </div>
</section> <script type="text/javascript" src="/static/ping.js"></script>
{% endblock %} {% endblock %}

Loading…
Cancel
Save