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

Reorganize the logic in lookup_attrs for AutomateSimulationTree #723

Merged
merged 2 commits into from Mar 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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