]> git.proxmox.com Git - pmg-gui.git/commitdiff
quarantine: refactor action logic
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 28 Mar 2018 14:55:43 +0000 (16:55 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 29 Mar 2018 12:31:29 +0000 (14:31 +0200)
so that it can be reused

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
js/SpamQuarantine.js

index 5c6865b31e5eef17e05a86c655a40632ef0520ef..32faa6d2897c0236e608c977fa003dce5698a203 100644 (file)
@@ -91,13 +91,19 @@ Ext.define('PMG.SpamQuarantine', {
        },
 
        btnHandler: function(button, e) {
        },
 
        btnHandler: function(button, e) {
+           var me = this;
+           var action = button.reference;
            var list = this.lookupReference('list');
            var selected = list.getSelection();
            var list = this.lookupReference('list');
            var selected = list.getSelection();
+           me.doAction(action, selected);
+       },
+
+       doAction: function(action, selected) {
            if (!selected.length) {
                return;
            }
 
            if (!selected.length) {
                return;
            }
 
-           var action = button.reference;
+           var list = this.lookupReference('list');
 
            if (selected.length > 1) {
                var idlist = [];
 
            if (selected.length > 1) {
                var idlist = [];