From a498f279919655ba774cc59bb9319c0dc0b33e7e Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Thu, 26 Apr 2018 08:45:49 +0200 Subject: [PATCH] add apiCallDone callback for window.edit 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 --- 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 -- 2.39.2