community
michael.mead 7 years ago
parent 8a937a61f8
commit 21a84c029b

@ -18,18 +18,25 @@ dashboard = {
initChartist: function(){
var getData = $.get('/1/app/usage/trend');
getData.done(function(results) {
var data = JSON.parse(results)
console.log('data...',data)
var data = JSON.parse(results);
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
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' ],
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
var maxlist = dataChartArray.map(dataChartArray => Math.max.apply(null, dataChartArray));
maxNum = Math.max.apply(null, maxlist)
dataChartArray = dataChart.series;
var maxlist = dataChartArray.map(function (dataChartArray) {
return Math.max.apply(null, dataChartArray);
});
maxNum = Math.max.apply(null, maxlist);
var optionsChart = {
lineSmooth: false,
@ -38,13 +45,13 @@ dashboard = {
showArea: true,
height: "245px",
axisX: {
showGrid: false,
showGrid: false
},
lineSmooth: Chartist.Interpolation.simple({
divisor: 1
}),
showLine: true,
showPoint: false,
showPoint: false
};
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
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 marker = new google.maps.Marker({
@ -138,10 +145,10 @@ dashboard = {
align: align
}
});
},
}
};
/**
* Global information about the dashboard
@ -154,29 +161,29 @@ g.summary = {}
* Initializing the top section of the dashboard (apps and folders)
*/
g.summary.factory = function (url,pointer) {
var object = {}
object.url = url
var observer = null
var object = {};
object.url = url;
var observer = null;
var TIME_ELLAPSED = 2000 ;
object.callback = function (r) {
r = JSON.parse(r.responseText)
r = JSON.parse(r.responseText);
pointer(r)
//observer.notify()
}
};
object.init = function (observer) {
observer = observer
var httpclient = HttpClient.instance()
var httpclient = HttpClient.instance();
//httpclient.setAsync(false)
httpclient.get(this.url, this.callback)
httpclient.get(this.url, this.callback);
setTimeout(function(){
observer.notify()
},TIME_ELLAPSED) ;
//observer.notify()
}
};
return object
}
};

@ -50,7 +50,7 @@
{# <script src="{{context}}/static/js/jx/rpc.js"></script>#}
{# <script src="{{context}}/static/js/jx/utils.js"></script>#}
<script type="text/javascript">
var URI_CONTEXT="{{context}}"
var URI_CONTEXT="{{context}}";
$(document).ready(function(){
{#var lobservers = [#}
@ -191,7 +191,7 @@
</div>
<div class="col-xs-7">
<div class="numbers">
<div id="total_cpu" align="center">00</div>
<div id="total_cpu" align="center"></div>
<div class="small" align="right">Percent</div>
</div>

@ -13,6 +13,8 @@ from datetime import datetime
from utils.transport import *
import monitor
import requests
class Manager() :
def version(self):
return 1.1

Loading…
Cancel
Save