* [pbs-devel] [PATCH widget-toolkit 1/1] window/SafeDestroy: add taskDone and apiCallDone callbacks
2021-06-04 9:44 [pbs-devel] [PATCH widget-toolkit/proxmox-bacukp] fix remove datastore callback Dominik Csapak
@ 2021-06-04 9:44 ` Dominik Csapak
2021-07-08 12:07 ` [pbs-devel] applied: " Thomas Lamprecht
2021-06-04 9:44 ` [pbs-devel] [PATCH proxmox-backup 1/1] ui: datastore/OptionView: only navigate up when we removed the datastore Dominik Csapak
1 sibling, 1 reply; 5+ messages in thread
From: Dominik Csapak @ 2021-06-04 9:44 UTC (permalink / raw)
To: pbs-devel
like in edit window, so we can reacto to a successful task/api call
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/window/SafeDestroy.js | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/window/SafeDestroy.js b/src/window/SafeDestroy.js
index b269f2d..ead0e04 100644
--- a/src/window/SafeDestroy.js
+++ b/src/window/SafeDestroy.js
@@ -17,6 +17,14 @@ Ext.define('Proxmox.window.SafeDestroy', {
additionalItems: [],
+ // gets called if we have a progress bar or taskview and it detected that
+ // 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,
+
config: {
item: {
id: undefined,
@@ -66,6 +74,7 @@ Ext.define('Proxmox.window.SafeDestroy', {
method: 'DELETE',
waitMsgTarget: view,
failure: function(response, opts) {
+ view.apiCallDone(false, response, opts);
view.close();
Ext.Msg.alert('Error', response.htmlStatus);
},
@@ -73,6 +82,8 @@ Ext.define('Proxmox.window.SafeDestroy', {
const hasProgressBar = !!(view.showProgress &&
response.result.data);
+ view.apiCallDone(true, response, options);
+
if (hasProgressBar) {
// stay around so we can trigger our close events
// when background action is completed
@@ -81,6 +92,7 @@ Ext.define('Proxmox.window.SafeDestroy', {
const upid = response.result.data;
const win = Ext.create('Proxmox.window.TaskProgress', {
upid: upid,
+ taskDone: view.taskDone,
listeners: {
destroy: function() {
view.close();
--
2.20.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [pbs-devel] [PATCH proxmox-backup 1/1] ui: datastore/OptionView: only navigate up when we removed the datastore
2021-06-04 9:44 [pbs-devel] [PATCH widget-toolkit/proxmox-bacukp] fix remove datastore callback Dominik Csapak
2021-06-04 9:44 ` [pbs-devel] [PATCH widget-toolkit 1/1] window/SafeDestroy: add taskDone and apiCallDone callbacks Dominik Csapak
@ 2021-06-04 9:44 ` Dominik Csapak
2021-07-08 14:39 ` [pbs-devel] applied: " Thomas Lamprecht
1 sibling, 1 reply; 5+ messages in thread
From: Dominik Csapak @ 2021-06-04 9:44 UTC (permalink / raw)
To: pbs-devel
and not on window close
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
www/datastore/OptionView.js | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/www/datastore/OptionView.js b/www/datastore/OptionView.js
index 98152dce..5a5e85be 100644
--- a/www/datastore/OptionView.js
+++ b/www/datastore/OptionView.js
@@ -33,13 +33,11 @@ Ext.define('PBS.Datastore.Options', {
note: gettext('Configuration change only, no data will be deleted.'),
autoShow: true,
taskName: 'delete-datastore',
- listeners: {
- destroy: () => {
- let navtree = Ext.ComponentQuery.query('navigationtree')[0];
- navtree.rstore.load();
- let mainview = me.getView().up('mainview');
- mainview.getController().redirectTo('pbsDataStores');
- },
+ apiCallDone: (success) => {
+ let navtree = Ext.ComponentQuery.query('navigationtree')[0];
+ navtree.rstore.load();
+ let mainview = me.getView().up('mainview');
+ mainview.getController().redirectTo('pbsDataStores');
},
});
},
--
2.20.1
^ permalink raw reply [flat|nested] 5+ messages in thread