[pve-devel] [PATCH manager 4/5] ui: pci map edit: make top fields more clear

Dominik Csapak d.csapak at proxmox.com
Mon Jun 19 11:13:33 CEST 2023


by
* moving the node to the left column and changing the label
* moving the mdev filter to the right column
* show only the create button for new node mappings (otherwise we'd have
  a reset button here that cannot do anything useful)

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/window/PCIMapEdit.js | 38 +++++++++++++++++--------------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/www/manager6/window/PCIMapEdit.js b/www/manager6/window/PCIMapEdit.js
index 0b6d7d60..516678e0 100644
--- a/www/manager6/window/PCIMapEdit.js
+++ b/www/manager6/window/PCIMapEdit.js
@@ -13,8 +13,8 @@ Ext.define('PVE.window.PCIMapEditWindow', {
 
     cbindData: function(initialConfig) {
 	let me = this;
-	me.isCreate = !me.name;
-	me.method = me.isCreate ? 'POST' : 'PUT';
+	me.isCreate = !me.name || !me.nodename;
+	me.method = me.name ? 'PUT' : 'POST';
 	return {
 	    name: me.name,
 	    nodename: me.nodename,
@@ -23,7 +23,7 @@ Ext.define('PVE.window.PCIMapEditWindow', {
 
     submitUrl: function(_url, data) {
 	let me = this;
-	let name = me.isCreate ? '' : me.name;
+	let name = me.method === 'PUT' ? me.name : '';
 	return `/cluster/mapping/pci/${name}`;
     },
 
@@ -155,22 +155,9 @@ Ext.define('PVE.window.PCIMapEditWindow', {
 		    name: 'id',
 		    allowBlank: false,
 		},
-		{
-		    xtype: 'proxmoxcheckbox',
-		    fieldLabel: gettext('Mediated Devices'),
-		    labelWidth: 120,
-		    reference: 'mdev',
-		    name: 'mdev',
-		    cbind: {
-			deleteEmpty: '{!isCreate}',
-		    },
-		},
-	    ],
-
-	    column2: [
 		{
 		    xtype: 'pmxDisplayEditField',
-		    fieldLabel: gettext('Node'),
+		    fieldLabel: gettext('Mapping on Node'),
 		    labelWidth: 120,
 		    name: 'node',
 		    editConfig: {
@@ -184,6 +171,23 @@ Ext.define('PVE.window.PCIMapEditWindow', {
 		},
 	    ],
 
+	    column2: [
+		{
+		    // as spacer
+		    xtype: 'displayfield',
+		},
+		{
+		    xtype: 'proxmoxcheckbox',
+		    fieldLabel: gettext('Mediated Devices'),
+		    labelWidth: 120,
+		    reference: 'mdev',
+		    name: 'mdev',
+		    cbind: {
+			deleteEmpty: '{!isCreate}',
+		    },
+		},
+	    ],
+
 	    columnB: [
 		{
 		    xtype: 'pveMultiPCISelector',
-- 
2.30.2






More information about the pve-devel mailing list