[PATCH manager 04/18] ui: form/CRSOptions: use view model for auto rebalancing option

Daniel Kral
2026-04-09T11:42:12Z

This is in preparation to further constrain when auto rebalancing can be
enabled in a following patch.

Signed-off-by: Daniel Kral <d.kral@proxmox.com>
---
www/manager6/form/CRSOptions.js | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/www/manager6/form/CRSOptions.js b/www/manager6/form/CRSOptions.js
index 0d23ad39..3f3b4fea 100644
--- a/www/manager6/form/CRSOptions.js
+++ b/www/manager6/form/CRSOptions.js
@@ -17,7 +17,14 @@ Ext.define('PVE.form.CRSOptions', {
});
},

- viewModel: {},
+ viewModel: {
+ data: {
+ autoRebalancing: 0,
+ },
+ formulas: {
+ autoRebalancingDisabled: (get) => !get('autoRebalancing'),
+ },
+ },

items: [
{
@@ -58,8 +65,9 @@ Ext.define('PVE.form.CRSOptions', {
name: 'ha-auto-rebalance',
fieldLabel: gettext('Automatic Rebalance'),
boxLabel: gettext('Automatically rebalance HA resources'),
- value: 0,
- reference: 'enableAutoRebalance',
+ bind: {
+ value: '{autoRebalancing}',
+ },
},
{
xtype: 'numberfield',
@@ -69,7 +77,7 @@ Ext.define('PVE.form.CRSOptions', {
minValue: 0.0,
step: 0.01,
bind: {
- disabled: '{!enableAutoRebalance.checked}',
+ disabled: '{autoRebalancingDisabled}',
},
},
{
@@ -85,7 +93,7 @@ Ext.define('PVE.form.CRSOptions', {
],
defaultValue: '__default__',
bind: {
- disabled: '{!enableAutoRebalance.checked}',
+ disabled: '{autoRebalancingDisabled}',
},
},
{
@@ -96,7 +104,7 @@ Ext.define('PVE.form.CRSOptions', {
minValue: 0,
step: 1,
bind: {
- disabled: '{!enableAutoRebalance.checked}',
+ disabled: '{autoRebalancingDisabled}',
},
},
{
@@ -108,7 +116,7 @@ Ext.define('PVE.form.CRSOptions', {
maxValue: 1.0,
step: 0.01,
bind: {
- disabled: '{!enableAutoRebalance.checked}',
+ disabled: '{autoRebalancingDisabled}',
},
},
],
--
2.47.3