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)
try:
response = client.search(body=search_query, index=index)
except RequestError as err:
except RequestError:
return False
filter_blacklisted(user, response)
return response

View File

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

View File

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

View File

@ -29,8 +29,7 @@
</span>
</button>
<button
class="button is-small">
<button class="button is-small">
<span class="icon" data-tooltip="Self">
<i class="fa-solid fa-message-bot"></i>
</span>
@ -56,32 +55,35 @@
</td>
<td>
{{ alert.net }}/{{ alert.num }}
<td>
{% if alert.type == 'conn' %}
<span class="icon" data-tooltip="Conn">
<i class="fa-solid fa-cloud-exclamation"></i>
</span>
{% elif alert.type == 'highlight' %}
<span class="icon" data-tooltip="Highlight">
<i class="fa-solid fa-square-quote"></i>
</span>
{% elif alert.type == 'znc' %}
<span class="icon" data-tooltip="ZNC">
<i class="fa-brands fa-unity"></i>
</span>
{% elif alert.type == 'query' %}
<span class="icon" data-tooltip="Query">
<i class="fa-solid fa-inbox"></i>
</span>
{% elif alert.type == 'self' %}
<span class="icon" data-tooltip="Self">
<i class="fa-solid fa-message-bot"></i>
</span>
{% else %}
{{ alert.type }}
{% endif %}
</td>
<td style="max-width: 10em" class="wrap">{{ alert.msg }}</td>
</td>
<td>
{% if alert.type == 'conn' %}
<span class="icon" data-tooltip="Conn">
<i class="fa-solid fa-cloud-exclamation"></i>
</span>
{% elif alert.type == 'highlight' %}
<span class="icon" data-tooltip="Highlight">
<i class="fa-solid fa-square-quote"></i>
</span>
{% elif alert.type == 'znc' %}
<span class="icon" data-tooltip="ZNC">
<i class="fa-brands fa-unity"></i>
</span>
{% elif alert.type == 'query' %}
<span class="icon" data-tooltip="Query">
<i class="fa-solid fa-inbox"></i>
</span>
{% elif alert.type == 'self' %}
<span class="icon" data-tooltip="Self">
<i class="fa-solid fa-message-bot"></i>
</span>
{% else %}
{{ alert.type }}
{% endif %}
</td>
<td class="wrap" style="max-width: 10em">
{{ alert.msg }}
</td>
</tr>
{% endfor %}
</tbody>

View File

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

View File

@ -28,19 +28,20 @@
</thead>
<tbody>
{% for item in results %}
{% if item.type == 'join' %}
<tr class="has-background-success-light">
{% elif item.type == 'quit' %}
<tr class="has-background-danger-light">
{% elif item.type == 'kick' %}
<tr class="has-background-danger-light">
{% elif item.type == 'part' %}
<tr class="has-background-warning-light">
{% elif item.type == 'mode' %}
<tr class="has-background-info-light">
{% else %}
<tr>
{% endif %}
<tr>
{% if item.type == 'join' %}
<tr class="has-background-success-light">
{% elif item.type == 'quit' %}
<tr class="has-background-danger-light">
{% elif item.type == 'kick' %}
<tr class="has-background-danger-light">
{% elif item.type == 'part' %}
<tr class="has-background-warning-light">
{% elif item.type == 'mode' %}
<tr class="has-background-info-light">
{% else %}
<tr>
{% endif %}
<td>
{% if item.src == 'irc' %}
<span class="icon" data-tooltip="IRC">

View File

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

View File

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