looks okay, one comment inline

On 7/15/19 12:28 PM, Dominic Jäger wrote:
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.jae...@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;

we always use {} for ifs

if you want to keep it on one line you can do:

url += (typeof me.delay !== 'undefined)? '?delay=" + me.delay : '';

Proxmox.Utils.API2Request({
-           url: me.getUrl(rec),
+           url: url,
            method: 'DELETE',
            waitMsgTarget: me.waitMsgTarget,
            callback: function(options, success, response) {



_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to