[pve-devel] [PATCH manager] gui: zfs over iscsi: only allow inputs that are relevant

Dominik Csapak d.csapak at proxmox.com
Fri Aug 10 13:26:58 CEST 2018


some options are only relevant for some iscsi providers
so only allow thos who are relevant to the selected provider
and rename LIO target portal group to 'Target portal group'
since it is only active when lio is chosen

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/storage/ZFSEdit.js | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/www/manager6/storage/ZFSEdit.js b/www/manager6/storage/ZFSEdit.js
index 219a06cd..99fe8a66 100644
--- a/www/manager6/storage/ZFSEdit.js
+++ b/www/manager6/storage/ZFSEdit.js
@@ -5,7 +5,9 @@ Ext.define('PVE.storage.ZFSInputPanel', {
     viewModel: {
 	parent: null,
 	data: {
-	    isLIO: false
+	    isLIO: false,
+	    isComstar: true,
+	    hasWriteCacheOption: true
 	}
     },
 
@@ -19,6 +21,8 @@ Ext.define('PVE.storage.ZFSInputPanel', {
 	changeISCSIProvider: function(f, newVal, oldVal) {
 	    var vm = this.getViewModel();
 	    vm.set('isLIO', newVal === 'LIO');
+	    vm.set('isComstar', newVal === 'comstar');
+	    vm.set('hasWriteCacheOption', newVal === 'comstar' || newVal === 'istgt');
 	}
     },
 
@@ -77,6 +81,7 @@ Ext.define('PVE.storage.ZFSInputPanel', {
 		name: 'comstar_tg',
 		value: '',
 		fieldLabel: gettext('Target group'),
+		bind: me.isCreate ? { disabled: '{!isComstar}' } : { hidden: '{!isComstar}' },
 		allowBlank: true
 	    }
 	];
@@ -100,6 +105,7 @@ Ext.define('PVE.storage.ZFSInputPanel', {
 		xtype: 'proxmoxcheckbox',
 		name: 'writecache',
 		checked: true,
+		bind: me.isCreate ? { disabled: '{!hasWriteCacheOption}' } : { hidden: '{!hasWriteCacheOption}' },
 		uncheckedValue: 0,
 		fieldLabel: gettext('Write cache')
 	    },
@@ -107,6 +113,7 @@ Ext.define('PVE.storage.ZFSInputPanel', {
 		xtype: me.isCreate ? 'textfield' : 'displayfield',
 		name: 'comstar_hg',
 		value: '',
+		bind: me.isCreate ? { disabled: '{!isComstar}' } : { hidden: '{!isComstar}' },
 		fieldLabel: gettext('Host group'),
 		allowBlank: true
 	    },
@@ -116,7 +123,7 @@ Ext.define('PVE.storage.ZFSInputPanel', {
 		value: '',
 		bind: me.isCreate ? { disabled: '{!isLIO}' } : { hidden: '{!isLIO}' },
 		allowBlank: false,
-		fieldLabel: gettext('LIO target portal group')
+		fieldLabel: gettext('Target portal group')
 	    }
 	];
 
-- 
2.11.0





More information about the pve-devel mailing list