[pve-devel] [PATCH widget-toolkit v4] Fix #582: Add delay to button

Dominic Jäger d.jaeger at proxmox.com
Mon Jul 15 12:28:19 CEST 2019


The StdRemoveButton can now pass a delay parameter to the API.
It is set undefined as default so that users of the button
can set the parameter themselves.

Signed-off-by: Dominic Jäger <d.jaeger at proxmox.com>
---
v3->v4: Make the delay undefined/optional

 button/Button.js | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/button/Button.js b/button/Button.js
index dade477..266bb83 100644
--- a/button/Button.js
+++ b/button/Button.js
@@ -104,6 +104,9 @@ Ext.define('Proxmox.button.StdRemoveButton', {
 
     disabled: true,
 
+    // time to wait for removal task to finish
+    delay: undefined,
+
     config: {
 	baseurl: undefined
     },
@@ -130,9 +133,11 @@ Ext.define('Proxmox.button.StdRemoveButton', {
 
     handler: function(btn, event, rec) {
 	var me = this;
+	var url = me.getUrl(rec);
+	if (typeof me.delay !== 'undefined') url += "?delay=" + me.delay;
 
 	Proxmox.Utils.API2Request({
-	    url: me.getUrl(rec),
+	    url: url,
 	    method: 'DELETE',
 	    waitMsgTarget: me.waitMsgTarget,
 	    callback: function(options, success, response) {
-- 
2.20.1




More information about the pve-devel mailing list