[pve-devel] [PATCH 9/9] add mem free row
Stefan Priebe
s.priebe at profihost.ag
Wed Apr 24 11:53:07 CEST 2013
Signed-off-by: Stefan Priebe <s.priebe at profihost.ag>
---
www/manager/Utils.js | 19 ++++++++++++++++++-
www/manager/data/ResourceStore.js | 9 +++++++++
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/www/manager/Utils.js b/www/manager/Utils.js
index 4e02a54..fcd54ff 100644
--- a/www/manager/Utils.js
+++ b/www/manager/Utils.js
@@ -741,7 +741,7 @@ Ext.define('PVE.Utils', { statics: {
},
convert_mem_to_memused: function(value, record) {
- var mem = value;
+ var mem = record.data.mem;
var maxmem = record.data.maxmem;
if (!record.data.uptime) {
@@ -774,6 +774,23 @@ Ext.define('PVE.Utils', { statics: {
},
+ render_memfree: function(value, metaData, record, rowIndex, colIndex, store) {
+ var memfree = value;
+ var maxmem = record.data.maxmem;
+
+ if (!record.data.uptime) {
+ return '';
+ }
+
+ if (!(Ext.isNumeric(memfree) && maxmem)) {
+ return '';
+ }
+
+ var per = (memfree * 100) / maxmem;
+ return PVE.Utils.format_size(memfree) + ' (' + per.toFixed(1) + '%)';
+
+ },
+
render_mem_usage: function(value, metaData, record, rowIndex, colIndex, store) {
var mem = value;
diff --git a/www/manager/data/ResourceStore.js b/www/manager/data/ResourceStore.js
index ca73a3b..d792894 100644
--- a/www/manager/data/ResourceStore.js
+++ b/www/manager/data/ResourceStore.js
@@ -104,6 +104,15 @@ Ext.define('PVE.data.ResourceStore', {
width: 100,
align: 'right',
},
+ memfree: {
+ header: 'Mem Free',
+ type: 'integer',
+ renderer: PVE.Utils.render_memfree,
+ convert: PVE.Utils.convert_mem_to_memused,
+ sortable: true,
+ width: 100,
+ align: 'right',
+ },
mem: {
header: gettext('Memory usage'),
type: 'integer',
--
1.7.10.4
More information about the pve-devel
mailing list