[pve-devel] [PATCH manager 3/7] port button from proxmox-widget-toolkit

Dominik Csapak d.csapak at proxmox.com
Tue Jun 13 14:56:02 CEST 2017


we want the new behaviour of the proxmox button also in pve, but
we do not want to change to proxmox-widget-toolkit yet

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/button/Button.js | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/www/manager6/button/Button.js b/www/manager6/button/Button.js
index 8dccae0a..a661bb45 100644
--- a/www/manager6/button/Button.js
+++ b/www/manager6/button/Button.js
@@ -22,9 +22,12 @@ Ext.define('PVE.button.Button', {
 	/*jslint confusion: true */
 
         var me = this;
+	var grid;
 
 	if (me.handler) {
-	    me.realHandler = me.handler;
+
+	    // Note: me.realHandler may be a string (see named scopes)
+	    var realHandler = me.handler;
 
 	    me.handler = function(button, event) {
 		var rec, msg;
@@ -51,17 +54,33 @@ Ext.define('PVE.button.Button', {
 			    if (btn !== 'yes') {
 				return;
 			    }
-			    me.realHandler(button, event, rec);
+			    Ext.callback(realHandler, me.scope, [button, event, rec], 0, me);
 			}
 		    });
 		} else {
-		    me.realHandler(button, event, rec);
+		    Ext.callback(realHandler, me.scope, [button, event, rec], 0, me);
 		}
 	    };
 	}
 
 	me.callParent();
 
+	if (!me.selModel && me.selModel !== null) {
+	    grid = me.up('grid');
+	    if (grid && grid.selModel) {
+		me.selModel = grid.selModel;
+	    }
+	}
+
+	if (me.waitMsgTarget === true) {
+	    grid = me.up('grid');
+	    if (grid) {
+		me.waitMsgTarget = grid;
+	    } else {
+		throw "unable to find waitMsgTarget";
+	    }
+	}
+
 	if (me.selModel) {
 
 	    me.mon(me.selModel, "selectionchange", function() {
-- 
2.11.0





More information about the pve-devel mailing list