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

Show policy status when running policy simulation #3524

Merged
merged 1 commit into from
Mar 12, 2018
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/controllers/application_controller/policy_support.rb
Original file line number Diff line number Diff line change
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/miq_template_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def fileicon
end

def quadicon(settings = {})
show_compliance = settings[:show_compliance] && settings[:policies].present?
{
:top_left => {
:fileicon => os_image,
Expand All @@ -21,7 +22,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
3 changes: 2 additions & 1 deletion app/decorators/vm_or_template_decorator.rb
Original file line number Diff line number Diff line change
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