[pve-devel] [PATCH manager v2 2/2] show ha error state in tree and resource grid

Dominik Csapak d.csapak at proxmox.com
Tue Oct 25 12:44:23 CEST 2016


with this patch, vms in an ha error state get an icon (reusing the node
offline icon) to indicate the error

in the resource grid, we also add the icon, and have an additional
column where we can display the ha state

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
changes since v1:
 * added the hastate to the tracked properties for a change,
   otherwise the icon in the tree does not get updated when
   the vm changes to the error state
 www/manager6/Utils.js              | 5 +++++
 www/manager6/data/ResourceStore.js | 7 +++++++
 www/manager6/tree/ResourceTree.js  | 8 +++++++-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 0932664..463a546 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -961,6 +961,11 @@ Ext.define('PVE.Utils', { utilities: {
 	    }
 	}
 
+	// overwrite anything else
+	if (record.data.hastate === 'error') {
+	    gridcls = '-offline';
+	}
+
 	var fa = '<i class="fa fa-fw x-fa-grid' + gridcls  +  ' fa-' + icon  + '"></i> ';
 	return fa + value;
     },
diff --git a/www/manager6/data/ResourceStore.js b/www/manager6/data/ResourceStore.js
index cc68b84..9147626 100644
--- a/www/manager6/data/ResourceStore.js
+++ b/www/manager6/data/ResourceStore.js
@@ -233,6 +233,13 @@ Ext.define('PVE.data.ResourceStore', {
 		hidden: true,
 		sortable: true,
 		width: 110
+	    },
+	    hastate: {
+		header: gettext('HA State'),
+		type: 'string',
+		defaultValue: '',
+		hidden: true,
+		sortable: true
 	    }
 	};
 
diff --git a/www/manager6/tree/ResourceTree.js b/www/manager6/tree/ResourceTree.js
index ac487c6..5cca7ce 100644
--- a/www/manager6/tree/ResourceTree.js
+++ b/www/manager6/tree/ResourceTree.js
@@ -124,6 +124,11 @@ Ext.define('PVE.tree.ResourceTree', {
 		iconClsAdd = '-offline';
 	    }
 
+	    // overwrite any other class
+	    if (info.hastate === 'error') {
+		iconClsAdd = '-offline';
+	    }
+
 	    info.iconCls = defaults.iconCls + iconClsAdd;
 
 	    if (info.template) {
@@ -288,7 +293,8 @@ Ext.define('PVE.tree.ResourceTree', {
 			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.status !== olditem.data.status) ||
+			    (item.data.hastate!== olditem.data.hastate)) {
 			    //console.log("changed node/text/running " + olditem.data.id);
 			    changed = true;
 			}
-- 
2.1.4





More information about the pve-devel mailing list