app/controllers/configuration_controller.rb
# Build the default filters tree for the search views
Build the default filters tree for the search views
Build the default filters tree for the search views
def build_default_filters_tree(all_def_searches)
    all_views = []                                   
    all_def_searches.collect do |search|  
      folder_nodes = NAV_TAB_PATH[search[:db].downcase.to_sym]
      add_main_tab_node(folder_nodes, search.id) if @main_tab.nil? || @main_tab != folder_nodes[0]
      add_sub_tab_node(folder_nodes, search.id)  if @sub_tab.blank? || @sub_tab != folder_nodes[1]
      add_ci_tab_node(folder_nodes, search.id)   if folder_nodes.length == 3 &&
                                                    (@ci_tab.blank? || @ci_tab != folder_nodes[2])
      if folder_nodes.length == 2 && (!@sub_tab.blank? || @sub_tab == folder_nodes[1])
        node = build_filter_node(search)
        @sub_tab_children.push(node) unless @sub_tab_children.include?(node)
      elsif folder_nodes.length == 3 && (!@ci_tab.blank? || @ci_tab == folder_nodes[2])
        node = build_filter_node(search)
        @search_filter_nodes.push(node) unless @search_filter_nodes.include?(node)
      end
      @ci_tab_node[:children]   = @search_filter_nodes unless @search_filter_nodes.blank?
      @sub_tab_node[:children]  = @sub_tab_children    unless @sub_tab_children.blank?
      @main_tab_node[:children] = @main_tab_children   unless @main_tab_children.blank?
      all_views.push(@main_tab_node).uniq!
    end
    @all_views_tree = all_views.to_json
    session[:tree_name]    = "all_views_tree"
  end
def build_default_filters_tree ( all_def_searches ) all_views = [ ] all_def_searches . collect do | search | folder_nodes = NAV_TAB_PATH [ search [ :db ] . downcase . to_sym ] add_main_tab_node ( folder_nodes , search . id ) if @main_tab . nil? || @main_tab != folder_nodes [ 0 ] add_sub_tab_node ( folder_nodes , search . id ) if @sub_tab . blank? || @sub_tab != folder_nodes [ 1 ] add_ci_tab_node ( folder_nodes , search . id ) if folder_nodes . length == 3 && ( @ci_tab . blank? || @ci_tab != folder_nodes [ 2 ] ) if folder_nodes . length == 2 && ( ! @sub_tab . blank? || @sub_tab == folder_nodes [ 1 ] ) node = build_filter_node ( search ) @sub_tab_children . push ( node ) unless @sub_tab_children . include? ( node ) elsif folder_nodes . length == 3 && ( ! @ci_tab . blank? || @ci_tab == folder_nodes [ 2 ] ) node = build_filter_node ( search ) @search_filter_nodes . push ( node ) unless @search_filter_nodes . include? ( node ) end @ci_tab_node [ :children ] = @search_filter_nodes unless @search_filter_nodes . blank? @sub_tab_node [ :children ] = @sub_tab_children unless @sub_tab_children . blank? @main_tab_node [ :children ] = @main_tab_children unless @main_tab_children . blank? all_views . push ( @main_tab_node ) . uniq! end @all_views_tree = all_views . to_json session [ :tree_name ] = "all_views_tree" end
Build the default filters tree for the search views
Build the default filters tree for the search views
# Array to hold all CIs # Go thru all of the Searches # check if this is last folder node, add filters
all_def_searches
<not_specific>