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

Dominik Csapak d.csapak at proxmox.com
Thu Apr 29 14:14:00 CEST 2021


as i wrote on the other patches, this is
unnecessary if we split the thing up into two api calls

On 4/28/21 16:13, Lorenz Stechauner wrote:
> 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,
> 






More information about the pve-devel mailing list