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

113 lines
3.5 KiB
HTML
Raw Normal View History

2022-07-21 12:45:28 +00:00
{% extends "base.html" %}
{% load static %}
2022-08-09 06:20:30 +00:00
{% load joinsep %}
2022-08-28 10:48:32 +00:00
{% block outer_content %}
2022-08-09 06:20:30 +00:00
{% if params.modal == 'context' %}
2022-08-09 06:20:30 +00:00
<div
style="display: none;"
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-post="{% url 'modal_context' %}"
hx-vals='{"net": "{{ params.net|escapejs }}",
"num": "{{ params.num|escapejs }}",
"source": "{{ params.source|escapejs }}",
2022-08-09 06:20:30 +00:00
"channel": "{{ params.channel|escapejs }}",
"time": "{{ params.time|escapejs }}",
"date": "{{ params.date|escapejs }}",
"index": "{{ params.index }}",
"type": "{{ params.type|escapejs }}",
"mtype": "{{ params.mtype|escapejs }}",
2022-08-14 22:01:21 +00:00
"nick": "{{ params.nick|escapejs }}"}'
2022-08-09 06:20:30 +00:00
hx-target="#modals-here"
hx-trigger="load">
</div>
2022-08-09 06:20:30 +00:00
{% endif %}
2022-08-05 22:10:07 +00:00
<script src="{% static 'js/chart.js' %}"></script>
<script src="{% static 'tabs.js' %}"></script>
<script>
2022-08-09 06:20:30 +00:00
function setupTags() {
2022-08-03 06:20:30 +00:00
var inputTags = document.getElementById('tags');
2022-08-09 06:20:30 +00:00
new BulmaTagsInput(inputTags);
inputTags.BulmaTagsInput().on('before.add', function(item) {
if (item.includes(": ")) {
var spl = item.split(": ");
} else {
var spl = item.split(":");
}
var field = spl[0];
try {
var value = JSON.parse(spl[1]);
} catch {
var value = spl[1];
}
return `${field}: ${value}`;
});
inputTags.BulmaTagsInput().on('after.remove', function(item) {
var spl = item.split(": ");
var field = spl[0];
var value = spl[1].trim();
2022-08-09 06:20:30 +00:00
});
2022-08-03 06:20:30 +00:00
}
2022-08-09 06:20:30 +00:00
function populateSearch(field, value) {
var inputTags = document.getElementById('tags');
inputTags.BulmaTagsInput().add(field+": "+value);
htmx.trigger("#search", "click");
}
</script>
2022-08-28 12:11:30 +00:00
2022-08-29 11:24:06 +00:00
<div class="grid-stack" id="grid-stack-main">
2022-08-28 10:57:20 +00:00
<div class="grid-stack-item" gs-w="7" gs-h="10" gs-y="0" gs-x="1">
2022-08-28 12:11:30 +00:00
<div class="grid-stack-item-content">
<nav class="panel">
<p class="panel-heading" style="padding: .2em; line-height: .5em;">
<i class="fa-solid fa-arrows-up-down-left-right has-text-grey-light"></i>
Search
</p>
<article class="panel-block is-active">
{% include 'ui/drilldown/search_partial.html' %}
</article>
</nav>
</div>
2022-08-28 10:48:32 +00:00
</div>
2022-07-21 12:50:51 +00:00
</div>
2022-07-21 12:52:06 +00:00
<div id="modals-here">
</div>
2022-08-28 19:26:15 +00:00
<div id="items-here">
</div>
2022-08-29 11:24:06 +00:00
<div id="widgets-here" style="display: none;">
</div>
2022-08-26 06:20:30 +00:00
<div id="results" style="display: none;">
{% if table %}
{% include 'widgets/table_results.html' %}
{% endif %}
</div>
2022-08-28 10:48:32 +00:00
<script>
var grid = GridStack.init({
cellHeight: 20,
2022-08-28 12:11:30 +00:00
cellWidth: 50,
2022-08-28 10:48:32 +00:00
auto: true,
float: true,
draggable: {handle: '.panel-heading', scroll: false, appendTo: 'body'},
removable: false,
});
2022-08-28 12:11:30 +00:00
// GridStack.init();
setupTags();
2022-08-28 10:48:32 +00:00
</script>
2022-08-26 06:20:30 +00:00
{% if table %}
<script>
2022-08-26 06:20:30 +00:00
//var contents = $("#drilldown-widget").outerHTML;
var contents = document.getElementById("drilldown-widget");
var scripts = contents.getElementsByTagName("script");
var grid = document.getElementById("grid-stack-main").gridstack;
grid.addWidget(contents.innerHTML);
contents.outerHTML = "";
// restore scripts that aren't going to be run
for (var i = 0; i < scripts.length; i++) {
eval(scripts[i].innerHTML);
}
2022-08-26 06:20:30 +00:00
</script>
2022-08-26 06:20:30 +00:00
2022-08-26 06:20:30 +00:00
{% endif %}
2022-08-28 12:11:30 +00:00
{% endblock %}