[pve-devel] applied: [PATCH widget-toolkit v2] add apiCallDone callback for window.edit
Thomas Lamprecht
t.lamprecht at proxmox.com
Fri Apr 27 14:05:48 CEST 2018
applied v2 of this for wtk, will give the manager code another look
On 4/26/18 8:45 AM, Dominik Csapak wrote:
> we sometimes want/need to do something when the api call
> finished and need to know whether it was successful or need the result
>
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> window/Edit.js | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/window/Edit.js b/window/Edit.js
> index 9548e21..aeb8019 100644
> --- a/window/Edit.js
> +++ b/window/Edit.js
> @@ -44,6 +44,10 @@ Ext.define('Proxmox.window.Edit', {
> // the task finished. function(success)
> taskDone: Ext.emptyFn,
>
> + // gets called when the api call is finished, right at the beginning
> + // function(success, response, options)
> + apiCallDone: Ext.emptyFn,
> +
> // assign a reference from docs, to add a help button docked to the
> // bottom of the window. If undefined we magically fall back to the
> // onlineHelp of our first item, if set.
> @@ -130,6 +134,8 @@ Ext.define('Proxmox.window.Edit', {
> method: me.method || (me.backgroundDelay ? 'POST' : 'PUT'),
> params: values,
> failure: function(response, options) {
> + me.apiCallDone(false, response, options);
> +
> if (response.result && response.result.errors) {
> form.markInvalid(response.result.errors);
> }
> @@ -139,6 +145,8 @@ Ext.define('Proxmox.window.Edit', {
> var hasProgressBar = (me.backgroundDelay || me.showProgress || me.showTaskViewer) &&
> response.result.data ? true : false;
>
> + me.apiCallDone(true, response, options);
> +
> if (hasProgressBar) {
> // stay around so we can trigger our close events
> // when background action is completed
>
More information about the pve-devel
mailing list