Skip to content

Commit

Permalink
Merge pull request #5292 from skateman/selected-nodes-alert-profile-a…
Browse files Browse the repository at this point in the history
…ssignment

 Fixed wrong keyword for selected nodes in TreeBuilderAlertProfileObj
  • Loading branch information
h-kataria authored Mar 1, 2019
2 parents bd19fc4 + 51cfd32 commit 2721cb4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions app/presenters/tree_builder_alert_profile_obj.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
class TreeBuilderAlertProfileObj < TreeBuilder
def initialize(name, type, sandbox, build = true, assign_to: nil, cat: nil, selected: nil)
def initialize(name, type, sandbox, build = true, assign_to: nil, cat: nil, selected_nodes: nil)
@assign_to = assign_to
@cat = cat
@selected = selected
@selected = selected_nodes
@cat_tree = @assign_to.ends_with?("-tags")
super(name, type, sandbox, build)
end

def override(node, object, _pid, _options)
node[:text] = (object.name.presence || object.description) unless object.kind_of?(MiddlewareServer)
node[:hideCheckbox] = false
node[:select] = @selected.include?(object.id)
node[:select] = @selected.try(:include?, object.id)
end

def tree_init_options
Expand Down
12 changes: 6 additions & 6 deletions spec/presenters/tree_builder_alert_profile_obj_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
described_class.new(:alert_profile_obj_tree, :alert_profile_obj,
{},
true,
:assign_to => 'storage-tags',
:cat => folder1a.id,
:selected => [tag1a.id, tag2a.id])
:assign_to => 'storage-tags',
:cat => folder1a.id,
:selected_nodes => [tag1a.id, tag2a.id])
end

describe '#tree_init_options' do
Expand Down Expand Up @@ -97,9 +97,9 @@
:alert_profile_obj,
{},
true,
:assign_to => 'tenant',
:cat => nil,
:selected => [tag1b.id])
:assign_to => 'tenant',
:cat => nil,
:selected_nodes => [tag1b.id])
end

describe '#x_get_tree_roots' do
Expand Down

0 comments on commit 2721cb4

Please sign in to comment.