vtop
Advanced tools
Comparing version 0.3.3 to 0.4.0
21
app.js
@@ -131,3 +131,5 @@ /** | ||
'g': 'Jump to top', | ||
'G': 'Jump to bottom' | ||
'G': 'Jump to bottom', | ||
'c': 'Sort by CPU', | ||
'm': 'Sort by Mem' | ||
}; | ||
@@ -137,3 +139,3 @@ var text = ''; | ||
var command = commands[c]; | ||
text += ' {white-bg}{black-fg}' + c + '{/black-fg}{/white-bg} ' + command; | ||
text += ' {white-bg}{black-fg}' + c + '{/black-fg}{/white-bg} ' + command; | ||
} | ||
@@ -404,2 +406,17 @@ | ||
} | ||
if (key.name == 'c') { | ||
charts[2].plugin.sort = 'cpu'; | ||
charts[2].plugin.poll(); | ||
setTimeout(function() { | ||
processListSelection.select(0); | ||
}, 200); | ||
} | ||
if (key.name == 'm') { | ||
charts[2].plugin.sort = 'mem'; | ||
charts[2].plugin.poll(); | ||
setTimeout(function() { | ||
processListSelection.select(0); | ||
}, 200); | ||
} | ||
lastKey = key.name; | ||
@@ -406,0 +423,0 @@ |
# Changelog | ||
## 0.4.0 | ||
- Add sort by CPU and Memory | ||
## 0.3.3 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "vtop", | ||
"version": "0.3.3", | ||
"version": "0.4.0", | ||
"description": "Wow such top. So stats", | ||
@@ -5,0 +5,0 @@ "homepage": "http://parall.ax/vtop", |
@@ -31,2 +31,4 @@ /** | ||
sort: 'cpu', | ||
columns: ['Command', 'CPU %', 'Count', 'Memory %'], | ||
@@ -106,8 +108,10 @@ currentValue: [{ | ||
'Memory %': memRounded, | ||
'cpu': stats[stat].cpu // exact cpu for comparison | ||
'cpu': stats[stat].cpu, | ||
'mem': stats[stat].mem // exact cpu for comparison | ||
}); | ||
} | ||
statsArray.sort(function(a, b) { | ||
return b.cpu - a.cpu; | ||
return parseFloat(b[plugin.sort]) - parseFloat(a[plugin.sort]); | ||
}); | ||
plugin.currentValue = statsArray; | ||
@@ -114,0 +118,0 @@ }); |
1939991
914