[pve-devel] [PATCH manager v2 3/5] ui: pci/usb map edit: improve new host mappings dialog

Dominik Csapak d.csapak at proxmox.com
Wed Jun 21 09:41:40 CEST 2023


by disallowing nodes to be selected where a mapping already exists

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
changes from v1:
* dont' disable autoselect, the first allowed node will be selected
* for usb mappings too
 www/manager6/window/PCIMapEdit.js | 9 ++++++++-
 www/manager6/window/USBMapEdit.js | 4 ++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/www/manager6/window/PCIMapEdit.js b/www/manager6/window/PCIMapEdit.js
index 8c1a95e3..f243362b 100644
--- a/www/manager6/window/PCIMapEdit.js
+++ b/www/manager6/window/PCIMapEdit.js
@@ -58,7 +58,13 @@ Ext.define('PVE.window.PCIMapEditWindow', {
 	    let me = this;
 	    let view = me.getView();
 	    me.originalMap = [...values.map];
-	    values.map = PVE.Parser.filterPropertyStringList(values.map, (e) => e.node === view.nodename);
+	    let configuredNodes = [];
+	    values.map = PVE.Parser.filterPropertyStringList(values.map, (e) => {
+		configuredNodes.push(e.node);
+		return e.node === view.nodename;
+	    });
+
+	    me.lookup('nodeselector').disallowedNodes = configuredNodes;
 	    return values;
 	},
 
@@ -203,6 +209,7 @@ Ext.define('PVE.window.PCIMapEditWindow', {
 		    name: 'node',
 		    editConfig: {
 			xtype: 'pveNodeSelector',
+			reference: 'nodeselector',
 		    },
 		    cbind: {
 			editable: '{!nodename}',
diff --git a/www/manager6/window/USBMapEdit.js b/www/manager6/window/USBMapEdit.js
index 80f8e785..f36f1d03 100644
--- a/www/manager6/window/USBMapEdit.js
+++ b/www/manager6/window/USBMapEdit.js
@@ -71,13 +71,16 @@ Ext.define('PVE.window.USBMapEditWindow', {
 	    let me = this;
 	    let view = me.getView();
 	    me.originalMap = [...values.map];
+	    let configuredNodes = [];
 	    PVE.Parser.filterPropertyStringList(values.map, (e) => {
+		configuredNodes.push(e.node);
 		if (e.node === view.nodename) {
 		    values = e;
 		}
 		return false;
 	    });
 
+	    me.lookup('nodeselector').disallowedNodes = configuredNodes;
 	    if (values.path) {
 		values.usb = 'path';
 	    }
@@ -145,6 +148,7 @@ Ext.define('PVE.window.USBMapEditWindow', {
 		    name: 'node',
 		    editConfig: {
 			xtype: 'pveNodeSelector',
+			reference: 'nodeselector',
 		    },
 		    cbind: {
 			editable: '{!nodename}',
-- 
2.30.2






More information about the pve-devel mailing list