[pve-devel] [PATCH widget-toolkit v4] Fix #582: Add delay to button
Dominik Csapak
d.csapak at proxmox.com
Wed Jul 24 12:14:03 CEST 2019
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.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;
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) {
>
More information about the pve-devel
mailing list