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

View File

@ -5,26 +5,35 @@
<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 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>
</div>
<div class="columns">
<div class="column"> <div class="column">
<label class="label">Results</label> <div class="field has-addons">
<div class="field">
<div class="control is-expanded has-icons-left"> <div class="control is-expanded has-icons-left">
<div class="select is-fullwidth"> <span class="select is-fullwidth">
<select name="size"> <select name="size">
{% for size in sizes %} {% for size in sizes %}
<option value="{{ size }}">{{ size }}</option> <option value="{{ size }}">{{ size }}</option>
@ -33,25 +42,17 @@
<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> </span>
</div> </div>
<p class="control">
<a class="button is-static">
results
</a>
</p>
</div> </div>
</div> </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> </form>
</div> </div>

View File

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

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="control is-expanded has-icons-left">
<div class="field-body"> <input id="query" name="query" class="input" type="text" placeholder="nickname">
<div class="field"> <span class="icon is-small is-left">
<div class="control is-expanded has-icons-left"> <i class="fas fa-magnifying-glass"></i>
<input id="query" name="query" class="input" type="text" placeholder="nickname"> </span>
<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">
<button <button
class="button is-primary is-fullwidth" class="button is-primary is-fullwidth"