[pve-devel] [RFC manager 7/9] gui: CPUModelSelector: add 'allowCustom'

Stefan Reiter s.reiter at proxmox.com
Thu Oct 28 13:41:48 CEST 2021


When set to false, only default CPU models will be shown.

Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---
 www/manager6/form/CPUModelSelector.js | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/www/manager6/form/CPUModelSelector.js b/www/manager6/form/CPUModelSelector.js
index a4d883a4..54286d79 100644
--- a/www/manager6/form/CPUModelSelector.js
+++ b/www/manager6/form/CPUModelSelector.js
@@ -25,6 +25,10 @@ Ext.define('PVE.form.CPUModelSelector', {
 
     deleteEmpty: true,
 
+    config: {
+	allowCustom: true,
+    },
+
     listConfig: {
 	columns: [
 	    {
@@ -107,4 +111,16 @@ Ext.define('PVE.form.CPUModelSelector', {
 	    },
 	},
     },
+
+    initComponent: function() {
+	let me = this;
+
+	if (!me.allowCustom) {
+	    me.store.filters = [{
+		filterFn: rec => !rec.data.custom,
+	    }];
+	}
+
+	me.callParent();
+    },
 });
-- 
2.30.2






More information about the pve-devel mailing list