[pve-devel] [PATCH pve-manager v2 06/11] fabric: add generic fabric edit panel

Gabriel Goller g.goller at proxmox.com
Fri Apr 4 18:29:01 CEST 2025


From: Stefan Hanreich <s.hanreich at proxmox.com>

Add generic component to add and edit Fabrics. The Properties for every
protocol are stored in different components and each extend this one.

Co-authored-by: Stefan Hanreich <s.hanreich at proxmox.com>
Signed-off-by: Gabriel Goller <g.goller at proxmox.com>
---
 www/manager6/Makefile                  |  1 +
 www/manager6/sdn/fabrics/FabricEdit.js | 44 ++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 www/manager6/sdn/fabrics/FabricEdit.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index a0a739d7de99..41bd0830f816 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -305,6 +305,7 @@ JSSRC= 							\
 	sdn/zones/VxlanEdit.js				\
 	sdn/fabrics/Common.js				\
 	sdn/fabrics/NodeEdit.js				\
+	sdn/fabrics/FabricEdit.js				\
 	sdn/fabrics/openfabric/InterfacePanel.js				\
 	sdn/fabrics/ospf/InterfacePanel.js	\
 	storage/ContentView.js				\
diff --git a/www/manager6/sdn/fabrics/FabricEdit.js b/www/manager6/sdn/fabrics/FabricEdit.js
new file mode 100644
index 000000000000..f3e966cb6e62
--- /dev/null
+++ b/www/manager6/sdn/fabrics/FabricEdit.js
@@ -0,0 +1,44 @@
+Ext.define('PVE.sdn.Fabric.Fabric.Edit', {
+    extend: 'Proxmox.window.Edit',
+
+    isCreate: undefined,
+
+    viewModel: {
+	data: {
+	    isCreate: true,
+	},
+    },
+
+    submitUrl: function(url, values) {
+	let me = this;
+	return `${me.url}`;
+    },
+
+    initComponent: function() {
+	let me = this;
+
+	let view = me.getViewModel();
+	view.set('isCreate', me.isCreate);
+
+	me.method = me.isCreate ? 'POST' : 'PUT';
+
+	if (!me.isCreate) {
+	    me.items.push({
+		xtype: 'textfield',
+		name: 'digest',
+		hidden: true,
+		allowBlank: false,
+	    });
+	}
+
+	me.callParent();
+
+	if (!me.isCreate) {
+	    me.load({
+		success: function(response, opts) {
+		    me.setValues(response.result.data);
+		},
+	    });
+	}
+    },
+});
-- 
2.39.5





More information about the pve-devel mailing list