[pve-devel] [PATCH manager 2/4] Close #1161: add hint when disabling a ha resource

Emmanuel Kasper e.kasper at proxmox.com
Wed Oct 19 14:17:43 CEST 2016


Disabling a HA resource/service means that this
ressource will always be turned off.
However some users though this disabling HA management
for this VM, see
http://pve.proxmox.com/pipermail/pve-user/2016-October/011024.html

so we had a hint after clicking on the 'disable' checkbox, that
the checkbox is meant for shutdown
---
 www/manager6/ha/ResourceEdit.js | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/www/manager6/ha/ResourceEdit.js b/www/manager6/ha/ResourceEdit.js
index a650677..46857dc 100644
--- a/www/manager6/ha/ResourceEdit.js
+++ b/www/manager6/ha/ResourceEdit.js
@@ -1,7 +1,6 @@
 Ext.define('PVE.ha.VMResourceInputPanel', {
     extend: 'PVE.panel.InputPanel',
 
-
     vmid: undefined,
     
     onGetValues: function(values) {
@@ -33,6 +32,14 @@ Ext.define('PVE.ha.VMResourceInputPanel', {
     initComponent : function() {
 	var me = this;
 
+	var disabledHint = Ext.createWidget({
+	    xtype: 'displayfield', //submitValue is false, so we don't get submitted
+	    userCls: 'pve-hint',
+	    value: gettext('Disabling the resource will stop the guest system. ' +
+	    'See the online help for details.'),
+	    hidden: true
+	});
+
 	me.column1 = [
 	    {
 		xtype: me.vmid ? 'displayfield' : 'pveVMIDSelector',
@@ -56,8 +63,21 @@ Ext.define('PVE.ha.VMResourceInputPanel', {
 		name: 'enable',
 		checked: true,
 		uncheckedValue: 0,
-		fieldLabel: gettext('enable')
-	    }
+		fieldLabel: gettext('enable'),
+		listeners: {
+		    'change': function(field, newValue) {
+			if (newValue === false) {
+			    disabledHint.setVisible(true);
+			}
+			else {
+			    if (disabledHint.isVisible()) {
+				disabledHint.setVisible(false);
+			    }
+			}
+		    }
+		}
+	    },
+	    disabledHint
 	];
 
 	me.columnB = [
-- 
2.1.4





More information about the pve-devel mailing list