]> git.proxmox.com Git - pve-manager.git/commitdiff
fix #1108: add copy firewall rule to GUI
authorWolfgang Link <w.link@proxmox.com>
Thu, 22 Sep 2016 09:03:25 +0000 (11:03 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 5 Oct 2016 05:06:51 +0000 (07:06 +0200)
It is now possible to select a firewall rule on the GUI
and copy it as template for the new rule.

www/manager6/grid/FirewallRules.js

index 09f107406347514c2ef844c2280d4c994b81ef4c..4d151e7a3cc00ff4a0266fb681a432ac5c59b546 100644 (file)
@@ -280,6 +280,8 @@ Ext.define('PVE.FirewallRuleEdit', {
                    }
                }
            });
+       } else if (me.rec) {
+           ipanel.setValues(me.rec.data);
        }
     }
 });
@@ -549,6 +551,37 @@ Ext.define('PVE.FirewallRules', {
            }
        });
 
+       var run_copy_editor = function() {
+           var rec = sm.getSelection()[0];
+
+           if (!rec) {
+               return;
+           }
+           var type = rec.data.type;
+
+
+           if (!(type === 'in' || type === 'out')) {
+               return;
+           }
+
+           var win = Ext.create('PVE.FirewallRuleEdit', {
+               allow_iface: me.allow_iface,
+               base_url: me.base_url,
+               list_refs_url: me.list_refs_url,
+               rec: rec,
+           });
+
+           win.show();
+           win.on('destroy', reload);
+       };
+
+       me.copyBtn = Ext.create('PVE.button.Button',{
+           text: gettext('Copy'),
+           selModel: sm,
+           disabled: true,
+           handler: run_copy_editor,
+       });
+
        if (me.allow_groups) {
            me.groupBtn =  Ext.create('Ext.Button', {
                text: gettext('Insert') + ': ' + 
@@ -579,7 +612,7 @@ Ext.define('PVE.FirewallRules', {
        });
 
        var tbar = me.tbar_prefix ? [ me.tbar_prefix ] : [];
-       tbar.push(me.addBtn);
+       tbar.push(me.addBtn, me.copyBtn);
        if (me.groupBtn) {
            tbar.push(me.groupBtn);
        }