[pve-devel] [PATCH manager 2/4] gui: add lock to resource store and tree
Thomas Lamprecht
t.lamprecht at proxmox.com
Tue Jun 11 06:02:24 CEST 2019
From: Dominik Csapak <d.csapak at proxmox.com>
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 19f0b039..cee086a8 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -783,6 +783,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 74ad41b3..360e7e73 100644
--- a/www/manager6/tree/ResourceTree.js
+++ b/www/manager6/tree/ResourceTree.js
@@ -296,13 +296,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.20.1
More information about the pve-devel
mailing list