diff --git a/.gitignore b/.gitignore index 28df5ec..6564e3e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ env/* __pycache__/* packets.db +/table_details.py diff --git a/main.py b/main.py index 8784bd9..adf44dc 100644 --- a/main.py +++ b/main.py @@ -28,7 +28,7 @@ if __name__ == '__main__': parser = argparse.ArgumentParser('meshview') parser.add_argument('--bind', nargs='*', default=['*']) parser.add_argument('--acme-challenge') - parser.add_argument('--port', default=8080, type=int) + parser.add_argument('--port', default=8081, type=int) parser.add_argument('--tls-cert') parser.add_argument('--mqtt-server', default='mqtt.bayme.sh') diff --git a/meshview/store.py b/meshview/store.py index 64ac2b9..74f95c5 100644 --- a/meshview/store.py +++ b/meshview/store.py @@ -12,6 +12,29 @@ from meshview.models import Packet, PacketSeen, Node, Traceroute from meshview import notify + +# We count the total amount of packages +async def get_total_packet_count(): + async with database.async_session() as session: + q = select(func.count(Packet.id)) # Use SQLAlchemy's func to count packets + result = await session.execute(q) + return result.scalar() # Return the total count of packets + +# We count the total amount of nodes +async def get_total_node_count(): + async with database.async_session() as session: + q = select(func.count(Node.id)) # Use SQLAlchemy's func to count nodes + result = await session.execute(q) + return result.scalar() # Return the total count of nodes + +# We count the total amount of seen packets +async def get_total_packet_seen_count(): + async with database.async_session() as session: + q = select(func.count(PacketSeen.node_id)) # Use SQLAlchemy's func to count nodes + result = await session.execute(q) + return result.scalar() # Return the total count of seen packets + + async def process_envelope(topic, env): if not env.packet.id: return @@ -266,3 +289,6 @@ async def get_mqtt_neighbors(since): ) return result + + + diff --git a/meshview/templates/base.html b/meshview/templates/base.html index 6c06026..c7b29fd 100644 --- a/meshview/templates/base.html +++ b/meshview/templates/base.html @@ -26,19 +26,19 @@ } #details_map { width: 100%; - height: 300px; + height: 500px; } {% block css %} {% endblock %}
-