we sometimes want to give the api call a parameter,
with this, we don't have to encode it into the url
everytime ourselves, but just give a 'params' object

Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
---
 www/manager6/window/SafeDestroy.js | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/www/manager6/window/SafeDestroy.js 
b/www/manager6/window/SafeDestroy.js
index 23e4c04a..a7ecf5fd 100644
--- a/www/manager6/window/SafeDestroy.js
+++ b/www/manager6/window/SafeDestroy.js
@@ -19,7 +19,16 @@ Ext.define('PVE.window.SafeDestroy', {
            id: undefined,
            type: undefined
        },
-       url: undefined
+       url: undefined,
+       params: {}
+    },
+
+    getParams: function() {
+       var me = this;
+       if (Ext.Object.isEmpty(me.params)) {
+           return '';
+       }
+       return '?' + Ext.Object.toQueryString(me.params);
     },
 
     controller: {
@@ -48,7 +57,7 @@ Ext.define('PVE.window.SafeDestroy', {
                click: function() {
                    var view = this.getView();
                    PVE.Utils.API2Request({
-                       url: view.getUrl(),
+                       url: view.getUrl() + view.getParams(),
                        method: 'DELETE',
                        waitMsgTarget: view,
                        failure: function(response, opts) {
-- 
2.11.0


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

Reply via email to