monitoring/ffmap/web/templates/router.html

198 lines
7.0 KiB
HTML
Raw Normal View History

2015-10-02 23:53:47 +02:00
{% extends "bootstrap.html" %}
{% block head %}{{super()}}
2015-10-12 14:27:20 +02:00
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
2015-10-02 23:53:47 +02:00
<style type="text/css">
#map {
height: 400px;
width: 100%;
}
.navbar, .table-condensed {
margin-bottom: 0;
}
2015-10-07 16:19:07 +02:00
.table-condensed tr:last-child td, th {
border-bottom: 1px solid #ddd;
}
2015-10-12 18:09:39 +02:00
li.list-group-item:hover {
background-color: #f5f5f5;
}
2015-10-02 23:53:47 +02:00
</style>
{% endblock %}
{% block content %}
<h1>Router: {{ router.hostname }}</h1>
<div class="row">
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-body" style="padding: 0;">
<div id="map"></div>
<script type="text/javascript">
2015-10-07 16:19:07 +02:00
var url_get_nearest_router = "{{ url_for('api.get_nearest_router') }}";
2015-10-02 23:53:47 +02:00
var url_router_info = "{{ url_for('router_info', dbid='') }}";
var tileurls = {{ tileurls|tojson|safe }};
</script>
<script src="{{ url_for('static', filename='js/map.js') }}"></script>
<script type="text/javascript">
{%- if router.position is defined %}
var router_pos = [{{ router.position.coordinates[1] }}, {{ router.position.coordinates[0] }}];
map.setView(router_pos, 18);
var marker = L.marker(router_pos, {
icon: L.icon({
iconUrl: "{{ url_for('static', filename='img/router_blue.svg') }}",
iconSize: [14, 14]
}),
clickable: false
}).addTo(map);
{%- else %}
map.setView([49.45, 11.1], 10);
{%- endif %}
</script>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6" style="height: 422px; display: flex; flex-flow: column;">
{%- if router.neighbours is defined %}
<div class="panel panel-default" style="flex: 0 1 auto;">
<div class="panel-heading">Neighbours</div>
<div class="panel-body">
2015-10-07 16:19:07 +02:00
<table class="neighbours" style="width: 100%;">
2015-10-02 23:53:47 +02:00
<tr>
<th>Hostname</th>
<th>MAC Address</th>
<th>Quality</th>
<th>Interface</th>
</tr>
{%- for neighbour in router.neighbours %}
<tr style="background-color: {{ neighbour.quality|neighbour_color }};">
2015-10-12 18:09:39 +02:00
<td><a href="{{ url_for('router_info', dbid=neighbour._id) }}">{{ neighbour.hostname }}</a></td>
2015-10-02 23:53:47 +02:00
<td>{{ neighbour.mac }}</td>
<td>{{ neighbour.quality }}</td>
<td>{{ neighbour.net_if }}</td>
</tr>
{%- endfor %}
</table>
</div>
</div>
{%- endif %}
<div class="panel panel-default" style="flex: 1 1 auto;">
<div class="panel-heading">Events</div>
<div class="panel-body">
2015-10-07 16:19:07 +02:00
<table class="table table-condensed">
2015-10-21 11:01:24 +02:00
{%- for event in router.events[-5:] %}
2015-10-07 16:19:07 +02:00
<tr>
<td>{{ event.time|utc2local }}</td>
<td>{{ event.type }}</td>
</tr>
{%- endfor %}
</table>
2015-10-02 23:53:47 +02:00
</div>
</div>
</div>
2015-10-12 18:09:39 +02:00
</div>
<div class="row">
2015-10-02 23:53:47 +02:00
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">System</div>
<div class="panel-body">
<table class="table table-condensed">
<tr><th>Hostname</th><td>{{ router.hostname }}</td></tr>
<tr><th>Status</th><td>{{ router.status }}</td></tr>
{%- if router.description %}
<tr><th>Description</th><td>{{ router.description }}</td></tr>
{%- endif %}
{%- if router.position.comment %}
<tr><th>Position</th><td>{{ router.position.comment }}</td></tr>
{%- endif %}
<tr><th>User</th><td>{{ router.user.nickname }}</td></tr>
2015-10-21 11:01:24 +02:00
<tr><th>Hardware</th><td>{{ router.hardware.name }} ({{ router.hardware.chipset }})</td></tr>
2015-10-02 23:53:47 +02:00
<tr><th>Last contact</th><td>{{ router.last_contact|utc2local }}</td></tr>
</table>
</div>
</div>
</div>
{%- if router.software is defined %}
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Software</div>
<div class="panel-body">
<table class="table table-condensed">
2015-10-16 09:51:05 +02:00
<tr><th>Operating&nbsp;System</th><td>{{ router.software.os }}</td></tr>
2015-10-02 23:53:47 +02:00
<tr><th>Kernel</th><td>{{ router.software.kernel }}</td></tr>
<tr><th>Firmware</th><td>{{ router.software.firmware }} ({{ router.software.firmware_rev }})</td></tr>
<tr><th>B.A.T.M.A.N. adv</th><td>{{ router.software.batman_adv }}</td></tr>
<tr><th>Nodewatcher</th><td>{{ router.software.nodewatcher }}</td></tr>
</table>
</div>
</div>
</div>
{%- endif %}
</div>
2015-10-12 18:09:39 +02:00
<div class="row">
<div class="col-xs-12 col-md-6">
<div class="panel panel-default">
<div class="panel-heading">Network Interfaces</div>
<div class="panel-body">
</div>
<ul class="list-group" id="netif-list">
{# make sure that br-mesh is on top of the list #}
{%- for netif in router.netifs if netif.name == 'br-mesh' %}
<li class="list-group-item active" data-mac="{{ netif.mac }}">
<h4 class="list-group-item-heading"><div class="row">
2015-10-16 09:51:05 +02:00
<div class="col-xs-6 col-sm-6">{{ netif.name }}</div>
<div class="col-xs-6 col-sm-6 text-right">{{ netif.mac|upper }}</div>
2015-10-12 18:09:39 +02:00
</div></h4>
<p class="list-group-item-text"><div class="row">
<div class="col-xs-5 col-sm-5">
{%- if netif.ipv6_fe80_addr %}
{{ netif.ipv6_fe80_addr }}
{%- else %}
<em title="Calculated from MAC Address">{{ netif.mac|mac2fe80 }}</em>
{%- endif %}
</div>
2015-10-12 18:09:39 +02:00
{%- if netif.traffic.rx is defined %}
2015-10-16 09:51:05 +02:00
<div class="col-xs-7 col-sm-7 text-right">
2015-10-12 18:09:39 +02:00
<span class="glyphicon glyphicon-arrow-down"></span>{{ netif.traffic.rx|humanize_bytes }}/s
<span class="glyphicon glyphicon-arrow-up"></span>{{ netif.traffic.tx|humanize_bytes }}/s
</div>
{%- endif %}
</div></p>
</li>
{%- endfor %}
{%- for netif in router.netifs if netif.name != 'br-mesh' %}
<li class="list-group-item" data-mac="{{ netif.mac }}">
<h4 class="list-group-item-heading"><div class="row">
2015-10-16 09:51:05 +02:00
<div class="col-xs-6 col-sm-6">{{ netif.name }}</div>
<div class="col-xs-6 col-sm-6 text-right">{{ netif.mac|upper }}</div>
2015-10-12 18:09:39 +02:00
</div></h4>
<p class="list-group-item-text"><div class="row">
<div class="col-xs-5 col-sm-5">
{%- if netif.ipv6_fe80_addr %}
{{ netif.ipv6_fe80_addr }}
{%- else %}
<em title="Calculated from MAC Address">{{ netif.mac|mac2fe80 }}</em>
{%- endif %}
</div>
2015-10-12 18:09:39 +02:00
{%- if netif.traffic.rx is defined %}
2015-10-16 09:51:05 +02:00
<div class="col-xs-7 col-sm-7 text-right">
2015-10-12 18:09:39 +02:00
<span class="glyphicon glyphicon-arrow-down"></span>{{ netif.traffic.rx|humanize_bytes }}/s
<span class="glyphicon glyphicon-arrow-up"></span>{{ netif.traffic.tx|humanize_bytes }}/s
</div>
{%- endif %}
</div></p>
</li>
{%- endfor %}
</ul>
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#netif-list li").on("click", function() {
$("#netif-list li").removeClass("active");
$(this).addClass("active");
2015-10-16 09:51:05 +02:00
this.getAttribute("data-mac");
2015-10-12 18:09:39 +02:00
});
});
</script>
</div>
</div>
2015-10-02 23:53:47 +02:00
{% endblock %}