app/controllers/application_controller.rb
# Build a Catalog Items explorer tree
Build a Catalog Items explorer tree
Build a Catalog Items explorer tree
def build_ae_tree(type = :ae, name = :ae_tree)
    if x_active_tree == :automate_tree && @edit && @edit[:new][:fqname]
      nodes = @edit[:new][:fqname].split("/")
      @open_nodes = []
      nodes.each_with_index do |_node, i|
        if i == nodes.length - 1
          inst = @cls ? MiqAeInstance.find_by_class_id_and_name(@cls.id, nodes[i]) : nil
          @open_nodes.push("aei-#{inst.id}") if inst
          @active_node = "aei-#{to_cid(inst.id)}" if inst
        elsif i == nodes.length - 2
          @cls = MiqAeClass.find_by_namespace_id_and_name(@ns.id, nodes[i])
          @open_nodes.push("aec-#{to_cid(@cls.id)}") if @cls
        else
          @ns = MiqAeNamespace.find_by_name(nodes[i])
          @open_nodes.push("aen-#{to_cid(@ns.id)}") if @ns
        end
      end
    end
    tree = TreeBuilderAeClass.new(name, type, @sb)
    @automate_tree = tree.tree_nodes if name == :automate_tree
    tree
  end
def build_ae_tree ( type = :ae , name = :ae_tree ) if x_active_tree == :automate_tree && @edit && @edit [ :new ] [ :fqname ] nodes = @edit [ :new ] [ :fqname ] . split ( "/" ) @open_nodes = [ ] nodes . each_with_index do | _node , i | if i == nodes . length - 1 inst = @cls ? MiqAeInstance . find_by_class_id_and_name ( @cls . id , nodes [ i ] ) : nil @open_nodes . push ( "aei-#{inst.id}" ) if inst @active_node = "aei-#{to_cid(inst.id)}" if inst elsif i == nodes . length - 2 @cls = MiqAeClass . find_by_namespace_id_and_name ( @ns . id , nodes [ i ] ) @open_nodes . push ( "aec-#{to_cid(@cls.id)}" ) if @cls else @ns = MiqAeNamespace . find_by_name ( nodes [ i ] ) @open_nodes . push ( "aen-#{to_cid(@ns.id)}" ) if @ns end end end tree = TreeBuilderAeClass . new ( name , type , @sb ) @automate_tree = tree . tree_nodes if name == :automate_tree tree end
Build a Catalog Items explorer tree
Build a Catalog Items explorer tree
# build the ae tree to show the tree select box for entry point # if there are more than one nested namespaces # check if @cls is there, to make sure the class/instance still exists in Automate db # show this as selected/expanded node when tree loads
type
<not_specific>
name
<not_specific>