[pmg-devel] [PATCH pmg-gui 2/4] quarantine: refactor action logic

Dominik Csapak d.csapak at proxmox.com
Wed Mar 28 16:55:43 CEST 2018


so that it can be reused

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 js/SpamQuarantine.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/js/SpamQuarantine.js b/js/SpamQuarantine.js
index 5c6865b..32faa6d 100644
--- a/js/SpamQuarantine.js
+++ b/js/SpamQuarantine.js
@@ -91,13 +91,19 @@ Ext.define('PMG.SpamQuarantine', {
 	},
 
 	btnHandler: function(button, e) {
+	    var me = this;
+	    var action = button.reference;
 	    var list = this.lookupReference('list');
 	    var selected = list.getSelection();
+	    me.doAction(action, selected);
+	},
+
+	doAction: function(action, selected) {
 	    if (!selected.length) {
 		return;
 	    }
 
-	    var action = button.reference;
+	    var list = this.lookupReference('list');
 
 	    if (selected.length > 1) {
 		var idlist = [];
-- 
2.11.0




More information about the pmg-devel mailing list