Skip to content

Commit

Permalink
Show policy status when running policy simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
karelhala committed Mar 7, 2018
1 parent 85ef2d8 commit fbcba37
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/controllers/application_controller/policy_support.rb
Expand Up @@ -85,6 +85,7 @@ def policy_sim(records = [])
:url => "/#{request.parameters["controller"]}/policy_sim?continue=true")
session[:policies] = {} unless params[:continue] # Clear current policies, unless continuing previous simulation
records = session[:tag_items] if records.empty? && session[:tag_items].present?
session[:tag_items] = records
policy_sim_build_screen(records)

if @explorer
Expand Down Expand Up @@ -228,7 +229,7 @@ def assigned_filters
# Build the policy simulation screen
def policy_sim_build_screen(records = [])
@edit ||= {}
@tagitems = records ? records : session[:tag_db].find(session[:tag_items]) # Get the db records that are being tagged
@tagitems = records.presence || session[:tag_items] # Get the db records that are being tagged
@tagitems = @tagitems.sort_by(&:name)
@edit[:pol_items] = session[:tag_items]
@catinfo = {}
Expand All @@ -248,6 +249,7 @@ def policy_sim_build_screen(records = [])
else
@all_profs["<select>"] = _("No Policy Profiles are available")
end
@gtl_type = "grid"
build_targets_hash(@tagitems)
end
end
3 changes: 2 additions & 1 deletion app/decorators/vm_or_template_decorator.rb
Expand Up @@ -12,6 +12,7 @@ def fileicon
end

def quadicon(settings = {})
show_compliance = settings[:show_compliance] && settings[:policies].present?
{
:top_left => {
:fileicon => os_image,
Expand All @@ -25,7 +26,7 @@ def quadicon(settings = {})
:fileicon => fileicon,
:tooltip => type
},
:bottom_right => settings[:show_compliance] ? compliance_image(settings[:policies]) : total_snapshots
:bottom_right => show_compliance ? compliance_image(settings[:policies].keys) : total_snapshots
}
end

Expand Down

0 comments on commit fbcba37

Please sign in to comment.