some more stuff for mesh control
This commit is contained in:
parent
473e60aed0
commit
2ff4a9a64a
5 changed files with 80 additions and 13 deletions
|
@ -31,19 +31,43 @@
|
|||
{% for msg in mesh_messages %}
|
||||
<tr>
|
||||
<td>{{ msg.datetime }}</td>
|
||||
<td>{{ msg.src_node }}</td>
|
||||
<td><a href="{% url "control.mesh_node.detail" pk=msg.src_node.address %}">{{ msg.src_node }}</a></td>
|
||||
<td>{{ msg.get_message_type_display }}</td>
|
||||
<td>
|
||||
{% if msg.get_message_type_display == "CONFIG_FIRMWARE" %}
|
||||
<strong>Chip:</strong> {{ msg.parsed.get_chip_display }} rev{{ msg.parsed.revision|join:"." }}
|
||||
<br>
|
||||
<strong>Firmware:</strong> {{ msg.parsed.project_name }} {{ msg.parsed.version }} (IDF {{ msg.parsed.idf_version }})
|
||||
<br>
|
||||
<strong>Compile Date:</strong> {{ msg.parsed.compile_date }} {{ msg.parsed.compile_time }}
|
||||
<br>
|
||||
<strong>SHA256:</strong> <small>{{ msg.parsed.app_elf_sha256 }}</small>
|
||||
|
||||
{% for key, value in msg.data.items %}
|
||||
{% if key != "src" and key != "dst" and key != "msg_id" %}
|
||||
<div class="mesh-msg-data mesh-msg-type-{{ key }}">
|
||||
<strong>{{ key }}</strong>: {{ value }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% elif msg.get_message_type_display == "CONFIG_UPLINK" %}
|
||||
<strong>Enabled:</strong> {{ msg.parsed.enabled }},
|
||||
<strong>SSID:</strong> {{ msg.parsed.ssid }},
|
||||
<strong>Channel:</strong> {{ msg.parsed.channel }}<br>
|
||||
<strong>Host:</strong> {{ msg.parsed.host }},
|
||||
<strong>Port:</strong> {{ msg.parsed.port }},
|
||||
<strong>UDP:</strong> {{ msg.parsed.udp }},
|
||||
<strong>SSL:</strong> {{ msg.parsed.ssl }}
|
||||
|
||||
{% elif msg.get_message_type_display == "CONFIG_LED" %}
|
||||
<strong>LED config:</strong> {{ msg.parsed.led_config }}
|
||||
|
||||
{% elif msg.get_message_type_display == "CONFIG_POSITION" %}
|
||||
<strong>X=</strong>{{ msg.parsed.x_pos }}, <strong>Y=</strong>{{ msg.parsed.y_pos }}, <strong>Z=</strong>{{ msg.parsed.z_pos }}
|
||||
{% else %}
|
||||
{% for key, value in msg.data.items %}
|
||||
{% if key != "src" and key != "dst" and key != "msg_id" %}
|
||||
<div class="mesh-msg-data mesh-msg-type-{{ key }}">
|
||||
<strong>{{ key }}</strong>: {{ value }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ msg.uplink_node }}</td>
|
||||
<td><a href="{% url "control.mesh_node.detail" pk=msg.uplink_node.address %}">{{ msg.uplink_node }}</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
|
35
src/c3nav/control/templates/control/mesh_node_detail.html
Normal file
35
src/c3nav/control/templates/control/mesh_node_detail.html
Normal file
|
@ -0,0 +1,35 @@
|
|||
{% extends 'control/base.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block heading %}{% trans 'Mesh Node' %} {{ node }}{% endblock %}
|
||||
|
||||
{% block subcontent %}
|
||||
<div class="columns">
|
||||
<div>
|
||||
<h4>Firmware</h4>
|
||||
<strong>Chip:</strong> {{ node.last_messages.CONFIG_FIRMWARE.parsed.get_chip_display }} rev{{ node.last_messages.CONFIG_FIRMWARE.parsed.revision|join:"." }}
|
||||
<br>
|
||||
<strong>Firmware:</strong> {{ node.last_messages.CONFIG_FIRMWARE.parsed.project_name }} {{ node.last_messages.CONFIG_FIRMWARE.parsed.version }} (IDF {{ node.last_messages.CONFIG_FIRMWARE.parsed.idf_version }})
|
||||
<br>
|
||||
<strong>Compile Date:</strong> {{ node.last_messages.CONFIG_FIRMWARE.parsed.compile_date }} {{ node.last_messages.CONFIG_FIRMWARE.parsed.compile_time }}
|
||||
<br>
|
||||
<strong>SHA256:</strong> <small>{{ node.last_messages.CONFIG_FIRMWARE.parsed.app_elf_sha256 }}</small>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Uplink</h4>
|
||||
<strong>Enabled:</strong> {{ node.last_messages.CONFIG_UPLINK.parsed.enabled }},
|
||||
<strong>SSID:</strong> {{ node.last_messages.CONFIG_UPLINK.parsed.ssid }},
|
||||
<strong>Channel:</strong> {{ node.last_messages.CONFIG_UPLINK.parsed.channel }}<br>
|
||||
<strong>Host:</strong> {{ node.last_messages.CONFIG_UPLINK.parsed.host }},
|
||||
<strong>Port:</strong> {{ node.last_messages.CONFIG_UPLINK.parsed.port }},
|
||||
<strong>UDP:</strong> {{ node.last_messages.CONFIG_UPLINK.parsed.udp }},
|
||||
<strong>SSL:</strong> {{ node.last_messages.CONFIG_UPLINK.parsed.ssl }}
|
||||
|
||||
<h4>Position</h4>
|
||||
<strong>X=</strong>{{ node.last_messages.CONFIG_POSITION.parsed.x_pos }}, <strong>Y=</strong>{{ node.last_messages.CONFIG_POSITION.parsed.y_pos }}, <strong>Z=</strong>{{ node.last_messages.CONFIG_POSITION.parsed.z_pos }}
|
||||
|
||||
<h4>LED config</h4>
|
||||
{{ node.last_messages.CONFIG_LED.parsed.led_config }}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -15,7 +15,7 @@
|
|||
</tr>
|
||||
{% for node in nodes %}
|
||||
<tr>
|
||||
<td>{{ node }}</td>
|
||||
<td><a href="{% url "control.mesh_node.detail" pk=node.address %}">{{ node }}</a></td>
|
||||
<td>
|
||||
{{ node.last_messages.CONFIG_FIRMWARE.parsed.get_chip_display }}
|
||||
rev{{ node.last_messages.CONFIG_FIRMWARE.parsed.revision|join:"." }}
|
||||
|
@ -34,7 +34,7 @@
|
|||
{{ timesince }} ago
|
||||
{% endblocktrans %}
|
||||
</td>
|
||||
<td>{{ node.uplink }}</td>
|
||||
<td><a href="{% url "control.mesh_node.detail" pk=node.uplink.address %}">{{ node.uplink }}</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django.urls import path
|
||||
|
||||
from c3nav.control.views.mesh import MeshNodeListView, MeshMessageListView
|
||||
from c3nav.control.views.mesh import MeshNodeListView, MeshMessageListView, MeshNodeDetailView
|
||||
from c3nav.control.views.mapupdates import map_updates
|
||||
from c3nav.control.views.announcements import announcement_list, announcement_detail
|
||||
from c3nav.control.views.access import grant_access, grant_access_qr
|
||||
|
@ -17,5 +17,6 @@ urlpatterns = [
|
|||
path('mapupdates/', map_updates, name='control.map_updates'),
|
||||
path('mesh/', MeshNodeListView.as_view(), name='control.mesh_nodes'),
|
||||
path('mesh/messages/', MeshMessageListView.as_view(), name='control.mesh_messages'),
|
||||
path('mesh/<str:pk>/', MeshNodeDetailView.as_view(), name='control.mesh_node.detail'),
|
||||
path('', ControlPanelIndexView.as_view(), name='control.index'),
|
||||
]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from django.db.models import Max
|
||||
from django.views.generic import ListView
|
||||
from django.views.generic import ListView, DetailView
|
||||
|
||||
from c3nav.control.forms import MeshMessageFilerForm
|
||||
from c3nav.control.views.base import ControlPanelMixin
|
||||
|
@ -16,6 +16,13 @@ class MeshNodeListView(ControlPanelMixin, ListView):
|
|||
return super().get_queryset().annotate(last_msg=Max('received_messages__datetime')).prefetch_last_messages()
|
||||
|
||||
|
||||
class MeshNodeDetailView(ControlPanelMixin, DetailView):
|
||||
model = MeshNode
|
||||
template_name = "control/mesh_node_detail.html"
|
||||
pk_url_kwargs = "address"
|
||||
context_object_name = "node"
|
||||
|
||||
|
||||
class MeshMessageListView(ControlPanelMixin, ListView):
|
||||
model = NodeMessage
|
||||
template_name = "control/mesh_messages.html"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue