[pve-devel] [PATCH manager 1/4] ui: ceph installer: make replicas & minreplicas fields dependent

Tim Marx t.marx at proxmox.com
Thu Mar 28 12:16:03 CET 2019


Signed-off-by: Tim Marx <t.marx at proxmox.com>
---
 www/manager6/ceph/CephInstallWizard.js | 32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/www/manager6/ceph/CephInstallWizard.js b/www/manager6/ceph/CephInstallWizard.js
index 71192173..7fc36497 100644
--- a/www/manager6/ceph/CephInstallWizard.js
+++ b/www/manager6/ceph/CephInstallWizard.js
@@ -124,6 +124,12 @@ Ext.define('PVE.ceph.CephInstallWizard', {
 		cbind: {
 		    nodename: '{nodename}'
 		},
+		viewModel: {
+		    data: {
+			replicas: undefined,
+			minreplicas: undefined
+		    }
+		},
 		listeners: {
 		    activate: function() {
 			this.up('pveCephInstallWizard').down('#submit').setText(gettext('Next'));
@@ -164,21 +170,33 @@ Ext.define('PVE.ceph.CephInstallWizard', {
 			xtype: 'numberfield',
 			name: 'size',
 			fieldLabel: 'Number of replicas',
-			value: '',
+			bind: {
+			    value: '{replicas}',
+			    allowBlank : '{!minreplicas}'
+			},
 			maxValue: 7,
 			minValue: 1,
-			allowBlank: true,
-			emptyText: '3'
+			emptyText: '3',
+			setAllowBlank: function(allowBlank) {
+			    this.allowBlank = allowBlank;
+			    this.validate();
+			}
 		    },
 		    {
 			xtype: 'numberfield',
 			name: 'min_size',
 			fieldLabel: 'Minimum replicas',
-			value: '',
-			maxValue: 7,
+			bind: {
+			    maxValue: '{replicas}',
+			    value: '{minreplicas}',
+			    allowBlank: '{!replicas}'
+			},
 			minValue: 1,
-			allowBlank: true,
-			emptyText: '2'
+			emptyText: '2',
+			setAllowBlank: function(allowBlank) {
+			    this.allowBlank = allowBlank;
+			    this.validate();
+			}
 		    },
 		    {
 			xtype: 'numberfield',
-- 
2.11.0



More information about the pve-devel mailing list