diff --git a/meshview/store.py b/meshview/store.py index 9828af8..fe5d389 100644 --- a/meshview/store.py +++ b/meshview/store.py @@ -129,6 +129,20 @@ async def get_packets(node_id=None, portnum=None): return result.scalars() +async def get_packets_from(node_id=None, portnum=None): + async with database.async_session() as session: + q = select(Packet) + + if node_id: + q = q.where( + Packet.from_node_id == node_id + ) + if portnum: + q = q.where(Packet.portnum == portnum) + result = await session.execute(q.limit(500).order_by(Packet.import_time.desc())) + return result.scalars() + + async def get_packet(packet_id): async with database.async_session() as session: q = select(Packet).where(Packet.id == packet_id) @@ -136,13 +150,6 @@ async def get_packet(packet_id): return result.scalar_one_or_none() -async def get_position(node_id): - async with database.async_session() as session: - q = select(Packet).where((Packet.from_node_id == node_id) & (Packet.portnum == PortNum.POSITION_APP)).order_by(Packet.import_time.desc()) - result = await session.execute(q) - return result.scalar() - - async def get_uplinked_packets(node_id): async with database.async_session() as session: result = await session.execute( diff --git a/meshview/templates/node.html b/meshview/templates/node.html index 17045c3..e27d6a1 100644 --- a/meshview/templates/node.html +++ b/meshview/templates/node.html @@ -7,7 +7,7 @@ {% block css %} #map{ - height:90%; + height:100%; } #packet_details{ height: 95vh; @@ -26,8 +26,8 @@ sse-connect="/events?node_id={{node_id}}{% if portnum %}&portnum={{portnum}}{% endif %}"> {% endif %}