Skip to content

Commit

Permalink
Allow custom buttons to ContainerNode, MiqGroup, User, Tenant
Browse files Browse the repository at this point in the history
  • Loading branch information
ZitaNemeckova committed Oct 13, 2017
1 parent 1a325c4 commit 321bd65
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/controllers/container_node_controller.rb
Expand Up @@ -42,4 +42,6 @@ def self.custom_display_modes
end

menu_section :cnt

has_custom_buttons
end
2 changes: 2 additions & 0 deletions app/controllers/mixins/custom_buttons.rb
Expand Up @@ -13,6 +13,8 @@ def custom_toolbar_explorer
Mixins::CustomButtons::Result.new(:single)
elsif @lastaction == "show_list"
Mixins::CustomButtons::Result.new(:list)
elsif x_tree[:tree] == :rbac_tree
@lastaction == "show_list" ? Mixins::CustomButtons::Result.new(:list) : Mixins::CustomButtons::Result.new(:single)
else
'blank_view_tb'
end
Expand Down
11 changes: 10 additions & 1 deletion app/controllers/ops_controller.rb
Expand Up @@ -17,6 +17,7 @@ def index
OPS_X_BUTTON_ALLOWED_ACTIONS = {
'collect_logs' => :logs_collect,
'collect_current_logs' => :collect_current_logs,
'custom_button' => :custom_buttons,
'db_refresh' => :db_refresh,
'delete_server' => :delete_server,
'demote_server' => :demote_server,
Expand Down Expand Up @@ -740,9 +741,15 @@ def extra_js_commands(presenter)
} if @ajax_action
end

def choose_custom_toolbar
if x_tree && x_tree[:tree] == :rbac_tree && x_node != 'root'
build_toolbar(@record ? Mixins::CustomButtons::Result.new(:single) : Mixins::CustomButtons::Result.new(:list))
end
end

def rebuild_toolbars(presenter)
c_tb = build_toolbar(center_toolbar_filename) unless @in_a_form
presenter.reload_toolbars(:center => c_tb)
presenter.reload_toolbars(:center => c_tb, :custom => choose_custom_toolbar)
presenter[:record_id] = determine_record_id_for_presenter
end

Expand Down Expand Up @@ -818,4 +825,6 @@ def get_session_data
end

menu_section :set

has_custom_buttons
end

0 comments on commit 321bd65

Please sign in to comment.