Long-term data: Show date range only after user chose a valid range. Fixes #897

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2019-01-22 23:29:45 +01:00
parent be1a765773
commit a975576616
6 changed files with 19 additions and 7 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ $token = $_SESSION['token'];
<div class="input-group-addon"> <div class="input-group-addon">
<i class="fa fa-clock-o"></i> <i class="fa fa-clock-o"></i>
</div> </div>
<input type="text" class="form-control pull-right" id="querytime"> <input type="text" class="form-control pull-right" id="querytime" value="Click to select date and time range">
</div> </div>
<!-- /.input group --> <!-- /.input group -->
</div> </div>
+1 -1
View File
@@ -33,7 +33,7 @@ $token = $_SESSION['token'];
<div class="input-group-addon"> <div class="input-group-addon">
<i class="fa fa-clock-o"></i> <i class="fa fa-clock-o"></i>
</div> </div>
<input type="text" class="form-control pull-right" id="querytime"> <input type="text" class="form-control pull-right" id="querytime" value="Click to select date and time range">
</div> </div>
<!-- /.input group --> <!-- /.input group -->
</div> </div>
+1 -1
View File
@@ -33,7 +33,7 @@ $token = $_SESSION['token'];
<div class="input-group-addon"> <div class="input-group-addon">
<i class="fa fa-clock-o"></i> <i class="fa fa-clock-o"></i>
</div> </div>
<input type="text" class="form-control pull-right" id="querytime"> <input type="text" class="form-control pull-right" id="querytime" value="Click to select date and time range">
</div> </div>
<!-- /.input group --> <!-- /.input group -->
</div> </div>
+6 -2
View File
@@ -16,11 +16,13 @@ var until = moment(end__).utc().valueOf()/1000;
var timeoutWarning = $("#timeoutWarning"); var timeoutWarning = $("#timeoutWarning");
var dateformat = "MMMM Do YYYY, HH:mm";
$(function () { $(function () {
$("#querytime").daterangepicker( $("#querytime").daterangepicker(
{ {
timePicker: true, timePickerIncrement: 15, timePicker: true, timePickerIncrement: 15,
locale: { format: "MMMM Do YYYY, HH:mm" }, locale: { format: dateformat },
ranges: { ranges: {
"Today": [moment().startOf("day"), moment()], "Today": [moment().startOf("day"), moment()],
"Yesterday": [moment().subtract(1, "days").startOf("day"), moment().subtract(1, "days").endOf("day")], "Yesterday": [moment().subtract(1, "days").startOf("day"), moment().subtract(1, "days").endOf("day")],
@@ -31,7 +33,8 @@ $(function () {
"This Year": [moment().startOf("year"), moment()], "This Year": [moment().startOf("year"), moment()],
"All Time": [moment(0), moment()] "All Time": [moment(0), moment()]
}, },
"opens": "center", "showDropdowns": true "opens": "center", "showDropdowns": true,
"autoUpdateInput": false
}, },
function (startt, endt) { function (startt, endt) {
from = moment(startt).utc().valueOf()/1000; from = moment(startt).utc().valueOf()/1000;
@@ -243,6 +246,7 @@ $(document).ready(function() {
}); });
$("#querytime").on("apply.daterangepicker", function(ev, picker) { $("#querytime").on("apply.daterangepicker", function(ev, picker) {
$(this).val(picker.startDate.format(dateformat) + " to " + picker.endDate.format(dateformat));
$("#queries-over-time").show(); $("#queries-over-time").show();
updateQueriesOverTime(); updateQueriesOverTime();
}); });
+5 -1
View File
@@ -17,6 +17,8 @@ var until = moment(end__).utc().valueOf()/1000;
var timeoutWarning = $("#timeoutWarning"); var timeoutWarning = $("#timeoutWarning");
var listsStillLoading = 0; var listsStillLoading = 0;
var dateformat = "MMMM Do YYYY, HH:mm";
$(function () { $(function () {
$("#querytime").daterangepicker( $("#querytime").daterangepicker(
{ {
@@ -32,7 +34,8 @@ $(function () {
"This Year": [moment().startOf("year"), moment()], "This Year": [moment().startOf("year"), moment()],
"All Time": [moment(0), moment()] "All Time": [moment(0), moment()]
}, },
"opens": "center", "showDropdowns": true "opens": "center", "showDropdowns": true,
"autoUpdateInput": false
}, },
function (startt, endt) { function (startt, endt) {
from = moment(startt).utc().valueOf()/1000; from = moment(startt).utc().valueOf()/1000;
@@ -190,6 +193,7 @@ function updateTopAdsChart() {
} }
$("#querytime").on("apply.daterangepicker", function(ev, picker) { $("#querytime").on("apply.daterangepicker", function(ev, picker) {
$(this).val(picker.startDate.format(dateformat) + " to " + picker.endDate.format(dateformat));
timeoutWarning.show(); timeoutWarning.show();
listsStillLoading = 3; listsStillLoading = 3;
updateTopClientsChart(); updateTopClientsChart();
+5 -1
View File
@@ -18,6 +18,8 @@ var daterange;
var timeoutWarning = $("#timeoutWarning"); var timeoutWarning = $("#timeoutWarning");
var dateformat = "MMMM Do YYYY, HH:mm";
// Do we want to filter queries? // Do we want to filter queries?
var GETDict = {}; var GETDict = {};
location.search.substr(1).split("&").forEach(function(item) {GETDict[item.split("=")[0]] = item.split("=")[1];}); location.search.substr(1).split("&").forEach(function(item) {GETDict[item.split("=")[0]] = item.split("=")[1];});
@@ -46,7 +48,8 @@ $(function () {
"This Year": [moment().startOf("year"), moment()], "This Year": [moment().startOf("year"), moment()],
"All Time": [moment(0), moment()] "All Time": [moment(0), moment()]
}, },
"opens": "center", "showDropdowns": true "opens": "center", "showDropdowns": true,
"autoUpdateInput": false
}, },
function (startt, endt) { function (startt, endt) {
from = moment(startt).utc().valueOf()/1000; from = moment(startt).utc().valueOf()/1000;
@@ -332,6 +335,7 @@ $(document).ready(function() {
} ); } );
$("#querytime").on("apply.daterangepicker", function(ev, picker) { $("#querytime").on("apply.daterangepicker", function(ev, picker) {
$(this).val(picker.startDate.format(dateformat) + " to " + picker.endDate.format(dateformat));
refreshTableData(); refreshTableData();
}); });