From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 772871FF13C for ; Thu, 02 Apr 2026 14:50:18 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 8B23617946; Thu, 2 Apr 2026 14:49:07 +0200 (CEST) From: Daniel Kral To: pve-devel@lists.proxmox.com Subject: [PATCH manager v4 27/28] ui: move cluster resource scheduling from dc/options into separate component Date: Thu, 2 Apr 2026 14:44:21 +0200 Message-ID: <20260402124817.416232-28-d.kral@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260402124817.416232-1-d.kral@proxmox.com> References: <20260402124817.416232-1-d.kral@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1775134044254 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.082 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: KYWHJSJXSKCFT3G4LRQFWMB6KRMMODYF X-Message-ID-Hash: KYWHJSJXSKCFT3G4LRQFWMB6KRMMODYF X-MailFrom: d.kral@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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