|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
define('admin/manage/ip-blacklist', [], function () {
|
|
|
|
|
define('admin/manage/ip-blacklist', ['Chart'], function (Chart) {
|
|
|
|
|
var Blacklist = {};
|
|
|
|
|
|
|
|
|
|
Blacklist.init = function () {
|
|
|
|
@ -37,6 +37,100 @@ define('admin/manage/ip-blacklist', [], function () {
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Blacklist.setupAnalytics();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Blacklist.setupAnalytics = function () {
|
|
|
|
|
var hourlyCanvas = document.getElementById('blacklist:hourly');
|
|
|
|
|
var dailyCanvas = document.getElementById('blacklist:daily');
|
|
|
|
|
var hourlyLabels = utils.getHoursArray().map(function (text, idx) {
|
|
|
|
|
return idx % 3 ? '' : text;
|
|
|
|
|
});
|
|
|
|
|
var dailyLabels = utils.getDaysArray().map(function (text, idx) {
|
|
|
|
|
return idx % 3 ? '' : text;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Only 7 days displayed in this chart
|
|
|
|
|
dailyLabels.length = 7;
|
|
|
|
|
|
|
|
|
|
if (utils.isMobile()) {
|
|
|
|
|
Chart.defaults.global.tooltips.enabled = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var data = {
|
|
|
|
|
'blacklist:hourly': {
|
|
|
|
|
labels: hourlyLabels,
|
|
|
|
|
datasets: [
|
|
|
|
|
{
|
|
|
|
|
label: '',
|
|
|
|
|
backgroundColor: 'rgba(186,139,175,0.2)',
|
|
|
|
|
borderColor: 'rgba(186,139,175,1)',
|
|
|
|
|
pointBackgroundColor: 'rgba(186,139,175,1)',
|
|
|
|
|
pointHoverBackgroundColor: '#fff',
|
|
|
|
|
pointBorderColor: '#fff',
|
|
|
|
|
pointHoverBorderColor: 'rgba(186,139,175,1)',
|
|
|
|
|
data: ajaxify.data.analytics.hourly,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
'blacklist:daily': {
|
|
|
|
|
labels: dailyLabels,
|
|
|
|
|
datasets: [
|
|
|
|
|
{
|
|
|
|
|
label: '',
|
|
|
|
|
backgroundColor: 'rgba(151,187,205,0.2)',
|
|
|
|
|
borderColor: 'rgba(151,187,205,1)',
|
|
|
|
|
pointBackgroundColor: 'rgba(151,187,205,1)',
|
|
|
|
|
pointHoverBackgroundColor: '#fff',
|
|
|
|
|
pointBorderColor: '#fff',
|
|
|
|
|
pointHoverBorderColor: 'rgba(151,187,205,1)',
|
|
|
|
|
data: ajaxify.data.analytics.daily,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
hourlyCanvas.width = $(hourlyCanvas).parent().width();
|
|
|
|
|
dailyCanvas.width = $(dailyCanvas).parent().width();
|
|
|
|
|
|
|
|
|
|
new Chart(hourlyCanvas.getContext('2d'), {
|
|
|
|
|
type: 'line',
|
|
|
|
|
data: data['blacklist:hourly'],
|
|
|
|
|
options: {
|
|
|
|
|
responsive: true,
|
|
|
|
|
animation: false,
|
|
|
|
|
legend: {
|
|
|
|
|
display: false,
|
|
|
|
|
},
|
|
|
|
|
scales: {
|
|
|
|
|
yAxes: [{
|
|
|
|
|
ticks: {
|
|
|
|
|
beginAtZero: true,
|
|
|
|
|
},
|
|
|
|
|
}],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
new Chart(dailyCanvas.getContext('2d'), {
|
|
|
|
|
type: 'line',
|
|
|
|
|
data: data['blacklist:daily'],
|
|
|
|
|
options: {
|
|
|
|
|
responsive: true,
|
|
|
|
|
animation: false,
|
|
|
|
|
legend: {
|
|
|
|
|
display: false,
|
|
|
|
|
},
|
|
|
|
|
scales: {
|
|
|
|
|
yAxes: [{
|
|
|
|
|
ticks: {
|
|
|
|
|
beginAtZero: true,
|
|
|
|
|
},
|
|
|
|
|
}],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return Blacklist;
|
|
|
|
|