[pve-devel] [PATCH widget-toolkit 1/1] window: add upidFieldName option

Lorenz Stechauner l.stechauner at proxmox.com
Wed Apr 28 16:13:46 CEST 2021


Signed-off-by: Lorenz Stechauner <l.stechauner at proxmox.com>
---
 src/window/Edit.js | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/window/Edit.js b/src/window/Edit.js
index 53d0e73..867ba9b 100644
--- a/src/window/Edit.js
+++ b/src/window/Edit.js
@@ -53,6 +53,10 @@ Ext.define('Proxmox.window.Edit', {
 
     showTaskViewer: false,
 
+    // name of the upid field in response data
+    // required for showTaskViewer
+    upidFieldName: undefined,
+
     // gets called if we have a progress bar or taskview and it detected that
     // the task finished. function(success)
     taskDone: Ext.emptyFn,
@@ -165,9 +169,8 @@ Ext.define('Proxmox.window.Edit', {
 		Ext.Msg.alert(gettext('Error'), response.htmlStatus);
 	    },
 	    success: function(response, options) {
-		let hasProgressBar =
-		    (me.backgroundDelay || me.showProgress || me.showTaskViewer) &&
-		    response.result.data;
+		let data = response.result.data;
+		let hasProgressBar = (me.backgroundDelay || me.showProgress || me.showTaskViewer) && data;
 
 		me.apiCallDone(true, response, options);
 
@@ -176,7 +179,7 @@ Ext.define('Proxmox.window.Edit', {
 		    // when background action is completed
 		    me.hide();
 
-		    let upid = response.result.data;
+		    let upid = me.upidFieldName ? data[me.upidFieldName] : data;
 		    let viewerClass = me.showTaskViewer ? 'Viewer' : 'Progress';
 		    Ext.create('Proxmox.window.Task' + viewerClass, {
 			autoShow: true,
-- 
2.20.1





More information about the pve-devel mailing list