diff --git a/dist/script/index_cache.js b/dist/script/index_cache.js index 925aea7..229ec84 100644 --- a/dist/script/index_cache.js +++ b/dist/script/index_cache.js @@ -144,7 +144,10 @@ XenClient.UI.Cache = (function() { device.refresh(); } } - XUtils.publish(XenConstants.TopicTypes.UI_BATTERIES_CHANGED); + if(bat_count>-1) + {// do not refresh the batteries if there are none, may be in the midst of a refresh + XUtils.publish(XenConstants.TopicTypes.UI_BATTERIES_CHANGED); + } }; var allVMPaths = function() { diff --git a/dist/script/models/batteryModel.js b/dist/script/models/batteryModel.js index 1320a38..1a50ff8 100644 --- a/dist/script/models/batteryModel.js +++ b/dist/script/models/batteryModel.js @@ -197,7 +197,10 @@ XenClient.UI.BatteryModel = function(bat_num) { this.bat_index = XUICache.Host.available_batteries.indexOf(this.bat_num); var error = function(error) { - XUICache.messageBox.showError(error, XenConstants.ToolstackCodes); + if(this.bat_num!=undefined) + {// suppress errors if the batteries are in the midst of being refreshed + XUICache.messageBox.showError(error, XenConstants.ToolstackCodes); + } }; var self=this;