[PATCH pve-manager v2 15/17] ui: VMCPUFlagSelector: Allow filtering out flags supported on 0 nodes

Arthur Bied-Charreton
2026-04-01T08:01:13Z

The cpu-flags endpoints may return some CPU flags that are not supported
on any node in the cluster. Filter those out by default in the UI,
giving the option to display them via a checkbox.

Unknown flags are still shown at the top of the list.

Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
www/manager6/form/VMCPUFlagSelector.js | 33 ++++++++++++++++++++++++++
1 file changed, 33 insertions(+)

diff --git a/www/manager6/form/VMCPUFlagSelector.js b/www/manager6/form/VMCPUFlagSelector.js
index cbd6e2c7..765d325d 100644
--- a/www/manager6/form/VMCPUFlagSelector.js
+++ b/www/manager6/form/VMCPUFlagSelector.js
@@ -340,6 +340,39 @@ Ext.define('PVE.form.VMCPUFlagSelector', {
},
];

+ me.dockedItems.push({
+ xtype: 'toolbar',
+ dock: 'bottom',
+ items: [
+ {
+ xtype: 'checkbox',
+ checked: true,
+ submitValue: false,
+ isFormField: false,
+ boxLabel: gettext('Only show flags supported by at least one node'),
+ listeners: {
+ change: function (cb, checked) {
+ let store = cb.up('grid').getStore();
+ if (checked) {
+ store.addFilter({
+ id: 'supported-filter',
+ filterFn: (rec) => {
+ if (rec.get('unknown')) {
+ return true;
+ }
+ let s = rec.get('supported-on');
+ return Array.isArray(s) && s.length > 0;
+ },
+ });
+ } else {
+ store.removeFilter('supported-filter');
+ }
+ },
+ },
+ },
+ ],
+ });
+
me.callParent(arguments);

me.initialized = true;
--
2.47.3