Add a UI for the portnum filter.

There was some code to filter by portnum around in the node search so
put a quick UI on it. It currently breaks if you click the TX/RX and
Uplinked buttons.
This commit is contained in:
Jason Michalski
2024-05-09 22:44:02 -07:00
parent 12989ae67f
commit 2e46971896
4 changed files with 44 additions and 19 deletions

View File

@@ -16,6 +16,9 @@
.htmx-request .htmx-indicator{
opacity:1
}
#search_form {
z-index: 4000;
}
{% block css %}
{% endblock %}
</style>

View File

@@ -2,6 +2,6 @@
id="node_options"
>
{% for option in node_options %}
<option value="{{option.id}}">{{option.id}} -- {{option.long_name}} ({{option.short_name}})</option)>
<option value="{{option.id}}">{{option.id}} -- {{option.long_name}} ({{option.short_name}})</option>
{% endfor %}
</datalist>

View File

@@ -1,23 +1,44 @@
<form
class="container-fluid p-2 sticky-top mx-auto"
class="container p-2 sticky-top mx-auto"
id="search_form"
style="width: 80%;"
action="/node_search"
>
<input
id="q"
type="text"
name="q"
placeholder="Node id"
autocomplete="off"
size="100"
list="node_options"
value="{{raw_node_id}}"
hx-trigger="input delay:100ms"
hx-get="/node_match"
hx-target="#node_options"
/>
{% include "datalist.html" %}
<input type="submit"/>
<input type="reset"/>
<div class="row">
<input
class="col m-2"
id="q"
type="text"
name="q"
placeholder="Node id"
autocomplete="off"
list="node_options"
value="{{raw_node_id}}"
hx-trigger="input delay:100ms"
hx-get="/node_match"
hx-target="#node_options"
/>
{% include "datalist.html" %}
{% set options = {
1: "Text Message",
3: "Position",
4: "Node Info",
67: "Telemetry",
71: "Neighbor Info",
}
%}
<select name="portnum" class="col-2 m-2">
<option
value = ""
{% if portnum not in options %}selected{% endif %}
>All</option>
{% for value, name in options.items() %}
<option
value="{{value}}"
{% if value == portnum %}selected{% endif %}
>{{ name }}</option>
{% endfor %}
</select>
<input type="submit" class="col-2 m-2"/>
<input type="reset" class="col-2 m-2"/>
</div>
</form>

View File

@@ -170,6 +170,7 @@ async def node_search(request):
packets=packets,
packet_event="packet",
node_options=options,
portnum=portnum,
),
content_type="text/html",
)