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

Fix UI mapping for label tag mapping. #780

Merged
merged 3 commits into from
Mar 27, 2017
Merged
Changes from 1 commit
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
13 changes: 10 additions & 3 deletions app/controllers/ops_controller/settings/label_tag_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,16 @@ def label_tag_mapping_edit

def entity_ui_name_or_all(entity)
if entity
entity = entity.split('::').last
entity = 'VmOrTemplate' if entity == 'Image'
ui_lookup(:model => entity)
provider, model = entity.split('::')

case model
when 'Vm'
model = "ManageIQ::Providers::#{provider}::CloudManager::Vm"
when 'Image'
model = "ManageIQ::Providers::#{provider}::CloudManager::Template"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clever.

MAPPABLE_ENTITIES const is increasingly coupled to UI logic, would be nice to move it here from core repo (or maybe you have better plans with provider column).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cben Yes, unfortunately. This will have to be refactored again. But, at least we know where everything is and what needs to be updated going forward.

end

ui_lookup(:model => model)
else
_("<All>")
end
Expand Down