public inbox for pbs-devel@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 proxmox-backup] ui: tape: reload drive status on user actions
Date: Fri, 23 Apr 2021 12:52:45 +0200	[thread overview]
Message-ID: <20210423105245.23151-1-d.csapak@proxmox.com> (raw)

when the user start an action where we know that it locks the drive,
reload the tape store, so that the state is refreshed

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/tape/DriveStatus.js | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)

diff --git a/www/tape/DriveStatus.js b/www/tape/DriveStatus.js
index acc77680..2c55fc97 100644
--- a/www/tape/DriveStatus.js
+++ b/www/tape/DriveStatus.js
@@ -33,6 +33,10 @@ Ext.define('PBS.TapeManagement.DriveStatus', {
     controller: {
 	xclass: 'Ext.app.ViewController',
 
+	reloadTapeStore: function() {
+	    Ext.ComponentQuery.query('navigationtree')[0].reloadTapeStore();
+	},
+
 	reload: function() {
 	    let me = this;
 	    me.lookup('statusgrid').rstore.load();
@@ -46,6 +50,7 @@ Ext.define('PBS.TapeManagement.DriveStatus', {
 	    vm.set('online', online);
 	    let title = online ? gettext('Status') : gettext('Status (No Tape loaded)');
 	    statusgrid.setTitle(title);
+	    Ext.ComponentQuery.query('navigationtree')[0].reloadTapeStore();
 	},
 
 	onStateLoad: function(store) {
@@ -79,6 +84,11 @@ Ext.define('PBS.TapeManagement.DriveStatus', {
 	    let me = this;
 	    Ext.create('PBS.TapeManagement.LabelMediaWindow', {
 		driveid: me.getView().drive,
+		apiCallDone: function(success) {
+		    if (success) {
+			me.reloadTapeStore();
+		    }
+		},
 	    }).show();
 	},
 
@@ -90,6 +100,7 @@ Ext.define('PBS.TapeManagement.DriveStatus', {
 		waitMsgTarget: view,
 		method: 'POST',
 		success: function(response) {
+		    me.reloadTapeStore();
 		    Ext.create('Proxmox.window.TaskProgress', {
 			upid: response.result.data,
 			taskDone: function() {
@@ -108,6 +119,7 @@ Ext.define('PBS.TapeManagement.DriveStatus', {
 		waitMsgTarget: view,
 		method: 'POST',
 		success: function(response) {
+		    me.reloadTapeStore();
 		    Ext.create('Proxmox.window.TaskProgress', {
 			upid: response.result.data,
 			taskDone: function() {
@@ -126,6 +138,7 @@ Ext.define('PBS.TapeManagement.DriveStatus', {
 		waitMsgTarget: view,
 		method: 'POST',
 		success: function(response) {
+		    me.reloadTapeStore();
 		    Ext.create('Proxmox.window.TaskViewer', {
 			upid: response.result.data,
 			taskDone: function() {
@@ -143,7 +156,10 @@ Ext.define('PBS.TapeManagement.DriveStatus', {
 
 	    PBS.Utils.driveCommand(drive, 'read-label', {
 		waitMsgTarget: view,
-		success: PBS.Utils.showMediaLabelWindow,
+		success: function(response) {
+		    me.reloadTapeStore();
+		    PBS.Utils.showMediaLabelWindow(response);
+		},
 	    });
 	},
 
@@ -153,7 +169,10 @@ Ext.define('PBS.TapeManagement.DriveStatus', {
 	    let drive = view.drive;
 	    PBS.Utils.driveCommand(drive, 'volume-statistics', {
 		waitMsgTarget: view,
-		success: PBS.Utils.showVolumeStatisticsWindow,
+		success: function(response) {
+		    me.reloadTapeStore();
+		    PBS.Utils.showVolumeStatisticsWindow(response);
+		},
 	    });
 	},
 
@@ -163,7 +182,10 @@ Ext.define('PBS.TapeManagement.DriveStatus', {
 	    let drive = view.drive;
 	    PBS.Utils.driveCommand(drive, 'cartridge-memory', {
 		waitMsgTarget: me.getView(),
-		success: PBS.Utils.showCartridgeMemoryWindow,
+		success: function(response) {
+		    me.reloadTapeStore();
+		    PBS.Utils.showCartridgeMemoryWindow(response);
+		},
 	    });
 	},
 
-- 
2.20.1





                 reply	other threads:[~2021-04-23 10:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210423105245.23151-1-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal