[pbs-devel] [PATCH widget-toolkit 1/1] dns: optionally send delete for optional values

Dominik Csapak d.csapak at proxmox.com
Fri Mar 1 10:03:40 CET 2024


pbs only deletes the optional values here when they are sent with the
'delete' parameter, in contrast to pve/pmg that don't have a delete
parameter currently and always use the parameters as source of truth.

So to handle that, optionally set deleteEmpty if set from outside

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/node/DNSEdit.js | 6 ++++++
 src/node/DNSView.js | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/src/node/DNSEdit.js b/src/node/DNSEdit.js
index 0b1135e..c895d9b 100644
--- a/src/node/DNSEdit.js
+++ b/src/node/DNSEdit.js
@@ -2,6 +2,9 @@ Ext.define('Proxmox.node.DNSEdit', {
     extend: 'Proxmox.window.Edit',
     alias: ['widget.proxmoxNodeDNSEdit'],
 
+    // pbs needs this set to true
+    deleteEmpty: false,
+
     initComponent: function() {
 	let me = this;
 
@@ -21,6 +24,7 @@ Ext.define('Proxmox.node.DNSEdit', {
                 fieldLabel: gettext('DNS server') + " 1",
 		vtype: 'IP64Address',
 		skipEmptyText: true,
+		deleteEmpty: me.deleteEmpty,
                 name: 'dns1',
 	    },
 	    {
@@ -28,6 +32,7 @@ Ext.define('Proxmox.node.DNSEdit', {
 		fieldLabel: gettext('DNS server') + " 2",
 		vtype: 'IP64Address',
 		skipEmptyText: true,
+		deleteEmpty: me.deleteEmpty,
                 name: 'dns2',
 	    },
 	    {
@@ -35,6 +40,7 @@ Ext.define('Proxmox.node.DNSEdit', {
                 fieldLabel: gettext('DNS server') + " 3",
 		vtype: 'IP64Address',
 		skipEmptyText: true,
+		deleteEmpty: me.deleteEmpty,
                 name: 'dns3',
 	    },
 	];
diff --git a/src/node/DNSView.js b/src/node/DNSView.js
index 4782f9c..b57da85 100644
--- a/src/node/DNSView.js
+++ b/src/node/DNSView.js
@@ -2,6 +2,9 @@ Ext.define('Proxmox.node.DNSView', {
     extend: 'Proxmox.grid.ObjectGrid',
     alias: ['widget.proxmoxNodeDNSView'],
 
+    // pbs needs this set to true
+    deleteEmpty: false,
+
     initComponent: function() {
 	let me = this;
 
@@ -12,6 +15,7 @@ Ext.define('Proxmox.node.DNSView', {
 	let run_editor = () => Ext.create('Proxmox.node.DNSEdit', {
 	    autoShow: true,
 	    nodename: me.nodename,
+	    deleteEmpty: me.deleteEmpty,
 	});
 
 	Ext.apply(me, {
-- 
2.30.2





More information about the pbs-devel mailing list