fix: wrong qs param, allow string to be passed to util.getDaysArray

v1.18.x
Julian Lam 4 years ago
parent cc93822436
commit f8e1a74c26

@ -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);

@ -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;

@ -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;

@ -22,7 +22,7 @@
</div>
<div class="col-sm-3 hidden-xs text-center pageview-stats">
<div><strong id="pageViewsPastDay">{{{ if summary.day }}}{./summary.day}{{{ else }}}0{{{ end }}}</strong></div>
<div><a href="#" class="updatePageviewsGraph active" data-action="updateGraph" data-units="hours">[[admin/dashboard:page-views-last-day]]</a></div>
<div><a href="#" class="updatePageviewsGraph" data-action="updateGraph" data-units="hours" data-amount="24">[[admin/dashboard:page-views-last-day]]</a></div>
</div>
<div class="col-sm-3 text-center pageview-stats">
<div><strong><i class="fa fa-clock-o"></i></strong></div>

Loading…
Cancel
Save