[pbs-devel] [PATCH proxmox-backup 2/4] ui: tape/ChangerStatus: reload changer status (cached) every 5000ms

Dominik Csapak d.csapak at proxmox.com
Mon Feb 22 14:25:35 CET 2021


so that we can have an updated drive status without having to
press 'reload'

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/tape/ChangerStatus.js | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/www/tape/ChangerStatus.js b/www/tape/ChangerStatus.js
index 8e5ee900..aae13e43 100644
--- a/www/tape/ChangerStatus.js
+++ b/www/tape/ChangerStatus.js
@@ -395,12 +395,31 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
 	    }).show();
 	},
 
+	scheduleReload: function(time) {
+	    let me = this;
+	    if (me.reloadTimeout === undefined) {
+		me.reloadTimeout = setTimeout(function() {
+		    me.reload();
+		}, time);
+	    }
+	},
+
 	reload: function() {
-	    this.reload_full(true);
+	    let me = this;
+	    if (me.reloadTimeout !== undefined) {
+		clearTimeout(me.reloadTimeout);
+		me.reloadTimeout = undefined;
+	    }
+	    me.reload_full(true);
 	},
 
 	reload_no_cache: function() {
-	    this.reload_full(false);
+	    let me = this;
+	    if (me.reloadTimeout !== undefined) {
+		clearTimeout(me.reloadTimeout);
+		me.reloadTimeout = undefined;
+	    }
+	    me.reload_full(false);
 	},
 
 	reload_full: async function(use_cache) {
@@ -496,6 +515,8 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
 		}
 		Proxmox.Utils.setErrorMask(me.lookup('content'), err.toString());
 	    }
+
+	    me.scheduleReload(5000);
 	},
 
 	renderIsLabeled: function(value, mD, record) {
-- 
2.20.1






More information about the pbs-devel mailing list