|
|
@ -18,18 +18,25 @@ dashboard = {
|
|
|
|
initChartist: function(){
|
|
|
|
initChartist: function(){
|
|
|
|
var getData = $.get('/1/app/usage/trend');
|
|
|
|
var getData = $.get('/1/app/usage/trend');
|
|
|
|
getData.done(function(results) {
|
|
|
|
getData.done(function(results) {
|
|
|
|
var data = JSON.parse(results)
|
|
|
|
var data = JSON.parse(results);
|
|
|
|
console.log('data...',data)
|
|
|
|
console.log('data...',data);
|
|
|
|
|
|
|
|
if ($.isEmptyObject(data)){
|
|
|
|
|
|
|
|
console.log('data is empty, setting testing values.');
|
|
|
|
|
|
|
|
data = [[1,2,3,4,5], [2,5,7,9], [1,3,4,6,8,9]]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log('data', data);
|
|
|
|
// monitoring apps chart
|
|
|
|
// monitoring apps chart
|
|
|
|
var dataChart = {
|
|
|
|
var dataChart = {
|
|
|
|
labels: ['24','23','22','21','20','19','18','17','16','15','14','13','12','11','10','9','8','7','6','5','4','3','2','1' ],
|
|
|
|
labels: ['24','23','22','21','20','19','18','17','16','15','14','13','12','11','10','9','8','7','6','5','4','3','2','1' ],
|
|
|
|
series: [[1,2,3], [4,5,6], [1,2,3,5], ] // TODO: Check the order, the graph is by index not name.
|
|
|
|
series: data //[[1,2,3], [4,5,6], [1,2,3,5] ] // TODO: Check the order, the graph is by index not name.
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
dataChartArray = dataChart.series
|
|
|
|
dataChartArray = dataChart.series;
|
|
|
|
var maxlist = dataChartArray.map(dataChartArray => Math.max.apply(null, dataChartArray));
|
|
|
|
var maxlist = dataChartArray.map(function (dataChartArray) {
|
|
|
|
maxNum = Math.max.apply(null, maxlist)
|
|
|
|
return Math.max.apply(null, dataChartArray);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
maxNum = Math.max.apply(null, maxlist);
|
|
|
|
|
|
|
|
|
|
|
|
var optionsChart = {
|
|
|
|
var optionsChart = {
|
|
|
|
lineSmooth: false,
|
|
|
|
lineSmooth: false,
|
|
|
@ -38,13 +45,13 @@ dashboard = {
|
|
|
|
showArea: true,
|
|
|
|
showArea: true,
|
|
|
|
height: "245px",
|
|
|
|
height: "245px",
|
|
|
|
axisX: {
|
|
|
|
axisX: {
|
|
|
|
showGrid: false,
|
|
|
|
showGrid: false
|
|
|
|
},
|
|
|
|
},
|
|
|
|
lineSmooth: Chartist.Interpolation.simple({
|
|
|
|
lineSmooth: Chartist.Interpolation.simple({
|
|
|
|
divisor: 1
|
|
|
|
divisor: 1
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
showLine: true,
|
|
|
|
showLine: true,
|
|
|
|
showPoint: false,
|
|
|
|
showPoint: false
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var responsiveChart = [
|
|
|
|
var responsiveChart = [
|
|
|
@ -111,7 +118,7 @@ dashboard = {
|
|
|
|
scrollwheel: false, //we disable de scroll over the map, it is a really annoing when you scroll through page
|
|
|
|
scrollwheel: false, //we disable de scroll over the map, it is a really annoing when you scroll through page
|
|
|
|
styles: [{"featureType":"water","stylers":[{"saturation":43},{"lightness":-11},{"hue":"#0088ff"}]},{"featureType":"road","elementType":"geometry.fill","stylers":[{"hue":"#ff0000"},{"saturation":-100},{"lightness":99}]},{"featureType":"road","elementType":"geometry.stroke","stylers":[{"color":"#808080"},{"lightness":54}]},{"featureType":"landscape.man_made","elementType":"geometry.fill","stylers":[{"color":"#ece2d9"}]},{"featureType":"poi.park","elementType":"geometry.fill","stylers":[{"color":"#ccdca1"}]},{"featureType":"road","elementType":"labels.text.fill","stylers":[{"color":"#767676"}]},{"featureType":"road","elementType":"labels.text.stroke","stylers":[{"color":"#ffffff"}]},{"featureType":"poi","stylers":[{"visibility":"off"}]},{"featureType":"landscape.natural","elementType":"geometry.fill","stylers":[{"visibility":"on"},{"color":"#b8cb93"}]},{"featureType":"poi.park","stylers":[{"visibility":"on"}]},{"featureType":"poi.sports_complex","stylers":[{"visibility":"on"}]},{"featureType":"poi.medical","stylers":[{"visibility":"on"}]},{"featureType":"poi.business","stylers":[{"visibility":"simplified"}]}]
|
|
|
|
styles: [{"featureType":"water","stylers":[{"saturation":43},{"lightness":-11},{"hue":"#0088ff"}]},{"featureType":"road","elementType":"geometry.fill","stylers":[{"hue":"#ff0000"},{"saturation":-100},{"lightness":99}]},{"featureType":"road","elementType":"geometry.stroke","stylers":[{"color":"#808080"},{"lightness":54}]},{"featureType":"landscape.man_made","elementType":"geometry.fill","stylers":[{"color":"#ece2d9"}]},{"featureType":"poi.park","elementType":"geometry.fill","stylers":[{"color":"#ccdca1"}]},{"featureType":"road","elementType":"labels.text.fill","stylers":[{"color":"#767676"}]},{"featureType":"road","elementType":"labels.text.stroke","stylers":[{"color":"#ffffff"}]},{"featureType":"poi","stylers":[{"visibility":"off"}]},{"featureType":"landscape.natural","elementType":"geometry.fill","stylers":[{"visibility":"on"},{"color":"#b8cb93"}]},{"featureType":"poi.park","stylers":[{"visibility":"on"}]},{"featureType":"poi.sports_complex","stylers":[{"visibility":"on"}]},{"featureType":"poi.medical","stylers":[{"visibility":"on"}]},{"featureType":"poi.business","stylers":[{"visibility":"simplified"}]}]
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
|
|
|
|
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
|
|
|
|
|
|
|
|
|
|
|
|
var marker = new google.maps.Marker({
|
|
|
|
var marker = new google.maps.Marker({
|
|
|
@ -138,10 +145,10 @@ dashboard = {
|
|
|
|
align: align
|
|
|
|
align: align
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Global information about the dashboard
|
|
|
|
* Global information about the dashboard
|
|
|
@ -154,29 +161,29 @@ g.summary = {}
|
|
|
|
* Initializing the top section of the dashboard (apps and folders)
|
|
|
|
* Initializing the top section of the dashboard (apps and folders)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
g.summary.factory = function (url,pointer) {
|
|
|
|
g.summary.factory = function (url,pointer) {
|
|
|
|
var object = {}
|
|
|
|
var object = {};
|
|
|
|
object.url = url
|
|
|
|
object.url = url;
|
|
|
|
var observer = null
|
|
|
|
var observer = null;
|
|
|
|
var TIME_ELLAPSED = 2000 ;
|
|
|
|
var TIME_ELLAPSED = 2000 ;
|
|
|
|
object.callback = function (r) {
|
|
|
|
object.callback = function (r) {
|
|
|
|
r = JSON.parse(r.responseText)
|
|
|
|
r = JSON.parse(r.responseText);
|
|
|
|
pointer(r)
|
|
|
|
pointer(r)
|
|
|
|
|
|
|
|
|
|
|
|
//observer.notify()
|
|
|
|
//observer.notify()
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
object.init = function (observer) {
|
|
|
|
object.init = function (observer) {
|
|
|
|
observer = observer
|
|
|
|
observer = observer
|
|
|
|
|
|
|
|
|
|
|
|
var httpclient = HttpClient.instance()
|
|
|
|
var httpclient = HttpClient.instance();
|
|
|
|
//httpclient.setAsync(false)
|
|
|
|
//httpclient.setAsync(false)
|
|
|
|
httpclient.get(this.url, this.callback)
|
|
|
|
httpclient.get(this.url, this.callback);
|
|
|
|
setTimeout(function(){
|
|
|
|
setTimeout(function(){
|
|
|
|
observer.notify()
|
|
|
|
observer.notify()
|
|
|
|
},TIME_ELLAPSED) ;
|
|
|
|
},TIME_ELLAPSED) ;
|
|
|
|
|
|
|
|
|
|
|
|
//observer.notify()
|
|
|
|
//observer.notify()
|
|
|
|
}
|
|
|
|
};
|
|
|
|
return object
|
|
|
|
return object
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|