[PATCH manager v4 27/28] ui: move cluster resource scheduling from dc/options into separate component

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

This is in preparation to the next patch, which adds a view model to the
component to make options dependent on each other's state.

Signed-off-by: Daniel Kral <d.kral@proxmox.com>
---
changes v3 -> v4:
- new!

www/manager6/Makefile | 1 +
www/manager6/dc/OptionView.js | 38 +++++-----------------
www/manager6/form/CRSOptions.js | 56 +++++++++++++++++++++++++++++++++
3 files changed, 64 insertions(+), 31 deletions(-)
create mode 100644 www/manager6/form/CRSOptions.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 4558d53e..b0c94b32 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -27,6 +27,7 @@ JSSRC= \
form/BridgeSelector.js \
form/BusTypeSelector.js \
form/CPUModelSelector.js \
+ form/CRSOptions.js \
form/CacheTypeSelector.js \
form/CalendarEvent.js \
form/CephPoolSelector.js \
diff --git a/www/manager6/dc/OptionView.js b/www/manager6/dc/OptionView.js
index fa87832b..7c8d3792 100644
--- a/www/manager6/dc/OptionView.js
+++ b/www/manager6/dc/OptionView.js
@@ -180,38 +180,14 @@ Ext.define('PVE.dc.OptionView', {
},
],
});
- me.add_inputpanel_row('crs', gettext('Cluster Resource Scheduling'), {
+ me.rows.crs = {
+ required: true,
renderer: PVE.Utils.render_as_property_string,
- width: 450,
- labelWidth: 120,
- url: '/api2/extjs/cluster/options',
- onlineHelp: 'ha_manager_crs',
- items: [
- {
- xtype: 'proxmoxKVComboBox',
- name: 'ha',
- fieldLabel: gettext('HA Scheduling'),
- deleteEmpty: false,
- value: '__default__',
- comboItems: [
- ['__default__', Proxmox.Utils.defaultText + ' (basic)'],
- ['basic', gettext('Basic (Resource Count)')],
- ['static', gettext('Static Load')],
- ['dynamic', gettext('Dynamic Load')],
- ],
- defaultValue: '__default__',
- },
- {
- xtype: 'proxmoxcheckbox',
- name: 'ha-rebalance-on-start',
- fieldLabel: gettext('Rebalance on Start'),
- boxLabel: gettext(
- 'Use CRS to select the least loaded node when starting an HA service',
- ),
- value: 0,
- },
- ],
- });
+ header: gettext('Cluster Resource Scheduling'),
+ editor: {
+ xtype: 'pveCRSOptions',
+ },
+ };
me.add_inputpanel_row('u2f', gettext('U2F Settings'), {
renderer: (v) =>
!v ? Proxmox.Utils.NoneText : Ext.htmlEncode(PVE.Parser.printPropertyString(v)),
diff --git a/www/manager6/form/CRSOptions.js b/www/manager6/form/CRSOptions.js
new file mode 100644
index 00000000..b22c5c99
--- /dev/null
+++ b/www/manager6/form/CRSOptions.js
@@ -0,0 +1,56 @@
+Ext.define('PVE.form.CRSOptions', {
+ extend: 'Proxmox.window.Edit',
+ alias: 'widget.pveCRSOptions',
+
+ width: 450,
+ url: '/api2/extjs/cluster/options',
+ onlineHelp: 'ha_manager_crs',
+
+ fieldDefaults: {
+ labelWidth: 120,
+ },
+
+ setValues: function (values) {
+ Ext.Array.each(this.query('inputpanel'), (panel) => {
+ panel.setValues(values.crs);
+ });
+ },
+
+ items: [
+ {
+ xtype: 'inputpanel',
+ onGetValues: function (values) {
+ if (values === undefined || Object.keys(values).length === 0) {
+ return { delete: 'crs' };
+ } else {
+ return { crs: PVE.Parser.printPropertyString(values) };
+ }
+ },
+ items: [
+ {
+ xtype: 'proxmoxKVComboBox',
+ name: 'ha',
+ fieldLabel: gettext('HA Scheduling'),
+ deleteEmpty: false,
+ value: '__default__',
+ comboItems: [
+ ['__default__', Proxmox.Utils.defaultText + ' (basic)'],
+ ['basic', gettext('Basic (Resource Count)')],
+ ['static', gettext('Static Load')],
+ ['dynamic', gettext('Dynamic Load')],
+ ],
+ defaultValue: '__default__',
+ },
+ {
+ xtype: 'proxmoxcheckbox',
+ name: 'ha-rebalance-on-start',
+ fieldLabel: gettext('Rebalance on Start'),
+ boxLabel: gettext(
+ 'Use CRS to select the least loaded node when starting an HA service',
+ ),
+ value: 0,
+ },
+ ],
+ },
+ ],
+});
--
2.47.3