diff --git a/public/src/admin/dashboard.js b/public/src/admin/dashboard.js index 7ed5d572fe..02e34c2ff8 100644 --- a/public/src/admin/dashboard.js +++ b/public/src/admin/dashboard.js @@ -330,8 +330,6 @@ define('admin/dashboard', ['Chart', 'translator', 'benchpress'], function (Chart } until = until.getTime(); updateTrafficGraph($(this).attr('data-units'), until, amount); - $('[data-action="updateGraph"]').removeClass('active'); - $(this).addClass('active'); require(['translator'], function (translator) { translator.translate('[[admin/dashboard:page-views-custom]]', function (translated) { @@ -373,8 +371,6 @@ define('admin/dashboard', ['Chart', 'translator', 'benchpress'], function (Chart if (!formData.startRange && !formData.endRange) { // No range? Assume last 30 days updateTrafficGraph('days'); - $('[data-action="updateGraph"]').removeClass('active'); - $('[data-action="updateGraph"][data-units="days"]').addClass('active'); return; } else if (!validRegexp.test(formData.startRange) || !validRegexp.test(formData.endRange)) { // Invalid Input @@ -388,8 +384,6 @@ define('admin/dashboard', ['Chart', 'translator', 'benchpress'], function (Chart var amount = (until - new Date(formData.startRange).getTime()) / (1000 * 60 * 60 * 24); updateTrafficGraph('days', until, amount); - $('[data-action="updateGraph"]').removeClass('active'); - targetEl.addClass('active'); // Update "custom range" label targetEl.attr('data-startRange', formData.startRange); diff --git a/public/src/admin/modules/dashboard-line-graph.js b/public/src/admin/modules/dashboard-line-graph.js index 473fb81964..705adbd223 100644 --- a/public/src/admin/modules/dashboard-line-graph.js +++ b/public/src/admin/modules/dashboard-line-graph.js @@ -80,8 +80,6 @@ define('admin/modules/dashboard-line-graph', ['Chart', 'translator', 'benchpress } until = until.getTime(); Graph.update(set, $(this).attr('data-units'), until, amount); - $('[data-action="updateGraph"]').removeClass('active'); - $(this).addClass('active'); require(['translator'], function (translator) { translator.translate('[[admin/dashboard:page-views-custom]]', function (translated) { @@ -123,8 +121,6 @@ define('admin/modules/dashboard-line-graph', ['Chart', 'translator', 'benchpress if (!formData.startRange && !formData.endRange) { // No range? Assume last 30 days Graph.update(set, 'days'); - $('[data-action="updateGraph"]').removeClass('active'); - $('[data-action="updateGraph"][data-units="days"]').addClass('active'); return; } else if (!validRegexp.test(formData.startRange) || !validRegexp.test(formData.endRange)) { // Invalid Input @@ -138,8 +134,6 @@ define('admin/modules/dashboard-line-graph', ['Chart', 'translator', 'benchpress var amount = (until - new Date(formData.startRange).getTime()) / (1000 * 60 * 60 * 24); Graph.update(set, 'days', until, amount); - $('[data-action="updateGraph"]').removeClass('active'); - targetEl.addClass('active'); // Update "custom range" label targetEl.attr('data-startRange', formData.startRange); @@ -154,7 +148,7 @@ define('admin/modules/dashboard-line-graph', ['Chart', 'translator', 'benchpress set, units = ajaxify.data.query.units || 'hours', until = ajaxify.data.query.until, - amount = ajaxify.data.query.amount + amount = ajaxify.data.query.count ) => { if (!Graph._current) { return; diff --git a/public/src/utils.js b/public/src/utils.js index 0a4696f98d..ea43181139 100644 --- a/public/src/utils.js +++ b/public/src/utils.js @@ -595,7 +595,7 @@ }, getDaysArray: function (from, amount) { - var currentDay = new Date(from || Date.now()).getTime(); + var currentDay = new Date(parseInt(from, 10) || Date.now()).getTime(); var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; var labels = []; var tmpDate; diff --git a/src/views/admin/partials/dashboard/graph.tpl b/src/views/admin/partials/dashboard/graph.tpl index 87595a3581..d2604f2332 100644 --- a/src/views/admin/partials/dashboard/graph.tpl +++ b/src/views/admin/partials/dashboard/graph.tpl @@ -22,7 +22,7 @@