Fix tag population and date formatting

This commit is contained in:
2022-08-11 07:22:22 +01:00
parent 54f82f772b
commit 86ec95ab6c
4 changed files with 189 additions and 179 deletions

View File

@@ -1,5 +1,6 @@
{% load static %}
{% load index %}
{% load joinsep %}
{% include 'partials/notify.html' %}
{% if table %}
<div style="display: none" id="jsonData" data-json="{{ data }}">
@@ -35,4 +36,24 @@
{% include 'ui/drilldown/table_results_partial.html' %}
</div>
</div>
{% endif %}
{% endif %}
{# Update the tags in case the user changed the query #}
{# Check for focus and refocus #}
<script>
var inputTags = document.getElementsByClassName('tags-input');
var inputBox = document.querySelector("[placeholder='Add query']");
var isFocused = (document.activeElement === inputBox);
for (index = 0; index < inputTags.length; index++) {
if (index == 0) {
inputTags[0].outerHTML = '<input id="tags" class="input" type="tags" placeholder="Add query" value="{{ tags|joinsep:',' }}">';
} else {
inputTags[index].remove();
}
}
// inputTags[0].outerHTML = '<input id="tags" class="input" type="tags" placeholder="Add query" value="{{ tags|joinsep:',' }}">';
setupTags();
var inputBox = document.querySelector("[placeholder='Add query']");
if (isFocused) {
inputBox.focus();
}
</script>