Skip to content

Commit

Permalink
Highlight selected server in the server_by_role tree
Browse files Browse the repository at this point in the history
  • Loading branch information
lgalis committed Mar 14, 2018
1 parent a7d0ea1 commit 9e7e5c7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/presenters/tree_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def build_tree
# Subclass this method if active node on initial load is different than root node.
def active_node_set(tree_nodes)
@tree_state.x_node_set(tree_nodes.first[:key], @name) unless @tree_state.x_node(@name)
@tree_state.x_node(@name)
end

def set_nodes(nodes)
Expand Down
19 changes: 19 additions & 0 deletions app/presenters/tree_builder_roles_by_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,29 @@ class TreeBuilderRolesByServer < TreeBuilderDiagnostics

private

def tree_init_options(_tree_name)
{:add_root => false,
:expand => true,
:lazy => false,
:open_all => true,
:activate_silently => true
}
end

def x_get_tree_roots(_count_only, _options)
x_get_tree_miq_servers
end

def override(node, object, _pid, options)
if (@sb[:diag_selected_id] && node[:key] == "svr-#{@sb[:diag_selected_id]}")
node[:highlighted] = true
end
end

def active_node_set(tree_nodes)
@tree_state.x_node_set(tree_nodes.first[:key], @name) unless @tree_state.x_node(@name)
end

def x_get_tree_miq_servers
@root.miq_servers.sort_by { |s| s.name.to_s }.each_with_object([]) do |server, objects|
unless @sb[:diag_selected_id] # Set default selected record vars
Expand Down

0 comments on commit 9e7e5c7

Please sign in to comment.