mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-05-10 03:50:25 +00:00
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 <d.csapak@proxmox.com>
This commit is contained in:
parent
2087bcd90b
commit
a498f27991
@ -44,6 +44,10 @@ Ext.define('Proxmox.window.Edit', {
|
|||||||
// the task finished. function(success)
|
// the task finished. function(success)
|
||||||
taskDone: Ext.emptyFn,
|
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
|
// 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
|
// bottom of the window. If undefined we magically fall back to the
|
||||||
// onlineHelp of our first item, if set.
|
// onlineHelp of our first item, if set.
|
||||||
@ -130,6 +134,8 @@ Ext.define('Proxmox.window.Edit', {
|
|||||||
method: me.method || (me.backgroundDelay ? 'POST' : 'PUT'),
|
method: me.method || (me.backgroundDelay ? 'POST' : 'PUT'),
|
||||||
params: values,
|
params: values,
|
||||||
failure: function(response, options) {
|
failure: function(response, options) {
|
||||||
|
me.apiCallDone(false, response, options);
|
||||||
|
|
||||||
if (response.result && response.result.errors) {
|
if (response.result && response.result.errors) {
|
||||||
form.markInvalid(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) &&
|
var hasProgressBar = (me.backgroundDelay || me.showProgress || me.showTaskViewer) &&
|
||||||
response.result.data ? true : false;
|
response.result.data ? true : false;
|
||||||
|
|
||||||
|
me.apiCallDone(true, response, options);
|
||||||
|
|
||||||
if (hasProgressBar) {
|
if (hasProgressBar) {
|
||||||
// stay around so we can trigger our close events
|
// stay around so we can trigger our close events
|
||||||
// when background action is completed
|
// when background action is completed
|
||||||
|
Loading…
Reference in New Issue
Block a user