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

Add physical server buttons when displaying through ems_physical_infra #2409

Merged
merged 2 commits into from
Oct 17, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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') && [email protected]_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