mirror of
https://github.com/pi-hole/web.git
synced 2026-05-03 15:14:39 +01:00
Add long-term graph page (#542)
* Add api_db.php?getGraphData Signed-off-by: DL6ER <dl6er@dl6er.de> * Add new DB Graph page Signed-off-by: DL6ER <dl6er@dl6er.de> * Adjust x-axis format Signed-off-by: DL6ER <dl6er@dl6er.de> * Tweaks to long term stats (#543) * add maxDate to Datepicker * remove `GO` Button from datepicker input, instead hook into the apply event to update the graphs/charts when the date range is selected * :codacy: Signed-off-by: DL6ER <dl6er@dl6er.de> * Fix comment + another :codacy: * Remove duplicated code * Add click callback to DB graph that sends the user to the DB query log page. This required some re-write of the DB queries page. * Remove uneeded global variable * Remove minDate and MaxDate as it is causing issues on fresh installs * Oh :codacy: ...
This commit is contained in:
@@ -15,15 +15,6 @@ var end__ = moment();
|
||||
var until = moment(end__).utc().valueOf()/1000;
|
||||
|
||||
$(function () {
|
||||
// Get first time stamp we have valid data for to limit selectable date/time range
|
||||
$.getJSON("api_db.php?getMinTimestamp", function(data) {
|
||||
var minDate = parseInt(data.mintimestamp);
|
||||
if(!isNaN(minDate))
|
||||
{
|
||||
$("#querytime").data("daterangepicker").minDate = moment.unix(minDate);
|
||||
}
|
||||
});
|
||||
|
||||
$("#querytime").daterangepicker(
|
||||
{
|
||||
timePicker: true, timePickerIncrement: 15,
|
||||
@@ -38,7 +29,6 @@ $(function () {
|
||||
"This Year": [moment().startOf("year"), moment()],
|
||||
"All Time": [moment(0), moment()]
|
||||
},
|
||||
startDate: start__, endDate: end__,
|
||||
"opens": "center", "showDropdowns": true
|
||||
},
|
||||
function (startt, endt) {
|
||||
@@ -184,8 +174,7 @@ function updateTopAdsChart() {
|
||||
});
|
||||
}
|
||||
|
||||
// Handle "Go" Button
|
||||
$("#btnGo").on("click", function() {
|
||||
$("#querytime").on("apply.daterangepicker", function(ev, picker) {
|
||||
updateTopClientsChart();
|
||||
updateTopDomainsChart();
|
||||
updateTopAdsChart();
|
||||
|
||||
Reference in New Issue
Block a user