Improve search forms

This commit is contained in:
Mark Veidemanis 2022-08-03 07:20:30 +01:00
parent 716bd6afb6
commit 9442e92b31
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
8 changed files with 85 additions and 84 deletions

View File

@ -123,7 +123,7 @@ def run_main_query(client, user, query, custom_query=False, index=None, size=Non
search_query = construct_query(query, size) search_query = construct_query(query, size)
try: try:
response = client.search(body=search_query, index=index) response = client.search(body=search_query, index=index)
except RequestError as err: except RequestError:
return False return False
filter_blacklisted(user, response) filter_blacklisted(user, response)
return response return response

View File

@ -7,7 +7,7 @@
hx-trigger="click" hx-trigger="click"
hx-target="#actions" hx-target="#actions"
hx-swap="outerHTML" hx-swap="outerHTML"
class="button is-success"> class="button is-primary">
<span class="icon-text"> <span class="icon-text">
<span class="icon"> <span class="icon">
<i class="fa-solid fa-plus"></i> <i class="fa-solid fa-plus"></i>
@ -21,7 +21,7 @@
hx-trigger="click" hx-trigger="click"
hx-target="#actions" hx-target="#actions"
hx-swap="outerHTML" hx-swap="outerHTML"
class="button is-success"> class="button is-primary">
<span class="icon-text"> <span class="icon-text">
<span class="icon"> <span class="icon">
<i class="fa-solid fa-wrench"></i> <i class="fa-solid fa-wrench"></i>
@ -35,7 +35,7 @@
hx-trigger="click" hx-trigger="click"
hx-target="#actions" hx-target="#actions"
hx-swap="outerHTML" hx-swap="outerHTML"
class="button is-success"> class="button is-primary">
<span class="icon-text"> <span class="icon-text">
<span class="icon"> <span class="icon">
<i class="fa-solid fa-list"></i> <i class="fa-solid fa-list"></i>

View File

@ -6,7 +6,7 @@
hx-get="{% url 'threshold_irc_actions_add-network' %}" hx-get="{% url 'threshold_irc_actions_add-network' %}"
hx-trigger="click" hx-trigger="click"
hx-target="#modals-here-actions" hx-target="#modals-here-actions"
class="button is-success"> class="button is-primary">
<span class="icon-text"> <span class="icon-text">
<span class="icon"> <span class="icon">
<i class="fa-solid fa-plus"></i> <i class="fa-solid fa-plus"></i>
@ -20,7 +20,7 @@
hx-trigger="click" hx-trigger="click"
hx-target="#actions" hx-target="#actions"
hx-swap="outerHTML" hx-swap="outerHTML"
class="button is-success"> class="button is-primary">
<span class="icon-text"> <span class="icon-text">
<span class="icon"> <span class="icon">
<i class="fa-solid fa-wrench"></i> <i class="fa-solid fa-wrench"></i>
@ -30,7 +30,7 @@
</button> </button>
<button <button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}' hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
class="button is-success"> class="button is-primary">
<span class="icon-text"> <span class="icon-text">
<span class="icon"> <span class="icon">
<i class="fa-solid fa-list"></i> <i class="fa-solid fa-list"></i>

View File

@ -29,8 +29,7 @@
</span> </span>
</button> </button>
<button <button class="button is-small">
class="button is-small">
<span class="icon" data-tooltip="Self"> <span class="icon" data-tooltip="Self">
<i class="fa-solid fa-message-bot"></i> <i class="fa-solid fa-message-bot"></i>
</span> </span>
@ -56,6 +55,7 @@
</td> </td>
<td> <td>
{{ alert.net }}/{{ alert.num }} {{ alert.net }}/{{ alert.num }}
</td>
<td> <td>
{% if alert.type == 'conn' %} {% if alert.type == 'conn' %}
<span class="icon" data-tooltip="Conn"> <span class="icon" data-tooltip="Conn">
@ -81,7 +81,9 @@
{{ alert.type }} {{ alert.type }}
{% endif %} {% endif %}
</td> </td>
<td style="max-width: 10em" class="wrap">{{ alert.msg }}</td> <td class="wrap" style="max-width: 10em">
{{ alert.msg }}
</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>

View File

@ -5,42 +5,18 @@
<div class="box"> <div class="box">
<form method="POST"> <form method="POST">
{% csrf_token %} {% csrf_token %}
<div class="field">
<label class="label">Search</label> <div class="columns">
<div class="field-body"> <div class="column">
<div class="field"> <div class="field has-addons">
<div class="control is-expanded has-icons-left"> <div class="control is-expanded has-icons-left">
<input name="query" class="input" type="text" placeholder="msg: science AND nick: BillNye AND channel: #science"> <input name="query" class="input" type="text" placeholder="msg: science AND nick: BillNye AND channel: #science">
<span class="icon is-small is-left"> <span class="icon is-small is-left">
<i class="fas fa-magnifying-glass"></i> <i class="fas fa-magnifying-glass"></i>
</span> </span>
</div> </div>
</div>
</div>
</div>
<div class="columns">
<div class="column">
<label class="label">Results</label>
<div class="field">
<div class="control is-expanded has-icons-left">
<div class="select is-fullwidth">
<select name="size">
{% for size in sizes %}
<option value="{{ size }}">{{ size }}</option>
{% endfor %}
</select>
<span class="icon is-small is-left">
<i class="fas fa-magnifying-glass"></i>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="field">
<div class="control"> <div class="control">
<div class="field">
<button <button
class="button is-primary is-fullwidth" class="button is-primary is-fullwidth"
hx-post="{% url 'search_drilldown' %}" hx-post="{% url 'search_drilldown' %}"
@ -51,6 +27,31 @@
</button> </button>
</div> </div>
</div> </div>
</div>
</div>
<div class="column">
<div class="field has-addons">
<div class="control is-expanded has-icons-left">
<span class="select is-fullwidth">
<select name="size">
{% for size in sizes %}
<option value="{{ size }}">{{ size }}</option>
{% endfor %}
</select>
<span class="icon is-small is-left">
<i class="fas fa-magnifying-glass"></i>
</span>
</span>
</div>
<p class="control">
<a class="button is-static">
results
</a>
</p>
</div>
</div>
</div>
</form> </form>
</div> </div>

View File

@ -28,6 +28,7 @@
</thead> </thead>
<tbody> <tbody>
{% for item in results %} {% for item in results %}
<tr>
{% if item.type == 'join' %} {% if item.type == 'join' %}
<tr class="has-background-success-light"> <tr class="has-background-success-light">
{% elif item.type == 'quit' %} {% elif item.type == 'quit' %}

View File

@ -23,6 +23,10 @@
<div class="content" style="max-height: 30em; overflow: auto;"> <div class="content" style="max-height: 30em; overflow: auto;">
<div class="table-container"> <div class="table-container">
<table class="table is-fullwidth is-hoverable"> <table class="table is-fullwidth is-hoverable">
<thead>
<th>attribute</th>
<th>value</th>
</thead>
<tbody> <tbody>
<tr> <tr>
<th>src</th> <th>src</th>

View File

@ -44,20 +44,13 @@
<article class="tile is-child box"> <article class="tile is-child box">
<form method="POST"> <form method="POST">
{% csrf_token %} {% csrf_token %}
<div class="field"> <div class="field has-addons">
<label class="label">Search</label>
<div class="field-body">
<div class="field">
<div class="control is-expanded has-icons-left"> <div class="control is-expanded has-icons-left">
<input id="query" name="query" class="input" type="text" placeholder="nickname"> <input id="query" name="query" class="input" type="text" placeholder="nickname">
<span class="icon is-small is-left"> <span class="icon is-small is-left">
<i class="fas fa-magnifying-glass"></i> <i class="fas fa-magnifying-glass"></i>
</span> </span>
</div> </div>
</div>
</div>
</div>
<div class="field">
<div class="control"> <div class="control">
<button <button
class="button is-primary is-fullwidth" class="button is-primary is-fullwidth"