Skip to content

Commit

Permalink
Build the policy trees the same way as any other explorer tree
Browse files Browse the repository at this point in the history
  • Loading branch information
skateman committed Aug 22, 2017
1 parent e37cdb4 commit 953ff8b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
3 changes: 1 addition & 2 deletions app/controllers/miq_policy_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,7 @@ def explorer
self.x_active_tree ||= 'policy_profile_tree'
self.x_active_accord ||= 'policy_profile'

trees = features.collect { |feature| [feature.tree_name, feature.build_tree(@sb)] }
@trees = Hash[* trees.flatten] # trees.to_h in Ruby 2.2
@trees = features.map { |feature| feature.build_tree(@sb) }
@accords = features.map(&:accord_hash)

if params[:profile].present? # If profile record id passed in, position on that node
Expand Down
9 changes: 2 additions & 7 deletions app/views/shared/_explorer_tree.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,5 @@
-# Used instance variables:
-# @trees - all the available trees generated with TreeBuilder
- case controller.controller_name
- when 'miq_policy'
- tree = @trees["#{name}_tree".to_sym]
= render :partial => "shared/tree", :locals => {:tree => tree, :name => tree.name.to_s}
- else
- tree = @trees.length == 1 ? @trees.first : @trees.detect { |t| t.type == name.to_sym }
= render :partial => 'shared/tree', :locals => {:tree => tree, :name => tree.name.to_s}
- tree = @trees.length == 1 ? @trees.first : @trees.detect { |t| t.type == name.to_sym }
= render :partial => 'shared/tree', :locals => {:tree => tree, :name => tree.name.to_s}

0 comments on commit 953ff8b

Please sign in to comment.