diff --git a/src/sunstone/public/js/plugins/groups-tab.js b/src/sunstone/public/js/plugins/groups-tab.js index 438774cff0..5e042a5b4e 100644 --- a/src/sunstone/public/js/plugins/groups-tab.js +++ b/src/sunstone/public/js/plugins/groups-tab.js @@ -732,7 +732,7 @@ function updateGroupInfo(request,group){ } -function setup_group_resource_tab_content(zone_section, str_zone_tab_id, str_datatable_id) { +function setup_group_resource_tab_content(zone_id, zone_section, str_zone_tab_id, str_datatable_id) { // Show the clusters dataTable when the radio button is selected $("input[name='"+str_zone_tab_id+"']", zone_section).change(function(){ if ($("input[name='"+str_zone_tab_id+"']:checked").val() == "cluster") { @@ -773,7 +773,7 @@ function setup_group_resource_tab_content(zone_section, str_zone_tab_id, str_dat var cluster_id = aData[1]; - if ($.isEmptyObject(selected_group_clusters)) { + if ($.isEmptyObject(selected_group_clusters[zone_id])) { $('#you_selected_group_clusters'+str_zone_tab_id, zone_section).show(); $("select_group_clusters"+str_zone_tab_id, zone_section).hide(); } @@ -781,8 +781,8 @@ function setup_group_resource_tab_content(zone_section, str_zone_tab_id, str_dat if(!$("td:first", this).hasClass('markrowchecked')) { $('input.check_item', this).attr('checked','checked'); - selected_group_clusters[cluster_id]=1; - group_clusters_row_hash[cluster_id]=this; + selected_group_clusters[zone_id][cluster_id] = 1; + group_clusters_row_hash[zone_id][cluster_id] = this; $(this).children().each(function(){$(this).addClass('markrowchecked');}); if ($('#tag_cluster_'+aData[1], $('div#selected_group_clusters', zone_section)).length == 0 ) { $('div#selected_group_clusters', zone_section).append(''+aData[2]+' '); @@ -791,12 +791,12 @@ function setup_group_resource_tab_content(zone_section, str_zone_tab_id, str_dat else { $('input.check_item', this).removeAttr('checked'); - delete selected_group_clusters[cluster_id]; + delete selected_group_clusters[zone_id][cluster_id]; $(this).children().each(function(){$(this).removeClass('markrowchecked');}); $('div#selected_group_clusters span#tag_cluster_'+cluster_id, zone_section).remove(); } - if ($.isEmptyObject(selected_group_clusters)) { + if ($.isEmptyObject(selected_group_clusters[zone_id])) { $('#you_selected_group_clusters'+str_zone_tab_id, zone_section).hide(); $('#select_group_clusters'+str_zone_tab_id, zone_section).show(); } @@ -811,11 +811,11 @@ function setup_group_resource_tab_content(zone_section, str_zone_tab_id, str_dat var id = $(this).parent().attr("ID"); var cluster_id=id.substring(12,id.length); - delete selected_group_clusters[cluster_id]; - $('td', group_clusters_row_hash[cluster_id]).removeClass('markrowchecked'); - $('input.check_item', group_clusters_row_hash[cluster_id]).removeAttr('checked'); + delete selected_group_clusters[zone_id][cluster_id]; + $('td', group_clusters_row_hash[zone_id][cluster_id]).removeClass('markrowchecked'); + $('input.check_item', group_clusters_row_hash[zone_id][cluster_id]).removeAttr('checked'); - if ($.isEmptyObject(selected_group_clusters)) { + if ($.isEmptyObject(selected_group_clusters[zone_id])) { $('#you_selected_group_clusters'+str_zone_tab_id, zone_section).hide(); $('#select_group_clusters'+str_zone_tab_id, zone_section).show(); } @@ -909,10 +909,13 @@ function update_datatable_group_clusters(datatable, fnDrawCallback) { var selected_group_clusters = {}; var group_clusters_row_hash = {}; -var add_resource_tab = function(zone_id, dialog) { +var add_resource_tab = function(zone_id, zone_name, dialog) { var str_zone_tab_id = 'zone' + zone_id; var str_datatable_id = 'datatable_group_clusters_zone' + zone_id; + selected_group_clusters[zone_id] = {}; + group_clusters_row_hash[zone_id] = {}; + // Append the new div containing the tab and add the tab to the list var html_tab_content = '