<commit_before>class TreeBuilderStoragePod < TreeBuilder
  private

  def tree_init_options(_tree_name)
    {:leaf => "Storage"}
  end

  def set_locals_for_render
    locals = super
    locals.merge!(:autoload => true)
  end

  def root_options
    [t = _("All Datastore Clusters"), t]
  end

  # Get root nodes count/array for explorer tree
  def x_get_tree_roots(count_only, _options)
    objects = []
    items = EmsFolder.where(:type => 'StorageCluster')
    items.each do |item|
      objects.push(:id            => item[:id],
                   :tree          => "dsc_tree",
                   :text          => item[:name],
                   :image         => "folder",
                   :tip           => item[:description],
                   :load_children => true)
    end
    count_only_or_objects(count_only, objects)
  end

  def x_get_tree_custom_kids(object, count_only, type)
    objects = []
    dsc = EmsFolder.where(:id => object[:id])
    if(dsc.size > 0)
      objects = dsc.first.storages
    end
    count_only_or_objects(count_only, objects, "name")
  end
end<commit_msg>Tree Builder: Storages - don't download objects<commit_after>class TreeBuilderStoragePod < TreeBuilder
  private

  def tree_init_options(_tree_name)
    {:leaf => "Storage"}
  end

  def set_locals_for_render
    locals = super
    locals.merge!(:autoload => true)
  end

  def root_options
    [t = _("All Datastore Clusters"), t]
  end

  # Get root nodes count/array for explorer tree
  def x_get_tree_roots(count_only, _options)
    items = EmsFolder.where(:type => 'StorageCluster')
    if count_only
      items.size
    else
      items.map do |item|
        {
          :id            => item[:id],
          :tree          => "dsc_tree",
          :text          => item[:name],
          :image         => "folder",
          :tip           => item[:description],
          :load_children => true
        }
      end
    end
  end

  def x_get_tree_custom_kids(object, count_only, type)
    objects = EmsFolder.find_by(:id => object[:id]).try!(:storages)
    count_only_or_objects(count_only, objects || [], "name")
  end
end
{'fraction_non_alphanumeric': 0.11147540983606558, 'fraction_numerical': 0.000468384074941452, 'mean_word_length': 2.2412746585735963, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1999788', 'n_tokens_mistral': 688, 'n_tokens_neox': 668, 'n_words': 150}