Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update open_nodes when creating new element #4590

Merged
merged 2 commits into from
Sep 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions app/controllers/miq_ae_class_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,7 @@ def create_instance
AuditEvent.success(build_created_audit(add_aeinst, @edit))
add_flash(_("Automate Instance \"%{name}\" was added") % {:name => add_aeinst.name})
@in_a_form = false
add_active_node_to_open_nodes
replace_right_cell(:replace_trees => [:ae])
return
end
Expand Down Expand Up @@ -1251,6 +1252,7 @@ def create
else
add_flash(_("Automate Class \"%{name}\" was added") % {:name => add_aeclass.fqname})
@in_a_form = false
add_active_node_to_open_nodes
replace_right_cell(:replace_trees => [:ae])
end
else
Expand Down Expand Up @@ -1302,6 +1304,7 @@ def create_method
else
@changed = session[:changed] = (@edit[:new] != @edit[:current])
@sb[:form_vars_set] = false
add_active_node_to_open_nodes
replace_right_cell(:replace_trees => [:ae])
end
end
Expand All @@ -1318,6 +1321,7 @@ def create_namespace
if add_ae_ns.valid? && !flash_errors? && add_ae_ns.save
add_flash(_("%{model} \"%{name}\" was added") % {:model => ui_lookup(:model => add_ae_ns.class.name), :name => get_record_display_name(add_ae_ns)})
@in_a_form = false
add_active_node_to_open_nodes
replace_right_cell(:replace_trees => [:ae])
else
add_ae_ns.errors.each do |field, msg|
Expand Down Expand Up @@ -2729,6 +2733,11 @@ def flash_validation_errors(am_obj)
end
end

def add_active_node_to_open_nodes
return unless @sb.dig('trees', 'ae_tree', 'open_nodes')
@sb['trees']['ae_tree']['open_nodes'].push(@sb['trees']['ae_tree']['active_node']).uniq!
end

menu_section :automate

def process_element_destroy_via_queue(element, klass, name)
Expand Down