Skip to content

Commit

Permalink
Merge pull request #379 from ZitaNemeckova/add_missing_group_trees
Browse files Browse the repository at this point in the history
Fix creation of trees for new group
  • Loading branch information
mzazrivec committed Feb 16, 2017
2 parents 86c193c + e690110 commit 11d090f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
3 changes: 1 addition & 2 deletions app/controllers/ops_controller.rb
Expand Up @@ -349,9 +349,8 @@ def set_active_tab(nodetype)
end
when :rbac_tree
@sb[:active_tab] = "rbac_details"

# default to the first tab in group detail
@sb[:active_rbac_group_tab] ||= "rbac_customer_tags" if node[0] == 'g'
@sb[:active_rbac_group_tab] ||= "rbac_customer_tags" if node.last == 'g'
when :diagnostics_tree
case node[0]
when "root"
Expand Down
22 changes: 12 additions & 10 deletions app/controllers/ops_controller/ops_rbac.rb
Expand Up @@ -908,18 +908,20 @@ def rbac_tenant_get_details(id)

def rbac_group_get_details(id)
@record = @group = MiqGroup.find_by_id(from_cid(id))
get_tagdata(@group)
# Build the belongsto filters hash
@belongsto = {}
@group.get_belongsto_filters.each do |b| # Go thru the belongsto tags
bobj = MiqFilter.belongsto2object(b) # Convert to an object
next unless bobj
@belongsto[bobj.class.to_s + "_" + bobj.id.to_s] = b # Store in hash as <class>_<id> string
end
@filters = {}
# Build the managed filters hash
[@group.get_managed_filters].flatten.each do |f|
@filters[f.split("/")[-2] + "-" + f.split("/")[-1]] = f
if @record.present?
get_tagdata(@group)
# Build the belongsto filters hash
@group.get_belongsto_filters.each do |b| # Go thru the belongsto tags
bobj = MiqFilter.belongsto2object(b) # Convert to an object
next unless bobj
@belongsto[bobj.class.to_s + "_" + bobj.id.to_s] = b # Store in hash as <class>_<id> string
end
# Build the managed filters hash
[@group.get_managed_filters].flatten.each do |f|
@filters[f.split("/")[-2] + "-" + f.split("/")[-1]] = f
end
end

rbac_group_right_tree(@belongsto.keys)
Expand Down
2 changes: 1 addition & 1 deletion app/presenters/tree_builder_belongs_to_hac.rb
Expand Up @@ -36,7 +36,7 @@ def tree_init_options(_tree_name)
def set_locals_for_render
locals = super
locals.merge!(:id_prefix => 'hac_',
:check_url => "/ops/rbac_group_field_changed/#{@group.id || "new"}___",
:check_url => "/ops/rbac_group_field_changed/#{@group.present? ? @group.id : "new"}___",
:oncheck => @edit ? "miqOnCheckUserFilters" : nil,
:checkboxes => true,
:highlight_changes => true,
Expand Down
2 changes: 1 addition & 1 deletion app/presenters/tree_builder_tags.rb
Expand Up @@ -35,7 +35,7 @@ def selected_entry_value(category, entry)
def set_locals_for_render
locals = super
locals.merge!(:id_prefix => 'tags_',
:check_url => "/ops/rbac_group_field_changed/#{@group.id || "new"}___",
:check_url => "/ops/rbac_group_field_changed/#{@group.present? ? @group.id : "new"}___",
:oncheck => @edit.nil? ? nil : "miqOnCheckUserFilters",
:checkboxes => true,
:highlight_changes => true,
Expand Down

0 comments on commit 11d090f

Please sign in to comment.