app/presenters/tree_builder_alert_profile_assign.rb
class TreeBuilderAlertProfileAssign < TreeBuilder
def initialize(name, sandbox, build, **params)
@selected_nodes = params[:selected_nodes]
# need to remove tree info
TreeState.new(sandbox).remove_tree(name)
super(name, sandbox, build)
end
def x_get_tree_roots
roots = ExtManagementSystem.assignable.each_with_object({}) do |ems, nodes|
subtree = ems.children.flat_map(&:folders).each_with_object({}) do |folder, obj|
obj.merge!(folder.subtree_arranged(:of_type => self.class::ANCESTRY_TYPE.name))
end
nodes.merge!(ems => subtree) if subtree.any?
end
count_only_or_objects(false, roots)
end
def tree_init_options
{
:full_ids => true,
:checkboxes => true,
:oncheck => "miqOnCheckGeneric",
:check_url => "/miq_alert_set/alert_profile_assign_changed/"
}
end
end