diff --git a/meshview/models.py b/meshview/models.py index 3c0587f..569943c 100644 --- a/meshview/models.py +++ b/meshview/models.py @@ -14,31 +14,31 @@ class Node(Base): __tablename__ = "node" id: Mapped[str] = mapped_column(primary_key=True) node_id: Mapped[int] = mapped_column(BigInteger, nullable=True, unique=True) - long_name: Mapped[str] - short_name: Mapped[str] - hw_model: Mapped[str] - firmware: Mapped[str] + long_name: Mapped[str] = mapped_column(nullable=True) + short_name: Mapped[str] = mapped_column(nullable=True) + hw_model: Mapped[str] = mapped_column(nullable=True) + firmware: Mapped[str] = mapped_column(nullable=True) role: Mapped[str] = mapped_column(nullable=True) last_lat: Mapped[int] = mapped_column(BigInteger, nullable=True) last_long: Mapped[int] = mapped_column(BigInteger, nullable=True) - channel: Mapped[str] - last_update: Mapped[datetime] + channel: Mapped[str] = mapped_column(nullable=True) + last_update: Mapped[datetime] = mapped_column(nullable=True) class Packet(Base): __tablename__ = "packet" id: Mapped[int] = mapped_column(BigInteger, primary_key=True) - portnum: Mapped[int] - from_node_id: Mapped[int] = mapped_column(BigInteger) + portnum: Mapped[int] = mapped_column(nullable=True) + from_node_id: Mapped[int] = mapped_column(BigInteger, nullable=True) from_node: Mapped["Node"] = relationship( primaryjoin="Packet.from_node_id == foreign(Node.node_id)", lazy="joined" ) - to_node_id: Mapped[int] = mapped_column(BigInteger) + to_node_id: Mapped[int] = mapped_column(BigInteger,nullable=True) to_node: Mapped["Node"] = relationship( primaryjoin="Packet.to_node_id == foreign(Node.node_id)", lazy="joined" ) - payload: Mapped[bytes] - import_time: Mapped[datetime] - channel: Mapped[str] + payload: Mapped[bytes] = mapped_column(nullable=True) + import_time: Mapped[datetime] = mapped_column(nullable=True) + channel: Mapped[str] = mapped_column(nullable=True) class PacketSeen(Base): @@ -49,13 +49,13 @@ class PacketSeen(Base): lazy="joined", primaryjoin="PacketSeen.node_id == foreign(Node.node_id)" ) rx_time: Mapped[int] = mapped_column(BigInteger, primary_key=True) - hop_limit: Mapped[int] + hop_limit: Mapped[int] = mapped_column(nullable=True) hop_start: Mapped[int] = mapped_column(nullable=True) - channel: Mapped[str] + channel: Mapped[str] = mapped_column(nullable=True) rx_snr: Mapped[float] = mapped_column(nullable=True) rx_rssi: Mapped[int] = mapped_column(nullable=True) - topic: Mapped[str] - import_time: Mapped[datetime] + topic: Mapped[str] = mapped_column(nullable=True) + import_time: Mapped[datetime] = mapped_column(nullable=True) class Traceroute(Base): @@ -65,8 +65,8 @@ class Traceroute(Base): packet: Mapped["Packet"] = relationship( primaryjoin="Traceroute.packet_id == foreign(Packet.id)", lazy="joined" ) - gateway_node_id: Mapped[int] = mapped_column(BigInteger) - done: Mapped[bool] - route: Mapped[bytes] - import_time: Mapped[datetime] + gateway_node_id: Mapped[int] = mapped_column(BigInteger, nullable=True) + done: Mapped[bool] = mapped_column(nullable=True) + route: Mapped[bytes] = mapped_column(nullable=True) + import_time: Mapped[datetime] = mapped_column(nullable=True) diff --git a/meshview/templates/base.html b/meshview/templates/base.html index e99f6e3..fa3ae08 100644 --- a/meshview/templates/base.html +++ b/meshview/templates/base.html @@ -34,7 +34,7 @@
Bay Area Mesh - http://bayme.sh
-
Quick Links:  Search for a node  - Conversations - See everything  - Mesh Graph LF - MS  - Nodes - Stats

+
Quick Links:  Nodes - Conversations - See everything  - Mesh Graph LF - MS  - Stats

Loading...
diff --git a/meshview/templates/nodelist.html b/meshview/templates/nodelist.html index 5f5436a..48e545c 100644 --- a/meshview/templates/nodelist.html +++ b/meshview/templates/nodelist.html @@ -31,15 +31,16 @@ tr:nth-child(odd) { display: flex; gap: 10px; margin-bottom: 10px; + align-items: center; } -.search, .filter-role, .filter-channel, .export-btn { +.search, .filter-role, .filter-channel, .filter-hw_model, .export-btn { padding: 8px; border: 1px solid #333; border-radius: 4px; } -.filter-role, .filter-channel { +.filter-role, .filter-channel, .filter-hw_model { cursor: pointer; } @@ -53,6 +54,12 @@ tr:nth-child(odd) { .export-btn:hover { background: #218838; } + +.node-count { + font-size: 16px; + font-weight: bold; + color: white; +} {% endblock %} {% block body %} @@ -76,7 +83,18 @@ tr:nth-child(odd) { {% endfor %} + + + + + + Total Nodes: 0 {% if nodes %} @@ -124,17 +142,27 @@ tr:nth-child(odd) { valueNames: ["long_name", "short_name", "hw_model", "firmware", "role", "last_lat", "last_long", "channel", "last_update"] }; nodeList = new List("node-list", options); + updateCount(); // Set initial count }); function applyFilters() { var selectedRole = document.querySelector(".filter-role").value; var selectedChannel = document.querySelector(".filter-channel").value; + var selectedHWModel = document.querySelector(".filter-hw_model").value; nodeList.filter(function (item) { var matchesRole = selectedRole === "" || item.values().role === selectedRole; var matchesChannel = selectedChannel === "" || item.values().channel === selectedChannel; - return matchesRole && matchesChannel; + var matchesHWModel = selectedHWModel === "" || item.values().hw_model === selectedHWModel; + return matchesRole && matchesChannel && matchesHWModel; }); + + updateCount(); // Update the count after filtering + } + + function updateCount() { + var visibleRows = document.querySelectorAll("#node-table tbody tr:not([style*='display: none'])").length; + document.getElementById("node-count-value").innerText = visibleRows; } function exportToCSV() {