[pve-devel] [PATCH] add mem free row
Stefan Priebe
s.priebe at profihost.ag
Wed Apr 24 11:30:33 CEST 2013
Signed-off-by: Stefan Priebe <s.priebe at profihost.ag>
---
www/manager/Utils.js | 19 ++++++++++++++++++-
www/manager/data/ResourceStore.js | 8 ++++++++
2 files changed, 26 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 bb5228f..bcca4a4 100644
--- a/www/manager/data/ResourceStore.js
+++ b/www/manager/data/ResourceStore.js
@@ -105,6 +105,14 @@ Ext.define('PVE.data.ResourceStore', {
align: 'right',
},
mem: {
+ header: 'Mem Free',
+ type: 'integer',
+ renderer: PVE.Utils.render_memfree,
+ sortable: true,
+ width: 100,
+ align: 'right',
+ },
+ memused: {
header: gettext('Memory usage'),
type: 'integer',
renderer: PVE.Utils.render_memused,
--
1.7.10.4
More information about the pve-devel
mailing list