[pve-devel] [v2 manager 22/27] add a params object to the safedestroy window

Fabian Gr├╝nbichler f.gruenbichler at proxmox.com
Tue Aug 29 13:04:44 CEST 2017


From: Dominik Csapak <d.csapak at proxmox.com>

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.csapak at proxmox.com>
---
identical to Dominik's v1

 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




More information about the pve-devel mailing list