From: Stefan Hanreich <s.hanre...@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.hanre...@proxmox.com> Signed-off-by: Gabriel Goller <g.gol...@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 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel