Merge branch 'graphs' of steve/monitor into community

community
Steve L. Nyemba 7 years ago committed by Gogs
commit c94cd8cef4

@ -69,7 +69,6 @@ def get_nodes():
""" """
This function returns the labels of applications for every node registered This function returns the labels of applications for every node registered
@param None @param None
e.g: apps@zulu.org
""" """
r = [] r = []
try: try:
@ -83,7 +82,7 @@ def get_nodes():
def get_apps(): def get_apps():
""" """
This function returns the applications for a given node This function returns the applications for a given node
@param node identifier e.g: apps@zulu.org @param node identifier e.g: apps@zulu.org <--------------------no it doesnt
""" """
r = [] r = []
try: try:

@ -20,19 +20,31 @@ dashboard = {
getData.done(function(results) { getData.done(function(results) {
var data = JSON.parse(results) var data = JSON.parse(results)
var app = data['Chrome']; var node = data['apps@michaels-MBP'];
var app = node['chrome'];
var cpu = app['cpu'];
var memory_used = app['memory_used'];
console.log('data...',data) console.log('data...',data)
console.log('node...',node)
console.log('app...',app)
console.log('cpu...',cpu)
console.log('memory_used...', memory_used)
// monitoring apps chart // monitoring apps chart
var dataChart = { var dataChart = {
labels: ['9:00AM', '12:00AM', '3:00PM', '6:00PM', '9:00PM', '12:00PM', '3:00AM', '6:00AM'], 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: [app.memory_used, app.cpu, ] // TODO: Check the order, the graph is by index not name. series: [cpu, memory_used, [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)
var optionsChart = { var optionsChart = {
lineSmooth: false, lineSmooth: false,
low: 0, low: 0,
high: 100, high: maxNum + 1,
showArea: true, showArea: true,
height: "245px", height: "245px",
axisX: { axisX: {
@ -60,7 +72,7 @@ dashboard = {
// cpu and memory -------------------------- // cpu and memory --------------------------
var data = { var data = {
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], labels: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
series: [app.cpu, app.memory_used] series: [cpu, memory_used]
}; };

@ -79,7 +79,7 @@
] ]
jx.utils.patterns.observer(lobservers,"init") jx.utils.patterns.observer(lobservers,"init")
//dashboard.initChartist(); dashboard.initChartist();
}); });
</script> </script>
@ -156,7 +156,16 @@
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
{% for name in app_names %} {% for name in app_names %}
<div class="action"><i class="fa fa-angle-right"></i> {{name|safe}}</div> <div class="action" data-name="{{name}}" id="app_names"><i class="fa fa-angle-right"></i><a href='#'>{{name|safe}}</a>
<script type="text/javascript">onclick=function(){
console.log('name...', "{{ name }}") //this works, but returns same variable......
var appName = $('#app_names').data("name");
console.log('name...', appName )
}</script>
</div>
{% endfor %} {% endfor %}
</ul> </ul>
@ -301,10 +310,9 @@
<div class="footer"> <div class="footer">
<div class="chart-legend"> <div class="chart-legend">
<!-- confirm these three are right with new API. -->
<i class="fa fa-circle text-info"></i> cpu usage <i class="fa fa-circle text-info"></i> cpu usage
<i class="fa fa-circle text-danger"></i> memory usage <i class="fa fa-circle text-warning"></i> memory used
<i class="fa fa-circle text-warning"></i> memory available <i class="fa fa-circle text-danger"></i> available line
</div> </div>
<hr> <hr>
<div class="stats"> <div class="stats">

Loading…
Cancel
Save