[pbs-devel] [PATCH proxmox-backup 5/5] ui: tape/ChangerStatus: handle vanishing view during reload
Dominik Csapak
d.csapak at proxmox.com
Mon Mar 1 12:22:43 CET 2021
since reload is an async function, the view can be destroyed during
any 'await' point. Subsequent accesses to the view will fail, and we
will land in the catch. Check there if the view is destroyed, and
do not raise an error with the user then
also cancel any outstanding timer on 'deactivate' and 'destroy'
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
www/tape/ChangerStatus.js | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/www/tape/ChangerStatus.js b/www/tape/ChangerStatus.js
index dab34038..04422936 100644
--- a/www/tape/ChangerStatus.js
+++ b/www/tape/ChangerStatus.js
@@ -285,12 +285,17 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
}
},
- reload: function() {
+ cancelReload: function() {
let me = this;
if (me.reloadTimeout !== undefined) {
clearTimeout(me.reloadTimeout);
me.reloadTimeout = undefined;
}
+ },
+
+ reload: function() {
+ let me = this;
+ me.cancelReload();
me.reload_full(true);
},
@@ -398,6 +403,10 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
}
Proxmox.Utils.setErrorMask(me.lookup('content'));
} catch (err) {
+ if (!view || view.isDestroyed) {
+ return;
+ }
+
if (!use_cache) {
Proxmox.Utils.setErrorMask(view);
}
@@ -470,11 +479,13 @@ Ext.define('PBS.TapeManagement.ChangerStatus', {
}
view.title = `${gettext("Changer")}: ${view.changer}`;
+ me.reload();
},
},
listeners: {
- activate: 'reload',
+ deactivate: 'cancelReload',
+ destroy: 'cancelReload',
},
tbar: [
--
2.20.1
More information about the pbs-devel
mailing list