diff --git a/meshview/models.py b/meshview/models.py index 5e76914..723556d 100644 --- a/meshview/models.py +++ b/meshview/models.py @@ -23,6 +23,14 @@ class Node(Base): channel: Mapped[str] = mapped_column(nullable=True) last_update: Mapped[datetime] = mapped_column(nullable=True) + def to_dict(self): + """Convert SQLAlchemy object to a dictionary, excluding last_update.""" + return { + column.name: getattr(self, column.name) + for column in self.__table__.columns + if column.name != "last_update" # Exclude last_update + } + class Packet(Base): __tablename__ = "packet" id: Mapped[int] = mapped_column(BigInteger, primary_key=True) diff --git a/meshview/templates/chat_packet.html b/meshview/templates/chat_packet.html index 9a6d833..3ae0c2f 100644 --- a/meshview/templates/chat_packet.html +++ b/meshview/templates/chat_packet.html @@ -1,5 +1,5 @@
- {{packet.import_time.strftime('%-I:%M:%S %p - %d-%m-%Y')}} + {{packet.import_time.strftime('%-I:%M:%S %p - %m-%d-%Y')}} ✉️ {{packet.from_node.channel}} {{packet.from_node.long_name or (packet.from_node_id | node_id_to_hex) }} {{packet.payload}} diff --git a/meshview/templates/firehose.html b/meshview/templates/firehose.html index c0b5e42..7795451 100644 --- a/meshview/templates/firehose.html +++ b/meshview/templates/firehose.html @@ -1,4 +1,12 @@ {% extends "base.html" %} +{% block css %} + + /* Set the maximum width of the page to 900px */ + .container { + max-width: 900px; + margin: 0 auto; /* Center the content horizontally */ + } +{% endblock %} {% block body %} @@ -82,7 +90,7 @@ {% endfor %} - +
diff --git a/meshview/templates/net_packet.html b/meshview/templates/net_packet.html index 9a6d833..3ae0c2f 100644 --- a/meshview/templates/net_packet.html +++ b/meshview/templates/net_packet.html @@ -1,5 +1,5 @@
- {{packet.import_time.strftime('%-I:%M:%S %p - %d-%m-%Y')}} + {{packet.import_time.strftime('%-I:%M:%S %p - %m-%d-%Y')}} ✉️ {{packet.from_node.channel}} {{packet.from_node.long_name or (packet.from_node_id | node_id_to_hex) }} {{packet.payload}} diff --git a/meshview/templates/node.html b/meshview/templates/node.html index caecc4e..968044a 100644 --- a/meshview/templates/node.html +++ b/meshview/templates/node.html @@ -23,6 +23,12 @@ div.tab-pane > dl { display: inline-block; } + + /* Set the maximum width of the page to 900px */ + .container { + max-width: 900px; + margin: 0 auto; /* Center the content horizontally */ + } {% endblock %} {% block body %} @@ -30,12 +36,7 @@ {% include "search_form.html" %}
-
+
@@ -106,7 +107,7 @@ const brightness = Math.round(((parseInt(text_color[0]) * 299) + (parseInt(text_color[1]) * 587) + (parseInt(text_color[2]) * 114)) / 1000); - + if (brightness > 125) { var textColor = '#212529' node_color.style.color = textColor @@ -230,7 +231,6 @@ - {% endif %} {% endblock %} diff --git a/meshview/templates/node_traffic.html b/meshview/templates/node_traffic.html index a8aca5b..96ea5f9 100644 --- a/meshview/templates/node_traffic.html +++ b/meshview/templates/node_traffic.html @@ -49,8 +49,14 @@ {% endblock %} {% block body %} -
-

{{ traffic[0].long_name }} (last 24 hours)

+
+

+ {% if traffic %} + {{ traffic[0].long_name }} (last 24 hours) + {% else %} + No Traffic Data Available + {% endif %} +

@@ -80,10 +86,6 @@ MAP_REPORT_APP {% elif port.portnum == 0 %} UNKNOWN_APP - {% elif port.portnum == 0 %} - UNKNOWN_APP - {% elif port.portnum == 0 %} - UNKNOWN_APP {% else %} {{ port.portnum }} {% endif %} diff --git a/meshview/templates/packet.html b/meshview/templates/packet.html index c832b97..ca65f79 100644 --- a/meshview/templates/packet.html +++ b/meshview/templates/packet.html @@ -33,7 +33,7 @@
Import Time
-
{{packet.import_time.strftime('%-I:%M:%S %p - %d-%m-%Y')}}
+
{{packet.import_time.strftime('%-I:%M:%S %p - %m-%d-%Y')}}
packet
{{packet.data}}
payload
diff --git a/meshview/templates/packet_details.html b/meshview/templates/packet_details.html index 2496dc6..4b402c9 100644 --- a/meshview/templates/packet_details.html +++ b/meshview/templates/packet_details.html @@ -13,7 +13,7 @@
Import Time
-
{{seen.import_time.strftime('%-I:%M:%S %p - %d-%m-%Y')}}
+
{{seen.import_time.strftime('%-I:%M:%S %p - %m-%d-%Y')}}
rx_time
{{seen.rx_time|format_timestamp}}
hop_limit
@@ -36,7 +36,7 @@ {% if map_center %}