Skip to content

Commit

Permalink
Merge pull request #723 from skateman/fix-automate-simulation-tree
Browse files Browse the repository at this point in the history
Reorganize the logic in lookup_attrs for AutomateSimulationTree
  • Loading branch information
mzazrivec committed Mar 20, 2017
2 parents 3afab91 + e46da6f commit 9ddef18
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 2 additions & 0 deletions app/helpers/miq_ae_class_helper.rb
Expand Up @@ -114,6 +114,8 @@ def ae_field_fonticon(field)
'product product-relationship'
when 'state'
'product product-state'
when 'element'
'product product-element'
else
raise NotImplementedError, "Missing fonticon for MiqAeField type #{field}"
end
Expand Down
15 changes: 8 additions & 7 deletions app/presenters/tree_builder_automate_simulation_results.rb
Expand Up @@ -49,13 +49,7 @@ def lookup_attrs(el)
:tooltip => el.attributes["name"],
:icon => 'product product-attribute'
}
elsif !el.text.blank?
{
:text => el.text,
:tip => el.text,
:icon => ae_field_fonticon(el.name.underscore)
}
else
elsif el.name.starts_with?('MiqAeService')
key = el.name.sub(/^MiqAeService/, '').gsub('_', '::')
base_obj = key.safe_constantize.try(:new)
obj = TreeNode.new(base_obj) if TreeNode.exists?(base_obj)
Expand All @@ -66,6 +60,13 @@ def lookup_attrs(el)
:icon => obj ? obj.icon : nontreenode_icon(base_obj),
:image => obj ? obj.image : nil
}
else
text = !el.text.blank? ? el.text : el.name
{
:text => text,
:tip => text,
:icon => ae_field_fonticon(el.name.underscore)
}
end
end

Expand Down

0 comments on commit 9ddef18

Please sign in to comment.