more work on new traffic view

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-09-08 10:27:03 +02:00
parent 6f2652f9dd
commit bc7e4be47a
7 changed files with 61 additions and 46 deletions

View File

@@ -0,0 +1,9 @@
$(function () {
// Display helptext to content box according to dns-record type selected
$("select[name='range']").on('change', function () {
var selVal = $(this).val();
var baseRef = $(this).data('baseref');
window.location.href = baseRef + '?range=' + selVal;
});
});

View File

@@ -24,3 +24,4 @@ require('./components/configfiles')
require('./components/apikeys')
require('./components/install')
require('./components/dnseditor')
require('./components/traffic')

View File

@@ -17,16 +17,20 @@
<!-- Range -->
<!-- TODO: set url on change. e.g.: ?param=days:7 -->
<div class="d-flex justify-content-end">
<select class="form-select mb-4 w-auto mt-n4" aria-label="select the traffic range" name="range">
<option value="hours:24">last 24 hours</option>
<option value="days:7">last 7 days</option>
<option value="days:30">last 30 days</option>
<option value="months:3">last 3 months</option>
<option value="months:6">last 6 months</option>
<option value="months:12">last 12 months</option>
<option value="year:2022">2022</option>
<option value="year:2021">2021</option>
<option value="year:2020">2020</option>
<select class="form-select mb-4 w-auto mt-n4" aria-label="select the traffic range" name="range" data-baseref="{{ linker({'section':'traffic'}) }}">
<option value="hours:24" {% if range == 'hours:24' %}selected{% endif %}>last 24 hours</option>
<option value="days:7" {% if range == 'days:7' %}selected{% endif %}>last 7 days</option>
<option value="days:30" {% if range == 'days:30' %}selected{% endif %}>last 30 days</option>
<option value="currentmonth" {% if range == 'currentmonth' %}selected{% endif %}>current month</option>
<option value="months:3" {% if range == 'months:3' %}selected{% endif %}>last 3 months</option>
<option value="months:6" {% if range == 'months:6' %}selected{% endif %}>last 6 months</option>
<option value="months:12" {% if range == 'months:12' %}selected{% endif %}>last 12 months</option>
<option value="currentyear" {% if range == 'currentyear' %}selected{% endif %}>current year</option>
{% for yd in years_avail %}
{% if yd.year != "now"|date('Y') %}
<option value="year:{{ yd.year }}" {% if range == 'year:' ~ yd.year %}selected{% endif %}>{{ yd.year }}</option>
{% endif %}
{% endfor %}
</select>
</div>