main.js 871 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. $(function() {
  2. setInterval(function() {
  3. $.getJSON('/monitor/api/status/memory',function(data) {
  4. console.log("Response: " + data);
  5. if(data.mem != undefined) {
  6. $('.mem-rss').html(data.mem.rss);
  7. $('.mem-heap').html(data.mem.heapUsed + " / " + data.mem.heapTotal);
  8. }
  9. });
  10. },2000);
  11. $.getJSON('/monitor/api/bundles',function(data) {
  12. $thead = $('table.bundle-list thead');
  13. $thead.html('');
  14. var add = '';
  15. add+= '<tr>';
  16. Object.keys(data[0]).forEach(function(v) {
  17. add+='<th>' + v + '</th>';
  18. });
  19. add +='</tr>'
  20. console.log("Adding: " + add);
  21. $thead.html(add);
  22. $tbody = $('table.bundle-list tbody');
  23. $tbody.html('');
  24. data.forEach(function(v) {
  25. add='<tr>'
  26. Object.keys(v).forEach(function(e) {
  27. add+='<td>&nbsp;' + v[e] + '</td>';
  28. });
  29. add+='</tr>';
  30. $tbody.append(add);
  31. });
  32. });
  33. });