Skip to content

Commit

Permalink
Merge pull request #2439 from ZitaNemeckova/add_missing_load_dialog_r…
Browse files Browse the repository at this point in the history
…outes

Fix custom button with dialog
  • Loading branch information
mzazrivec authored Oct 25, 2017
2 parents 4d6210b + 461ae3e commit bc43673
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 35 deletions.
3 changes: 1 addition & 2 deletions app/controllers/application_controller/dialog_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,9 @@ def dialog_field_changed
def dialog_load
@edit = session[:edit]
@record = Dialog.find_by_id(@edit[:rec_id])
@dialog_prov = true
@in_a_form = true
@showtype = "dialog_provision"
render :action => "show"
render :template => "shared/dialogs/dialog_provision"
end

def dynamic_radio_button_refresh
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/cloud_subnet_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ def button
delete_subnets
when "cloud_subnet_edit"
javascript_redirect :action => "edit", :id => checked_item_id
when params[:pressed] == "custom_button"
when "custom_button"
custom_buttons
return
else
if params[:pressed] == "cloud_subnet_new"
javascript_redirect :action => "new"
Expand Down
10 changes: 9 additions & 1 deletion app/controllers/infra_networking_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ def tagging
render_tagging_form
end

def button
if params[:pressed] == "custom_button"
custom_buttons
end
end

private

def textual_group_list
Expand Down Expand Up @@ -568,7 +574,9 @@ def rebuild_toolbars(record_showing, presenter)

h_tb = build_toolbar("x_history_tb") unless @in_a_form

presenter.reload_toolbars(:history => h_tb, :center => c_tb, :view => v_tb)
cb_tb = build_toolbar(Mixins::CustomButtons::Result.new(@nodetype == 'sw' ? :single : :list))

presenter.reload_toolbars(:history => h_tb, :center => c_tb, :view => v_tb, :custom => cb_tb)

presenter.set_visibility(h_tb.present? || c_tb.present? || v_tb.present?, :toolbar)

Expand Down
2 changes: 2 additions & 0 deletions app/controllers/network_router_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def button
javascript_redirect :action => "edit", :id => checked_item_id
elsif params[:pressed] == "network_router_new"
javascript_redirect :action => "new"
elsif params[:pressed] == "custom_button"
custom_buttons
elsif params[:pressed] == "network_router_add_interface"
javascript_redirect :action => "add_interface_select", :id => checked_item_id
elsif params[:pressed] == "network_router_remove_interface"
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/security_group_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ def button
delete_security_groups
when "security_group_edit"
javascript_redirect :action => "edit", :id => checked_item_id(params)
when params[:pressed] == "custom_button"
when "custom_button"
custom_buttons
return
else
if params[:pressed] == "security_group_new"
javascript_redirect :action => "new"
Expand Down
2 changes: 0 additions & 2 deletions app/views/ems_cluster/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
= render :partial => "layouts/item"
- when "timeline"
= render(:partial => "layouts/tl_show_async")
- when "dialog_provision"
= render(:partial => "shared/dialogs/dialog_provision")
- when "main"
= render :partial => "layouts/textual_groups_generic"
- when "config"
Expand Down
2 changes: 0 additions & 2 deletions app/views/host/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
= render :partial => "layouts/performance_summary"
- when "timeline"
= render :partial => "layouts/tl_show_async"
- when "dialog_provision"
= render :partial => "shared/dialogs/dialog_provision"
- when "compliance_history"
= render :partial => "shared/views/compliance_history"
- when "main"
Expand Down
3 changes: 3 additions & 0 deletions app/views/shared/dialogs/dialog_provision.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#main_div
= render :partial => "shared/dialogs/dialog_provision"

2 changes: 0 additions & 2 deletions app/views/shared/views/ems_common/_show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
= render :partial => "layouts/tl_show_async"
- elsif @showtype == "performance"
= render(:partial => "layouts/performance_async")
- elsif @showtype == "dialog_provision"
= render :partial => "shared/dialogs/dialog_provision"
- elsif @showtype == "config"
= render :partial => "shared/views/ems_common/config"
- elsif @showtype == 'main'
Expand Down
6 changes: 1 addition & 5 deletions app/views/storage/show.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#main_div
- if @dialog_prov
= render :partial => "shared/dialogs/dialog_provision"
- elsif %w(all_vms hosts miq_proxies all_miq_templates storage_extents storage_systems).include?(@display) && @showtype != "compare"
- if %w(all_vms hosts miq_proxies all_miq_templates storage_extents storage_systems).include?(@display) && @showtype != "compare"
= render :partial => "layouts/x_gtl", :locals => {:action_url => "show/#{@record.id}"}
- else
- case @showtype
Expand All @@ -11,7 +9,5 @@
= render :partial => "layouts/item"
- when "performance"
= render :partial => "layouts/performance_async"
- when "dialog_provision"
= render :partial => "shared/dialogs/dialog_provision"
- when "main"
= render :partial => "layouts/textual_groups_generic"
44 changes: 27 additions & 17 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
tag_edit_form_field_changed
tl_chooser
wait_for_task
) + adv_search_post + compare_post + exp_post + perf_post + save_post
) + adv_search_post + compare_post + exp_post + perf_post + save_post + dialog_runner_post
},

:host_aggregate => {
Expand Down Expand Up @@ -425,12 +425,13 @@
tag_edit_form_field_changed
create
wait_for_task
) + compare_post + adv_search_post + exp_post + save_post
) + compare_post + adv_search_post + exp_post + save_post + dialog_runner_post
},

:cloud_tenant => {
:get => %w(
cloud_tenant_form_fields
dialog_load
download_data
download_summary_pdf
edit
Expand All @@ -456,7 +457,7 @@
update
wait_for_task
) +
compare_post + adv_search_post + exp_post + save_post
compare_post + adv_search_post + exp_post + save_post + dialog_runner_post
},

:cloud_object_store_object => {
Expand All @@ -483,7 +484,7 @@
tagging_edit
tag_edit_form_field_changed
update
) + compare_post + adv_search_post + exp_post + save_post
) + compare_post + adv_search_post + exp_post
},

:cloud_volume => {
Expand Down Expand Up @@ -524,7 +525,7 @@
tag_edit_form_field_changed
update
wait_for_task
) + compare_post + adv_search_post + exp_post + save_post
) + compare_post + adv_search_post + exp_post + save_post + dialog_runner_post
},

:cloud_volume_snapshot => {
Expand Down Expand Up @@ -678,7 +679,8 @@
adv_search_post +
exp_post +
perf_post +
save_post
save_post +
dialog_runner_post
},

:container_node => {
Expand Down Expand Up @@ -793,7 +795,7 @@
openscap_rule_results
protect
squash_toggle
) + adv_search_post + exp_post + save_post
) + adv_search_post + exp_post + save_post + dialog_runner_post
},

:container_image_registry => {
Expand Down Expand Up @@ -891,7 +893,8 @@
adv_search_post +
exp_post +
perf_post +
save_post
save_post +
dialog_runner_post
},

:container_route => {
Expand Down Expand Up @@ -948,7 +951,7 @@
update
tagging_edit
tag_edit_form_field_changed
) + adv_search_post + exp_post + save_post
) + adv_search_post + exp_post + save_post + dialog_runner_post
},

:container_build => {
Expand Down Expand Up @@ -1004,7 +1007,7 @@
show_list
tagging_edit
tag_edit_form_field_changed
) + adv_search_post + exp_post + save_post
) + adv_search_post + exp_post + save_post + dialog_runner_post
},

:container_topology => {
Expand Down Expand Up @@ -1732,7 +1735,8 @@
adv_search_post +
compare_post +
save_post +
exp_post
exp_post +
dialog_runner_post
},

:floating_ip => {
Expand Down Expand Up @@ -1801,7 +1805,8 @@
adv_search_post +
compare_post +
save_post +
exp_post
exp_post +
dialog_runner_post
},

:cloud_network => {
Expand Down Expand Up @@ -1834,7 +1839,8 @@
adv_search_post +
compare_post +
save_post +
exp_post
exp_post +
dialog_runner_post
},

:network_port => {
Expand Down Expand Up @@ -1906,7 +1912,8 @@
adv_search_post +
compare_post +
save_post +
exp_post
exp_post +
dialog_runner_post
},

:load_balancer => {
Expand All @@ -1932,7 +1939,8 @@
adv_search_post +
compare_post +
save_post +
exp_post
exp_post +
dialog_runner_post
},

:flavor => {
Expand Down Expand Up @@ -2075,7 +2083,8 @@
adv_search_post +
exp_post +
save_post +
x_post
x_post +
dialog_runner_post
},

:generic_object => {
Expand Down Expand Up @@ -2761,7 +2770,8 @@
) +
adv_search_post +
exp_post +
save_post
save_post +
dialog_runner_post
},

:provider_foreman => {
Expand Down

0 comments on commit bc43673

Please sign in to comment.