status handling backend and front-end refactoring

master
Steve L. Nyemba 8 years ago
parent 447b0c07df
commit b0b54c81ed

@ -31,16 +31,18 @@ monitor.processes.init = function(x){
monitor.processes.render = function(label,data) {
var status = {"idle":'<i class="fa fa-ellipsis-h" title="IDLE"></i>',"running":'<i class="fa fa-check" title="RUNNING"></i>',"crash":'<i class="fa fa-times" title="CRASHED"></i>'}
data = jx.utils.patterns.visitor(data,function(row){
var m = row.memory_usage >0
var c = row.cpu_usage > 0
var r = row.memory_available > 0
if ( r && c && m) {
row.status = status['running']
}else if (r && (!m || !c) ){
row.status = status['idle']
}else if (!r){
row.status = status['crash']
}
console.log(row)
row.status = status[row.status]
// var m = row.memory_usage >0
// var c = row.cpu_usage > 0
// var r = row.memory_available > 0
// if ( r && c && m) {
// row.status = status['running']
// }else if (r && (!m || !c) ){
// row.status = status['idle']
// }else if (!r){
// row.status = status['crash']
// }
return row
})

@ -154,8 +154,21 @@ class DetailProcess(Analysis):
row = [float(value) for value in row if value.strip() != '' and name not in value ] +[re.sub('\$|^','',name)]
r.append(row)
return r
def status(self,row):
x = row['memory_usage']
y = row['cpu_usage']
z = row['memory_available']
if z :
if y :
return "running"
return "idle"
else:
return "crash"
def format(self,row):
return {"memory_usage":row[0],"cpu_usage":row[1],"memory_available":row[2]/1000,"label":row[3]}
r= {"memory_usage":row[0],"cpu_usage":row[1],"memory_available":row[2]/1000,"label":row[3]}
status = self.status(r)
r['status'] = status
return r
def composite(self):
#value = self.evaluate(self.name)
#row= {"memory_usage":value[0],"cpu_usage":value[1]}

Loading…
Cancel
Save