Skip to content

Commit

Permalink
Merge pull request #2409 from MaysaMacedo/add_ph_buttons
Browse files Browse the repository at this point in the history
Add physical server buttons when displaying through ems_physical_infra
  • Loading branch information
Dan Clarizio authored Oct 17, 2017
2 parents 3039d2b + 4833daa commit 311c2bc
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
7 changes: 6 additions & 1 deletion app/controllers/ems_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ def button
"orchestration_stack_",
"security_group_",
"storage_",
"vm_")
"vm_",
"physical_server_")

case params[:pressed]
# Clusters
Expand Down Expand Up @@ -232,6 +233,10 @@ def button
when "network_router_tag" then tag(NetworkRouter)
when "orchestration_stack_tag" then tag(OrchestrationStack)
when "security_group_tag" then tag(SecurityGroup)

when "physical_server_protect" then assign_policies(PhysicalServer)
when "physical_server_tag" then tag(PhysicalServer)

end

return if params[:pressed].include?("tag") && !%w(host_tag vm_tag miq_template_tag instance_tag).include?(params[:pressed])
Expand Down
34 changes: 34 additions & 0 deletions app/helpers/application_helper/toolbar/physical_server_center.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,38 @@ class ApplicationHelper::Toolbar::PhysicalServerCenter < ApplicationHelper::Tool
),
]
)
button_group(
'physical_server_policy',
[
select(
:physical_server_policy_choice,
'fa fa-shield fa-lg',
N_('Policy'),
:enabled => true,
:onwhen => "1+",
:items => [
button(
:physical_server_protect,
'pficon pficon-edit fa-lg',
N_('Manage Policies for the selected items'),
N_('Manage Policies'),
:url_parms => "main_div",
:send_checked => true,
:enabled => true,
:onwhen => "1+"
),
button(
:physical_server_tag,
'pficon pficon-edit fa-lg',
N_('Edit tags for the selected items'),
N_('Edit Tags'),
:url_parms => "main_div",
:send_checked => true,
:enabled => true,
:onwhen => "1+"
),
]
),
]
)
end
2 changes: 1 addition & 1 deletion app/helpers/application_helper/toolbar_chooser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ def center_toolbar_filename_classic
load_balancers network_ports network_routers orchestration_stacks resource_pools
security_groups storages middleware_deployments middleware_datasources
middleware_messagings middleware_servers)
to_display_center = %w(stack_orchestration_template topology cloud_object_store_objects generic_objects)
to_display_center = %w(stack_orchestration_template topology cloud_object_store_objects generic_objects physical_servers)
if @lastaction == 'show' && (@view || @display != 'main') && !@layout.starts_with?("miq_request")
if @display == "vms" || @display == "all_vms"
return "vm_infras_center_tb"
Expand Down
4 changes: 4 additions & 0 deletions app/views/shared/views/ems_common/_show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
- arr = (controller_name.camelize + "Controller").constantize.display_methods
- if arr.include?(@display) && @showtype != "compare"
= render :partial => "layouts/gtl", :locals => {:action_url => "show/#{@ems.id}"}
- if %w(physical_servers).include?(@display)
%physical-server-toolbar#ems_physical_infra_show_list_form
:javascript
miq_bootstrap('#ems_physical_infra_show_list_form')
- elsif @showtype == "details"
= render(:partial => "layouts/gtl", :locals => {:action_url => @lastaction})
- elsif @showtype == "item"
Expand Down

0 comments on commit 311c2bc

Please sign in to comment.