Skip to content

Commit

Permalink
Merge pull request #5902 from skateman/switches-controller
Browse files Browse the repository at this point in the history
Propagate parent model into GTLs on InfraNetwork switches πŸ–΅ 🐞
  • Loading branch information
h-kataria authored Jul 30, 2019
2 parents ecd4374 + 4ba6f1b commit c613075
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 3 additions & 7 deletions app/controllers/infra_networking_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def host_switches_list(id, model)
self.x_node = "root"
get_node_info("root")
else
options = {:model => "Switch", :named_scope => :shareable, :selected_ids => @host_record.switches.pluck(:id)}
options = {:model => "Switch", :named_scope => :shareable, :parent => @record}
process_show_list(options) if @show_list
@showtype = 'main'
@pages = nil
Expand All @@ -235,9 +235,7 @@ def cluster_switches_list(id, model)
self.x_node = "root"
get_node_info("root")
else
hosts = @cluster_record.hosts
switch_ids = hosts.collect { |host| host.switches.pluck(:id) }
options = {:model => "Switch", :named_scope => :shareable, :selected_ids => switch_ids.flatten.uniq}
options = {:model => "Switch", :named_scope => :shareable, :parent => @record}
process_show_list(options) if @show_list
@showtype = 'main'
@pages = nil
Expand All @@ -253,9 +251,7 @@ def provider_switches_list(id, model)
self.x_node = "root"
get_node_info("root")
else
hosts = Host.where(:ems_id => @provider_record.id)
switch_ids = hosts.collect { |host| host.switches.pluck(:id) }
options = {:model => "Switch", :named_scope => :shareable, :selected_ids => switch_ids.flatten.uniq}
options = {:model => "Switch", :named_scope => :shareable, :parent => @record}
process_show_list(options) if @show_list
@showtype = 'main'
@pages = nil
Expand Down
4 changes: 4 additions & 0 deletions app/presenters/tree_builder_infra_networking.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ class TreeBuilderInfraNetworking < TreeBuilder
has_kids_for Switch, [:x_get_tree_switch_kids]
has_kids_for EmsFolder, [:x_get_tree_folder_kids]

def override(node, object, _pid, _options)
node[:selectable] = false if object.kind_of?(Lan)
end

private

def tree_init_options
Expand Down

0 comments on commit c613075

Please sign in to comment.