Simplify node_traffic template to use a dict #15

Open
opened 2026-10-05 06:02:09 +02:00 by adam · 0 comments
Owner

eg.

{% set port_labels = {
    1: "Text message",
    3: "Position",
    4: "Nodeinfo",
    5: "Routing",
    6: "Admin",
    8: "Waypoint",
    34: "Pax counter <E0><B6><9E>",
    65: "Store&forward",
    66: "Range test <E0><B6><9E>",
    67: "Telemetry",
    70: "Traceroute",
    71: "Neighborinfo",
    72: "ATAK",
    73: "Map report",
    0: "Unknown/Admin"
} %}
<td>{{ port_labels.get(port.portnum, "UNKNOWN: " ~ port.portnum) }}</td>
eg. ```jinja {% set port_labels = { 1: "Text message", 3: "Position", 4: "Nodeinfo", 5: "Routing", 6: "Admin", 8: "Waypoint", 34: "Pax counter <E0><B6><9E>", 65: "Store&forward", 66: "Range test <E0><B6><9E>", 67: "Telemetry", 70: "Traceroute", 71: "Neighborinfo", 72: "ATAK", 73: "Map report", 0: "Unknown/Admin" } %} ``` ```jinja <td>{{ port_labels.get(port.portnum, "UNKNOWN: " ~ port.portnum) }}</td> ``` <!-- github-sync-id:3493885597 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/meshview#15