ext6migrate: fix store load race condition

when we click on a node/container/vm and quickly
click on something else, there might be a race condition,
where the store finished loading and we try to change
dom elements, which are not there anymore

so we change the store.on to me.mon, which
deletes the handler when the component is gone

in the logview panel we use API2Request, where
we cannot do this, so we check if the component
is destroyed manually

also we change this whenever we change a dom element
in a callback

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2016-03-14 13:41:22 +01:00 committed by Dietmar Maurer
parent 27ea3c5981
commit f2a6ce6cf1
7 changed files with 11 additions and 10 deletions

View File

@ -76,7 +76,7 @@ Ext.define('PVE.dc.NodeView', {
me.callParent();
rstore.on('load', function(s, records, success) {
me.mon(rstore,'load', function(s, records, success) {
if (!success) {
return;
}

View File

@ -240,7 +240,7 @@ Ext.define('PVE.form.ComboGrid', {
me.createPicker();
}
me.store.on('beforeload', function() {
me.mon(me.store, 'beforeload', function() {
if (!me.isDisabled()) {
me.setDisabled(true);
me.enableAfterLoad = true;
@ -248,7 +248,7 @@ Ext.define('PVE.form.ComboGrid', {
});
// hack: autoSelect does not work
me.store.on('load', function(store, r, success, o) {
me.mon(me.store, 'load', function(store, r, success, o) {
if (success) {
me.clearInvalid();

View File

@ -205,7 +205,7 @@ Ext.define('PVE.lxc.Config', {
me.callParent();
me.statusStore.on('load', function(s, records, success) {
me.mon(me.statusStore,'load', function(s, records, success) {
var status;
if (!success) {
me.workspace.checkVmMigration(me.pveSelNode);

View File

@ -217,7 +217,7 @@ Ext.define('PVE.node.Config', {
me.callParent();
me.statusStore.on('load', function(s, records, success) {
me.mon(me.statusStore,'load', function(s, records, success) {
var uptimerec = s.data.get('uptime');
var powermgmt = uptimerec ? uptimerec.data.value : false;
if (!caps.nodes['Sys.PowerMgmt']) {

View File

@ -41,6 +41,10 @@ Ext.define('PVE.panel.LogView', {
var me = this;
var el = me.dataCmp.el;
if (me.destroyed) { // return if element is not there anymore
return;
}
if (me.viewInfo && me.viewInfo.start === start &&
me.viewInfo.end === end && me.viewInfo.total === total &&
me.viewInfo.textLength === text.length) {

View File

@ -218,7 +218,7 @@ Ext.define('PVE.qemu.Config', {
*/
me.callParent();
me.statusStore.on('load', function(s, records, success) {
me.mon(me.statusStore,'load', function(s, records, success) {
var status;
var qmpstatus;
var spice = false;

View File

@ -511,10 +511,7 @@ Ext.define('PVE.storage.ContentView', {
// disable the buttons/restrict the upload window
// if templates or uploads are not allowed
me.statusStore.on('load', function(s,records,succes) {
if (me.destroyed) { // if the element is not there anymore, do nothing
return;
}
me.mon(me.statusStore,'load', function(s,records,succes) {
var availcontent = [];
Ext.Array.each(records, function(item){
if (item.id === 'content') {