Fix opening multiple Launch Instance during jQuery table polling

Achieve this by limiting widget area to be recompiled to table/tab.

Change-Id: Icbbe2be833fccf17ba272ca920960393c9c3b667
Closes-Bug: #1561501
Closes-Bug: #1559105
This commit is contained in:
Timur Sufiev 2016-03-24 16:21:21 +03:00 committed by David Lyle
parent 8ad7d1fb01
commit 19b6a657ef
3 changed files with 10 additions and 8 deletions

View File

@ -77,14 +77,16 @@
function run($window, $rootScope) {
$window.recompileAngularContent = recompileAngularContent;
function recompileAngularContent() {
var body = angular.element('body');
function recompileAngularContent($element) {
function explicit($compile) {
$compile(body)($rootScope);
// NOTE(tsufiev): recompiling elements with ng-click directive spawns
// a new 'click' handler even if there were some, so we need to cleanup
// existing handlers before doing this.
$element.find('[ng-click]').off('click');
$compile($element)($rootScope);
}
explicit.$inject = ['$compile'];
body.injector().invoke(explicit);
$element.injector().invoke(explicit);
}
}

View File

@ -103,7 +103,7 @@ horizon.datatables = {
// problem with not-working angular actions in a content added
// by jQuery via replacing jQuery insert with Angular insert.
// Should address this in Newton release
recompileAngularContent();
recompileAngularContent($table);
// Reset tablesorter's data cache.
$table.trigger("update");
@ -450,7 +450,7 @@ horizon.datatables.add_no_results_row = function (table) {
// Add a "no results" row if there are no results.
var template = horizon.templates.compiled_templates["#empty_row_template"];
if (!table.find("tbody tr:visible").length && typeof(template) !== "undefined") {
var colspan = $table.find('.table_column_header th').length;
var colspan = table.find('.table_column_header th').length;
var params = {
"colspan": colspan,
no_items_label: gettext("No items to display.")

View File

@ -10,7 +10,7 @@ horizon.tabs.initTabLoad = function (tab) {
$(horizon.tabs._init_load_functions).each(function (index, f) {
f(tab);
});
recompileAngularContent();
recompileAngularContent($(tab));
};
horizon.tabs.load_tab = function () {