|
|
|
@ -1,4 +1,3 @@
|
|
|
|
|
|
|
|
|
|
type = ['','info','success','warning','danger'];
|
|
|
|
|
|
|
|
|
|
dashboard = {
|
|
|
|
@ -22,31 +21,7 @@ dashboard = {
|
|
|
|
|
getData.done(function(results) {
|
|
|
|
|
var data = JSON.parse(results)
|
|
|
|
|
var app = data['Chrome'];
|
|
|
|
|
|
|
|
|
|
function getCpuUsage (app){
|
|
|
|
|
cpu_usage = []
|
|
|
|
|
for (var i in app){
|
|
|
|
|
cpu_usage.push(app[i].cpu_usage)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return cpu_usage
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getMemoryUsage (app){
|
|
|
|
|
memory_usage = []
|
|
|
|
|
for (var i in app){
|
|
|
|
|
memory_usage.push(app[i].memory_usage)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return memory_usage
|
|
|
|
|
}
|
|
|
|
|
function getStatus (app){
|
|
|
|
|
statusList = []
|
|
|
|
|
for (var i in app){
|
|
|
|
|
statusList.push(app[i].status)
|
|
|
|
|
}
|
|
|
|
|
return statusList
|
|
|
|
|
}
|
|
|
|
|
console.log('data...',data)
|
|
|
|
|
|
|
|
|
|
// monitoring apps chart
|
|
|
|
|
var dataChart = {
|
|
|
|
@ -110,64 +85,18 @@ dashboard = {
|
|
|
|
|
|
|
|
|
|
Chartist.Line('#chartActivity', data, options, responsiveOptions);
|
|
|
|
|
|
|
|
|
|
status = getStatus(app)
|
|
|
|
|
statusList = status.split(',');
|
|
|
|
|
|
|
|
|
|
statusByNum = getStatusByType(statusList)
|
|
|
|
|
|
|
|
|
|
function getStatusByType(statusList){
|
|
|
|
|
running = 0;
|
|
|
|
|
idle = 0;
|
|
|
|
|
crash = 0;
|
|
|
|
|
|
|
|
|
|
for (var n in statusList){
|
|
|
|
|
if (statusList[n] == 'running'){
|
|
|
|
|
running += 1;
|
|
|
|
|
};
|
|
|
|
|
if (statusList[n] == 'idle'){
|
|
|
|
|
idle += 1;
|
|
|
|
|
};
|
|
|
|
|
if (statusList[n] == 'crash'){
|
|
|
|
|
crash += 1;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
statusList = [running, idle, crash];
|
|
|
|
|
return statusList
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
percentage = getStatusPercent(statusByNum);
|
|
|
|
|
|
|
|
|
|
function getStatusPercent(statusByNum){
|
|
|
|
|
let total = 0
|
|
|
|
|
for (var i in statusByNum){
|
|
|
|
|
total += statusByNum[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
percent = []
|
|
|
|
|
for (var i in statusByNum){
|
|
|
|
|
percent.push(total / statusByNum[i])
|
|
|
|
|
}
|
|
|
|
|
total = 100
|
|
|
|
|
let percentage = []
|
|
|
|
|
for (var i in percent){
|
|
|
|
|
percentage.push(total/percent[i])
|
|
|
|
|
}
|
|
|
|
|
for (var i in percentage){
|
|
|
|
|
if (percentage[i] == 0){
|
|
|
|
|
percentage.pop(percentage[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return percentage
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i in percentage){
|
|
|
|
|
percentage[i] = percentage[i].toString()+'%';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Chartist.Pie('#chartPreferences', {
|
|
|
|
|
labels: [1,1,1],
|
|
|
|
|
series: [1,2,3]
|
|
|
|
|
});
|
|
|
|
|
var getStatus = $.get('1/get/summary/app_status');
|
|
|
|
|
getStatus.done(function(results) {
|
|
|
|
|
var data = JSON.parse(results)
|
|
|
|
|
let getStatusList = []
|
|
|
|
|
getStatusList.push(data.idle)
|
|
|
|
|
getStatusList.push(data.crash)
|
|
|
|
|
getStatusList.push(data.running)
|
|
|
|
|
Chartist.Pie('#chartPreferences', {
|
|
|
|
|
labels: getStatusList,
|
|
|
|
|
series: getStatusList
|
|
|
|
|
});
|
|
|
|
|
}) /// end getStatus
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// End chartist function
|
|
|
|
@ -230,8 +159,6 @@ g.summary.factory = function (url,pointer) {
|
|
|
|
|
object.callback = function (r) {
|
|
|
|
|
r = JSON.parse(r.responseText)
|
|
|
|
|
pointer(r)
|
|
|
|
|
console.log(r)
|
|
|
|
|
//monitorStatus(r.idle, r.crash, r.running)
|
|
|
|
|
|
|
|
|
|
//observer.notify()
|
|
|
|
|
|
|
|
|
|