[pve-devel] [PATCH manager 2/4] add lock to resource store and tree

Dominik Csapak d.csapak at proxmox.com
Wed Feb 27 12:32:34 CET 2019


add the lock to the css classes and to the columns, also check
the lock field for changed items

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/Utils.js              |  4 ++++
 www/manager6/data/ResourceStore.js |  7 +++++++
 www/manager6/tree/ResourceTree.js  | 19 ++++++++++++-------
 3 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 481b5186..4f8c4aef 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -719,6 +719,10 @@ Ext.define('PVE.Utils', { utilities: {
 	    status = record.status + ' ha-' + record.hastate;
 	}
 
+	if (record.lock) {
+	    status += ' locked lock-' + record.lock;
+	}
+
 	var defaults = PVE.tree.ResourceTree.typeDefaults[objType];
 	if (defaults && defaults.iconCls) {
 	    var retVal = defaults.iconCls + ' ' + status;
diff --git a/www/manager6/data/ResourceStore.js b/www/manager6/data/ResourceStore.js
index 5b8690e5..233d8ce1 100644
--- a/www/manager6/data/ResourceStore.js
+++ b/www/manager6/data/ResourceStore.js
@@ -257,6 +257,13 @@ Ext.define('PVE.data.ResourceStore', {
 		hidden: true,
 		sortable: true,
 		width: 110
+	    },
+	    lock: {
+		header: gettext('Lock'),
+		type: 'string',
+		hidden: true,
+		sortable: true,
+		width: 110
 	    }
 	};
 
diff --git a/www/manager6/tree/ResourceTree.js b/www/manager6/tree/ResourceTree.js
index 28135d0e..e928c4bb 100644
--- a/www/manager6/tree/ResourceTree.js
+++ b/www/manager6/tree/ResourceTree.js
@@ -282,13 +282,18 @@ Ext.define('PVE.tree.ResourceTree', {
 			}
 
 			// tree item has been updated
-			if ((item.data.text !== olditem.data.text) ||
-			    (item.data.running !== olditem.data.running) ||
-			    (item.data.template !== olditem.data.template) ||
-			    (item.data.status !== olditem.data.status) ||
-			    (item.data.hastate!== olditem.data.hastate)) {
-			    //console.log("changed node/text/running " + olditem.data.id);
-			    changed = true;
+			var fields = [
+			    'text', 'running', 'template', 'status',
+			    'qmpstatus', 'hastate', 'lock'
+			];
+
+			var field;
+			for (i = 0; i < fields.length; i++) {
+			    field = fields[i];
+			    if (item.data[field] !== olditem.data[field]) {
+				changed = true;
+				break;
+			    }
 			}
 
 			// fixme: also test filterfn()?
-- 
2.11.0





More information about the pve-devel mailing list