all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH widget-toolkit 1/1] window/SafeDestroy: add taskDone and apiCallDone callbacks
Date: Fri,  4 Jun 2021 11:44:05 +0200	[thread overview]
Message-ID: <20210604094406.12537-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20210604094406.12537-1-d.csapak@proxmox.com>

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





  reply	other threads:[~2021-06-04  9:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-07-08 12:07   ` [pbs-devel] applied: [PATCH widget-toolkit 1/1] window/SafeDestroy: add taskDone and apiCallDone callbacks 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
2021-07-08 14:39   ` [pbs-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210604094406.12537-2-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal