Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix creation of trees for new group #379

Merged
merged 1 commit into from Feb 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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