ui: tape/ChangerStatus: handle vanishing view during reload
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@proxmox.com>
This commit is contained in:
parent
7eefd0c3d7
commit
9896a75caf
|
@ -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: [
|
||||
|
|
Loading…
Reference in New Issue