neptune/core/templates/ui/drilldown/search_partial.html

432 lines
15 KiB
HTML
Raw Normal View History

2022-08-28 10:48:32 +00:00
<form class="skipEmptyFields" method="POST" hx-post="{% url 'search' %}"
2022-08-28 11:02:09 +00:00
hx-trigger="change"
hx-target="#results"
hx-swap="innerHTML"
hx-indicator="#spinner">
{% csrf_token %}
<div class="columns">
2022-08-28 10:48:32 +00:00
<div class="column">
2022-08-28 11:02:09 +00:00
<div class="field has-addons">
2022-08-28 10:48:32 +00:00
<div id="query" class="control is-expanded has-icons-left">
2022-08-28 11:02:09 +00:00
<input
2022-08-28 10:48:32 +00:00
hx-post="{% url 'search' %}"
hx-trigger="keyup changed delay:200ms"
hx-target="#results"
hx-swap="innerHTML"
name="query"
value="{{ params.query }}"
class="input"
type="text"
placeholder="(science | tech | art) + (interest) -hello">
2022-08-28 11:02:09 +00:00
<span class="icon is-small is-left">
2022-08-28 10:48:32 +00:00
<i class="fas fa-magnifying-glass"></i>
2022-08-28 11:02:09 +00:00
</span>
2022-08-28 10:48:32 +00:00
</div>
<div class="control">
2022-08-28 11:02:09 +00:00
<div class="field">
2022-08-28 10:48:32 +00:00
<button
2022-08-28 11:02:09 +00:00
id="search"
class="button is-info is-fullwidth"
hx-post="{% url 'search' %}"
hx-trigger="click"
hx-target="#results"
hx-swap="innerHTML">
Search
2022-08-28 10:48:32 +00:00
</button>
2022-08-28 11:02:09 +00:00
</div>
2022-08-28 10:48:32 +00:00
</div>
2022-08-28 11:02:09 +00:00
</div>
2022-08-28 10:48:32 +00:00
</div>
<div class="column is-3">
2022-08-28 11:02:09 +00:00
<div class="nowrap-parent">
2022-08-28 10:48:32 +00:00
<div
2022-08-28 11:02:09 +00:00
data-script="on click toggle .is-hidden on #options"
class="button is-light has-text-link is-right nowrap-child">
Options
2022-08-28 10:48:32 +00:00
</div>
<div class="nowrap-child">
2022-08-28 11:02:09 +00:00
<span id="spinner" class="button is-light has-text-link is-loading htmx-indicator">Static</span>
2022-08-28 10:48:32 +00:00
</div>
2022-08-28 11:02:09 +00:00
</div>
2022-08-28 10:48:32 +00:00
</div>
2022-08-28 11:02:09 +00:00
</div>
<div id="options" class="block is-hidden">
2022-08-28 10:48:32 +00:00
<div class="columns is-multiline">
2022-08-28 11:02:09 +00:00
<div class="column is-narrow">
2022-08-28 10:48:32 +00:00
<div class="field has-addons">
2022-08-28 11:02:09 +00:00
<div class="control has-icons-left">
2022-08-28 10:48:32 +00:00
<span class="select">
2022-08-28 11:02:09 +00:00
<select name="size">
2022-08-28 10:48:32 +00:00
{% for size in sizes %}
2022-08-28 11:02:09 +00:00
{% if size == params.size %}
2022-08-28 10:48:32 +00:00
<option selected value="{{ size }}">{{ size }}</option>
2022-08-28 11:02:09 +00:00
{% else %}
2022-08-28 10:48:32 +00:00
<option value="{{ size }}">{{ size }}</option>
2022-08-28 11:02:09 +00:00
{% endif %}
2022-08-28 10:48:32 +00:00
{% endfor %}
2022-08-28 11:02:09 +00:00
</select>
<span class="icon is-small is-left">
2022-08-28 10:48:32 +00:00
<i class="fas fa-magnifying-glass"></i>
2022-08-28 11:02:09 +00:00
</span>
2022-08-28 10:48:32 +00:00
</span>
2022-08-28 11:02:09 +00:00
</div>
<p class="control">
2022-08-28 10:48:32 +00:00
<a class="button is-static">
2022-08-28 11:02:09 +00:00
results
2022-08-28 10:48:32 +00:00
</a>
2022-08-28 11:02:09 +00:00
</p>
2022-08-28 10:48:32 +00:00
</div>
<div class="control">
2022-08-28 11:02:09 +00:00
<div class="field rounded-tooltip">
2022-08-28 10:48:32 +00:00
<input
2022-08-28 11:02:09 +00:00
id="full_query"
type="checkbox"
class="switch is-rounded is-info"
{% if params.query_full is not None %}checked="checked"{% else %}none{% endif %}
{% if not perms.core.query_search %}
2022-08-28 10:48:32 +00:00
disabled
2022-08-28 11:02:09 +00:00
{% endif %}
data-script="on click toggle .is-hidden on #query_full">
2022-08-28 10:48:32 +00:00
<label
2022-08-28 11:02:09 +00:00
for="full_query">
Full query
2022-08-28 10:48:32 +00:00
</label>
{% if not perms.core.query_search %}
2022-08-28 11:02:09 +00:00
<span class="tooltiptext tag is-danger is-light">No access</span>
2022-08-28 10:48:32 +00:00
{% endif %}
2022-08-28 11:02:09 +00:00
</div>
2022-08-28 10:48:32 +00:00
</div>
2022-08-28 11:02:09 +00:00
</div>
<div class="column is-narrow">
2022-08-28 10:48:32 +00:00
<div class="field has-addons block">
2022-08-28 11:02:09 +00:00
<div class="control has-icons-left">
2022-08-28 10:48:32 +00:00
<span class="select">
2022-08-28 11:02:09 +00:00
<select id="source" name="source">
2022-08-28 10:48:32 +00:00
{% if params.source == 'irc' %}
2022-08-28 11:02:09 +00:00
<option selected value="irc">IRC</option>
2022-08-28 10:48:32 +00:00
{% else %}
2022-08-28 11:02:09 +00:00
<option value="irc">IRC</option>
2022-08-28 10:48:32 +00:00
{% endif %}
{% if params.source == 'dis' %}
2022-08-28 11:02:09 +00:00
<option selected value="dis">Discord</option>
2022-08-28 10:48:32 +00:00
{% else %}
2022-08-28 11:02:09 +00:00
<option value="dis">Discord</option>
2022-08-28 10:48:32 +00:00
{% endif %}
{% if params.source == None %}
2022-08-28 11:02:09 +00:00
<option selected value="all">All</option>
2022-08-28 10:48:32 +00:00
{% elif params.source == 'all' %}
2022-08-28 11:02:09 +00:00
<option selected value="all">All</option>
2022-08-28 10:48:32 +00:00
{% else %}
2022-08-28 11:02:09 +00:00
<option value="all">All</option>
2022-08-28 10:48:32 +00:00
{% endif %}
2022-08-28 11:02:09 +00:00
</select>
<span class="icon is-small is-left">
2022-08-28 10:48:32 +00:00
<i class="fas fa-magnifying-glass"></i>
2022-08-28 11:02:09 +00:00
</span>
2022-08-28 10:48:32 +00:00
</span>
2022-08-28 11:02:09 +00:00
</div>
<p class="control">
2022-08-28 10:48:32 +00:00
<a class="button is-static">
2022-08-28 11:02:09 +00:00
source
2022-08-28 10:48:32 +00:00
</a>
2022-08-28 11:02:09 +00:00
</p>
2022-08-28 10:48:32 +00:00
</div>
<div class="control">
2022-08-28 11:02:09 +00:00
<div class="field">
2022-08-28 10:48:32 +00:00
<input
2022-08-28 11:02:09 +00:00
id="dedup_switch"
type="checkbox"
class="switch is-rounded is-info"
name="dedup"
{% if params.dedup == "on" %}
2022-08-28 10:48:32 +00:00
checked="checked"
2022-08-28 11:02:09 +00:00
{% endif %}>
2022-08-28 10:48:32 +00:00
<label
2022-08-28 11:02:09 +00:00
for="dedup_switch">
Deduplicate results
2022-08-28 10:48:32 +00:00
</label>
2022-08-28 11:02:09 +00:00
</div>
2022-08-28 10:48:32 +00:00
</div>
2022-08-28 11:02:09 +00:00
</div>
<div class="column is-narrow">
2022-08-28 10:48:32 +00:00
<div id="sentiment">
2022-08-28 11:02:09 +00:00
<div class="field has-addons">
2022-08-28 10:48:32 +00:00
<div class="control">
2022-08-28 11:02:09 +00:00
<input
2022-08-28 10:48:32 +00:00
{% if params.check_sentiment != "on" %}
2022-08-28 11:02:09 +00:00
disabled="undefined"
2022-08-28 10:48:32 +00:00
{% endif %}
name="sentiment" id="sliderWithValue" class="slider has-output-tooltip is-fullwidth" min="-1" max="1"
{% if params.sentiment == None %}
2022-08-28 11:02:09 +00:00
value="0"
2022-08-28 10:48:32 +00:00
{% else %}
2022-08-28 11:02:09 +00:00
value="{{ params.sentiment }}"
2022-08-28 10:48:32 +00:00
{% endif %}
step="0.05" type="range">
2022-08-28 11:02:09 +00:00
<output for="sliderWithValue" class="slider-output">
2022-08-28 10:48:32 +00:00
{% if params.sentiment == None %}
2022-08-28 11:02:09 +00:00
0
2022-08-28 10:48:32 +00:00
{% else %}
2022-08-28 11:02:09 +00:00
{{ params.sentiment }}
2022-08-28 10:48:32 +00:00
{% endif %}
2022-08-28 11:02:09 +00:00
</output>
<script>bulmaSlider.attach();</script>
2022-08-28 10:48:32 +00:00
</div>
<p class="control">
2022-08-28 11:02:09 +00:00
<a class="button is-static">
2022-08-28 10:48:32 +00:00
sentiment
2022-08-28 11:02:09 +00:00
</a>
2022-08-28 10:48:32 +00:00
</p>
2022-08-28 11:02:09 +00:00
</div>
<div class="control">
2022-08-28 10:48:32 +00:00
<label class="radio button has-text-link">
2022-08-28 12:11:30 +00:00
<input
type="radio"
value="below"
class="sentiment-radio"
{% if params.sentiment_method == 'below' %}
checked
{% endif %}
name="sentiment_method"
{% if params.check_sentiment != "on" %}
disabled
{% endif %}>
2022-08-28 11:02:09 +00:00
<span class="icon" data-tooltip="Below">
2022-08-28 10:48:32 +00:00
<i class="fa-solid fa-face-frown"></i>
2022-08-28 11:02:09 +00:00
</span>
2022-08-28 10:48:32 +00:00
</label>
<label class="radio button has-text-link is-hidden">
2022-08-28 12:11:30 +00:00
<input
type="radio"
value="exact"
class="sentiment-radio"
{% if params.sentiment_method == 'exact' %}
checked
{% endif %}
name="sentiment_method"
{% if params.check_sentiment != "on" %}
disabled
{% endif %}>
2022-08-28 11:02:09 +00:00
<span class="icon" data-tooltip="Exact">
2022-08-28 10:48:32 +00:00
<i class="fa-solid fa-face-smile"></i>
2022-08-28 11:02:09 +00:00
</span>
2022-08-28 10:48:32 +00:00
</label>
<label class="radio button has-text-link">
2022-08-28 12:11:30 +00:00
<input
type="radio"
value="above"
class="sentiment-radio"
{% if params.sentiment_method == 'above' %}
checked
{% endif %}
name="sentiment_method"
{% if params.check_sentiment != "on" %}
disabled
{% endif %}>
2022-08-28 11:02:09 +00:00
<span class="icon" data-tooltip="Above">
2022-08-28 10:48:32 +00:00
<i class="fa-solid fa-face-smile"></i>
2022-08-28 11:02:09 +00:00
</span>
2022-08-28 10:48:32 +00:00
</label>
<label class="radio button has-text-link">
2022-08-28 12:11:30 +00:00
<input
type="radio"
value="nonzero"
class="sentiment-radio"
{% if params.sentiment_method == 'nonzero' %}
checked
{% endif %}
name="sentiment_method"
{% if params.check_sentiment != "on" %}
disabled
{% endif %}>
2022-08-28 11:02:09 +00:00
<span class="icon" data-tooltip="Nonzero">
2022-08-28 10:48:32 +00:00
<i class="fa-solid fa-face-meh-blank"></i>
2022-08-28 11:02:09 +00:00
</span>
2022-08-28 10:48:32 +00:00
</label>
2022-08-28 11:02:09 +00:00
</div>
2022-08-28 10:48:32 +00:00
</div>
<div class="control">
2022-08-28 11:02:09 +00:00
<div class="field">
2022-08-28 10:48:32 +00:00
<input
2022-08-28 11:02:09 +00:00
id="sentiment_switch"
type="checkbox"
class="switch is-rounded is-info"
name="check_sentiment"
data-script="on click toggle @disabled on #sliderWithValue then toggle @disabled on #sentiment then toggle @disabled on .sentiment-radio"
{% if params.check_sentiment == "on" %}
2022-08-28 10:48:32 +00:00
checked
2022-08-28 11:02:09 +00:00
{% endif %}>
2022-08-28 10:48:32 +00:00
<label
2022-08-28 11:02:09 +00:00
for="sentiment_switch">
Check sentiment
2022-08-28 10:48:32 +00:00
</label>
2022-08-28 11:02:09 +00:00
</div>
2022-08-28 10:48:32 +00:00
</div>
<div class="control">
2022-08-28 11:02:09 +00:00
<div class="field">
2022-08-28 10:48:32 +00:00
<input
2022-08-28 11:02:09 +00:00
id="sentiment_graph_switch"
type="checkbox"
class="switch is-rounded is-info"
name="show_sentiment"
data-script="on click toggle .is-hidden on #sentiment-container">
2022-08-28 10:48:32 +00:00
<label
2022-08-28 11:02:09 +00:00
for="sentiment_graph_switch">
Show graph
2022-08-28 10:48:32 +00:00
</label>
2022-08-28 11:02:09 +00:00
</div>
2022-08-28 10:48:32 +00:00
</div>
2022-08-28 11:02:09 +00:00
</div>
<div class="column is-narrow">
2022-08-28 10:48:32 +00:00
<div id="date">
2022-08-28 11:02:09 +00:00
<div class="field">
2022-08-28 10:48:32 +00:00
<div class="control">
2022-08-28 11:02:09 +00:00
<input type="date" name="dates" value="{{ params.date }}">
<script>
2022-08-28 10:48:32 +00:00
var options = {
2022-08-28 11:02:09 +00:00
"type": "datetime",
"isRange": true,
"color": "info",
"validateLabel": "Save",
"dateFormat": "yyyy-MM-dd",
"startDate": "{{ params.from_date|escapejs }}",
"startTime": "{{ params.from_time|escapejs }}",
"endDate": "{{ params.to_date|escapejs }}",
"endTime": "{{ params.to_time|escapejs }}",
"displayMode": "dialog"
2022-08-28 10:48:32 +00:00
};
// Initialize all input of type date
var calendars = bulmaCalendar.attach('[type="date"]', options);
// Loop on each calendar initialized
for(var i = 0; i < calendars.length; i++) {
2022-08-28 11:02:09 +00:00
// Add listener to select event
calendars[i].on('save', date => {
2022-08-28 10:48:32 +00:00
htmx.trigger("#search", "click");
2022-08-28 11:02:09 +00:00
});
2022-08-28 10:48:32 +00:00
}
2022-08-28 11:02:09 +00:00
</script>
2022-08-28 10:48:32 +00:00
</div>
2022-08-28 11:02:09 +00:00
</div>
<div class="control">
2022-08-28 10:48:32 +00:00
<label class="radio button has-text-link">
2022-08-28 12:11:30 +00:00
<input
type="radio"
value="desc"
name="sorting"
{% if params.sorting == None %}
checked
{% elif params.sorting == 'desc' %}
checked
{% endif %}>
2022-08-28 11:02:09 +00:00
<span class="icon" data-tooltip="Sort descending">
2022-08-28 10:48:32 +00:00
<i class="fa-solid fa-sort-down"></i>
2022-08-28 11:02:09 +00:00
</span>
2022-08-28 10:48:32 +00:00
</label>
<label class="radio button">
2022-08-28 12:11:30 +00:00
<input
type="radio"
value="asc"
name="sorting"
{% if params.sorting == 'asc' %}
checked
{% endif %}>
2022-08-28 11:02:09 +00:00
<span class="icon" data-tooltip="Sort ascending">
2022-08-28 10:48:32 +00:00
<i class="fa-solid fa-sort-up"></i>
2022-08-28 11:02:09 +00:00
</span>
2022-08-28 10:48:32 +00:00
</label>
<label class="radio button">
2022-08-28 12:11:30 +00:00
<input
type="radio"
value="none"
name="sorting"
{% if params.sorting == 'none' %}
checked
{% endif %}>
2022-08-28 11:02:09 +00:00
<span class="icon" data-tooltip="No sort">
2022-08-28 10:48:32 +00:00
<i class="fa-solid fa-sort"></i>
2022-08-28 11:02:09 +00:00
</span>
2022-08-28 10:48:32 +00:00
</label>
2022-08-28 11:02:09 +00:00
</div>
2022-08-28 10:48:32 +00:00
</div>
2022-08-28 11:02:09 +00:00
</div>
<div class="column is-narrow rounded-tooltip">
2022-08-28 10:48:32 +00:00
<div class="field has-addons">
2022-08-28 11:02:09 +00:00
<div class="control has-icons-left">
2022-08-28 10:48:32 +00:00
<span class="select is-warning">
2022-08-28 11:02:09 +00:00
<select {% if not user.is_superuser %}disabled{% endif %} id="index" name="index">
2022-08-28 10:48:32 +00:00
{% if params.index == 'main' %}
2022-08-28 11:02:09 +00:00
<option selected value="main">Main</option>
2022-08-28 10:48:32 +00:00
{% elif params.index == None %}
2022-08-28 11:02:09 +00:00
<option selected value="main">Main</option>
2022-08-28 10:48:32 +00:00
{% else %}
2022-08-28 11:02:09 +00:00
<option value="main">Main</option>
2022-08-28 10:48:32 +00:00
{% endif %}
{% if params.index == 'int' %}
2022-08-28 11:02:09 +00:00
<option selected value="int">Internal</option>
2022-08-28 10:48:32 +00:00
{% else %}
2022-08-28 11:02:09 +00:00
<option value="int">Internal</option>
2022-08-28 10:48:32 +00:00
{% endif %}
{% if params.index == 'meta' %}
2022-08-28 11:02:09 +00:00
<option selected value="meta">Meta</option>
2022-08-28 10:48:32 +00:00
{% else %}
2022-08-28 11:02:09 +00:00
<option value="meta">Meta</option>
2022-08-28 10:48:32 +00:00
{% endif %}
2022-08-28 11:02:09 +00:00
</select>
<span class="icon is-small is-left">
2022-08-28 10:48:32 +00:00
<i class="fas fa-magnifying-glass"></i>
2022-08-28 11:02:09 +00:00
</span>
2022-08-28 10:48:32 +00:00
</span>
2022-08-28 11:02:09 +00:00
</div>
<p class="control">
2022-08-28 10:48:32 +00:00
<a class="button is-static">
2022-08-28 11:02:09 +00:00
index
2022-08-28 10:48:32 +00:00
</a>
2022-08-28 11:02:09 +00:00
</p>
2022-08-28 10:48:32 +00:00
</div>
{% if not user.is_superuser %}
2022-08-28 11:02:09 +00:00
<span class="tooltiptext tag is-danger is-light">No access</span>
2022-08-28 10:48:32 +00:00
{% endif %}
2022-08-28 11:02:09 +00:00
</div>
2022-08-28 10:48:32 +00:00
</div>
2022-08-28 11:02:09 +00:00
</div>
<div id="query_full" class="block {% if params.query_full is None %}is-hidden{% endif %}">
2022-08-28 10:48:32 +00:00
<div class="control is-expanded has-icons-left">
2022-08-28 11:02:09 +00:00
<input
2022-08-28 10:48:32 +00:00
hx-post="{% url 'search' %}"
hx-trigger="keyup changed delay:200ms"
hx-target="#results"
hx-swap="innerHTML"
name="query_full"
value="{{ params.query_full }}"
class="input"
type="text"
placeholder="msg: science AND nick: BillNye AND channel: #science">
2022-08-28 11:02:09 +00:00
<span class="icon is-small is-left">
2022-08-28 10:48:32 +00:00
<i class="fas fa-magnifying-glass"></i>
2022-08-28 11:02:09 +00:00
</span>
2022-08-28 10:48:32 +00:00
</div>
2022-08-28 11:02:09 +00:00
</div>
<div class="block">
2022-08-28 10:48:32 +00:00
<input
2022-08-28 11:02:09 +00:00
hx-trigger="change"
hx-post="{% url 'search' %}"
hx-target="#results"
hx-swap="innerHTML"
id="tags"
class="input"
type="tags"
name="tags"
placeholder="Add tags"
value="{{ params.tags }}">
</div>
<div class="is-hidden"></div>
2022-08-28 10:48:32 +00:00
</form>