I was asked to look at 744081, in which Monitor > Instances would "blink" when an instance was stopped. This was rather baffling, and what I found out (from this very old, but still applicable bug) is that Backbone would automatically fetch _all_ images to update the instance list with, even when a filter was selected. (And a filter is selected by default -- "Non-stopped instances".) So the instance would correctly disappear from the list when stopped, but then incorrectly re-appear in the list on the next Backbone update.
As luck would have it, Imre made some unrelated changes to Backbone's treatment of filter lists that were committed this morning. This was incredibly fortunate because it just happened to be the perfect base for me to build on top of, so cheers for that!
Please note that I would rank my Backbone / jQuery / JavaScript skills as relatively marginal, so whoever reviews this patch may want to be a little more careful than usual in scrutinizing the changes I made.
-- Matt
If the filter isn't changed, it won't be in the URL, so we need to read the form element's value and use that.
This should resolve https://bugzilla.redhat.com/show_bug.cgi?id=744081 --- src/public/javascripts/backbone/views.js | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/public/javascripts/backbone/views.js b/src/public/javascripts/backbone/views.js index 0f38e18..0936532 100644 --- a/src/public/javascripts/backbone/views.js +++ b/src/public/javascripts/backbone/views.js @@ -64,6 +64,14 @@ Conductor.Views.PoolsIndex = Backbone.View.extend({ } }; }); + // If there is no URL param for the preset filter, we still need to merge in the preset filter + var filter = this.currentTab() + '_preset_filter'; + if(result[filter] == undefined) { + var filter_selector = '#' + filter + ':enabled'; + if($(filter_selector).val() != undefined) { + result[filter] = $(filter_selector).val(); + } + };
return result; },
On 01/05/2012 08:37 PM, Matt Wagner wrote:
If the filter isn't changed, it won't be in the URL, so we need to read the form element's value and use that.
This should resolve https://bugzilla.redhat.com/show_bug.cgi?id=744081
src/public/javascripts/backbone/views.js | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/public/javascripts/backbone/views.js b/src/public/javascripts/backbone/views.js index 0f38e18..0936532 100644 --- a/src/public/javascripts/backbone/views.js +++ b/src/public/javascripts/backbone/views.js @@ -64,6 +64,14 @@ Conductor.Views.PoolsIndex = Backbone.View.extend({ } }; });
// If there is no URL param for the preset filter, we still need to merge in the preset filter
var filter = this.currentTab() + '_preset_filter';
if(result[filter] == undefined) {
var filter_selector = '#' + filter + ':enabled';
if($(filter_selector).val() != undefined) {
result[filter] = $(filter_selector).val();
}
};
return result; },
ACK ;)
aeolus-devel@lists.fedorahosted.org