[pve-devel] [PATCH manager 4/4] add filter to dashboard storage graph

Dominik Csapak d.csapak at proxmox.com
Wed Dec 21 11:45:10 CET 2016


with this patch, the storage graph on the dashboard only counts the
storages which are selected in the settings window

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/dc/Summary.js | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/www/manager6/dc/Summary.js b/www/manager6/dc/Summary.js
index 7980c99..fb69ecc 100644
--- a/www/manager6/dc/Summary.js
+++ b/www/manager6/dc/Summary.js
@@ -88,6 +88,7 @@ Ext.define('PVE.dc.Summary', {
 	var cpustat = me.down('#cpu');
 	var memorystat = me.down('#memory');
 	var storagestat = me.down('#storage');
+	var sp = Ext.state.Manager.getProvider();
 
 	me.mon(PVE.data.ResourceStore, 'load', function(curstore, results) {
 	    me.suspendLayout = true;
@@ -103,6 +104,13 @@ Ext.define('PVE.dc.Summary', {
 	    var countedStorages = {};
 	    var used = 0;
 	    var total = 0;
+	    var usableStorages = {};
+	    var storages = sp.get('dash-storages') || '';
+	    storages.split(',').forEach(function(storage){
+		if (storage !== '') {
+		    usableStorages[storage] = true;
+		}
+	    });
 
 	    var qemu = {
 		running: 0,
@@ -142,6 +150,13 @@ Ext.define('PVE.dc.Summary', {
 			}
 			break;
 		    case 'storage':
+			if (!Ext.Object.isEmpty(usableStorages)) {
+			    if (usableStorages[item.data.id] === true) {
+				used += item.data.disk;
+				total += item.data.maxdisk;
+			    }
+			    break;
+			}
 			if (!countedStorages[item.data.storage] ||
 			    (item.data.storage === 'local' &&
 			    !countedStorages[item.data.id])) {
-- 
2.1.4





More information about the pve-devel mailing list