[PATCH manager v4 28/28] ui: form: add crs auto rebalancing options

Daniel Kral
2026-04-02T12:50:41Z

ha-auto-rebalance-{method,margin,hold-duration,margin} require
ha-auto-rebalance to be enabled in the schema, therefore they are
disabled here unless ha-auto-rebalance is enabled.

The label width was enlared a bit, so that the longer labels for the
auto rebalancing options are more readable.

Signed-off-by: Daniel Kral <d.kral@proxmox.com>
---
changes v3 -> v4:
- new!
- only changes from v1 are that a separate component is used now, it
uses a viewModel to disable fields that shouldn't be set, and widen
the label width a bit;
- also 'Margin' is 'Minimum Imbalance Improvement' in the UI

www/manager6/form/CRSOptions.js | 62 ++++++++++++++++++++++++++++++++-
1 file changed, 61 insertions(+), 1 deletion(-)

diff --git a/www/manager6/form/CRSOptions.js b/www/manager6/form/CRSOptions.js
index b22c5c99..b5476bd5 100644
--- a/www/manager6/form/CRSOptions.js
+++ b/www/manager6/form/CRSOptions.js
@@ -7,7 +7,7 @@ Ext.define('PVE.form.CRSOptions', {
onlineHelp: 'ha_manager_crs',

fieldDefaults: {
- labelWidth: 120,
+ labelWidth: 150,
},

setValues: function (values) {
@@ -16,6 +16,8 @@ Ext.define('PVE.form.CRSOptions', {
});
},

+ viewModel: {},
+
items: [
{
xtype: 'inputpanel',
@@ -50,6 +52,64 @@ Ext.define('PVE.form.CRSOptions', {
),
value: 0,
},
+ {
+ xtype: 'proxmoxcheckbox',
+ name: 'ha-auto-rebalance',
+ fieldLabel: gettext('Automatic Rebalance'),
+ boxLabel: gettext('Automatically rebalance HA resources'),
+ value: 0,
+ reference: 'enableAutoRebalance',
+ },
+ {
+ xtype: 'numberfield',
+ name: 'ha-auto-rebalance-threshold',
+ fieldLabel: gettext('Imbalance Threshold'),
+ emptyText: '0.3',
+ minValue: 0.0,
+ step: 0.01,
+ bind: {
+ disabled: '{!enableAutoRebalance.checked}',
+ },
+ },
+ {
+ xtype: 'proxmoxKVComboBox',
+ name: 'ha-auto-rebalance-method',
+ fieldLabel: gettext('Rebalancing Method'),
+ deleteEmpty: false,
+ value: '__default__',
+ comboItems: [
+ ['__default__', Proxmox.Utils.defaultText + ' (bruteforce)'],
+ ['bruteforce', 'Bruteforce'],
+ ['topsis', 'TOPSIS'],
+ ],
+ defaultValue: '__default__',
+ bind: {
+ disabled: '{!enableAutoRebalance.checked}',
+ },
+ },
+ {
+ xtype: 'numberfield',
+ name: 'ha-auto-rebalance-hold-duration',
+ fieldLabel: gettext('Hold Duration'),
+ emptyText: '3',
+ minValue: 0,
+ step: 1,
+ bind: {
+ disabled: '{!enableAutoRebalance.checked}',
+ },
+ },
+ {
+ xtype: 'numberfield',
+ name: 'ha-auto-rebalance-margin',
+ fieldLabel: gettext('Minimum Imbalance Improvement'),
+ emptyText: '0.1',
+ minValue: 0.0,
+ maxValue: 1.0,
+ step: 0.01,
+ bind: {
+ disabled: '{!enableAutoRebalance.checked}',
+ },
+ },
],
},
],
--
2.47.3