]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
followup: network selector: refactor cidr6 merge logic
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 12 Jun 2019 11:07:32 +0000 (13:07 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 12 Jun 2019 11:07:32 +0000 (13:07 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
form/NetworkSelector.js

index 2a94bbdcb1f2f2109e7671082127fd19d5fb97e9..07192fc53c5386421b593460fc5b10764b018fce 100644 (file)
@@ -68,23 +68,15 @@ Ext.define('Proxmox.form.NetworkSelector', {
        listeners: {
            load: function(store, records, successfull) {
 
-               if(successfull) {
+               if (successfull) {
                    records.forEach(function(record) {
-                       if(record.data.cidr && record.data.cidr6) {
-                           var tempcopy = record.copy(null);
-                           tempcopy.data.cidr = tempcopy.data.cidr6;
-                           delete tempcopy.data.cidr6;
-                           tempcopy.data.comment = tempcopy.data.comments6;
-                           delete tempcopy.data.comments6;
-                           store.add(tempcopy);
-                       }
-
-                       if(!record.data.cidr && record.data.cidr6) {
-                           record.data.cidr = record.data.cidr6;
+                       if (record.data.cidr6) {
+                           let dest = (record.data.cidr) ? record.copy(null) : record;
+                           dest.data.cidr = record.data.cidr6;
                            delete record.data.cidr6;
-                           record.data.comments = record.data.comments6;
+                           dest.data.comments = record.data.comments6;
                            delete record.data.comments6;
-                           store.add(record);
+                           store.add(dest);
                        }
                    });
                }