-
Notifications
You must be signed in to change notification settings - Fork 357
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
Modify label_tag_mapping_add to accommodate scoped entity type. #666
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @zgalor See also core PR ManageIQ/manageiq#14288 for context.
prefix, entity = entity.split('::') | ||
# Backwards compatibility | ||
if prefix && entity | ||
prefix.downcase! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider just having lowercase prefixes in MAPPABLE_ENTITIES.
Capitalized with ::
looks like provider class name, but it's not exactly, IMO more confusing then helpful.
But then you might need upcase to display as "Amazon/Vm" in UI? BTW, will we want translation of Amazon.
BTW, your screenshot shows "Amazon/Vm" with slash, where does ::
-> /
replacement happen?
else | ||
prefix = ContainerLabelTagMapping::AUTOTAG_PREFIX | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method was already too long, please extract a method to compute category name (or some other split).
4 ems_container_controller_spec, container_node_controller_spec failures unrelated, fixed on ui-classic master. |
@cben, Yeah, the UI depends on the MAPPABLE_ENTITIES, so I didn't want to downcase those. I'm not sure where the "/" to "::" conversion happens right off. I remember seeing it somewhere buried in the code, but it's definitely what I saw in the logs. I've refactored the method a bit and added some custom specs. I'm not sure what Rubocop is whining about exactly. |
@miq-bot remove_label wip |
@blomquisg Ok, ready to go. |
ManageIQ/manageiq#14288 is merged now. |
@miq-bot assign dclarizio |
@miq-bot add_label enhancement, cloud/compute |
@blomquisg Cannot apply the following label because they are not recognized: cloud/compute |
@miq-bot add_label compute/cloud |
@miq-bot remove_label "pending core" |
@blomquisg Cannot remove the following label because they are not recognized: "pending core" |
@miq-bot remove_label pending core |
@dclarizio @AparnaKarve Look alright? Can we merge? |
@djberg96 Tested successfully in the UI. Other than the PR #, LGTM :) |
@AparnaKarve I see "container" on a lot of those screens, can you comment on what else needs to be changed? Thx, Dan |
@dclarizio Good point. @djberg96 So looks like this is not applicable to To keep it more generic we could just lose the |
@AparnaKarve @dclarizio ~~~Yes, those should be reworked but I would like to save it for a future PR. In the next iteration, the plan is to add another selection field (provider). Can that wait until then?~~~ Nevermind, I guess it's just a few text updates, I'll update the PR. |
Checked commits https://github.com/djberg96/manageiq-ui-classic/compare/8bc11ee9b973f723350f3fb527a00855faa97bea~...c298c141381f15d2dd5c4185d33a00b17ee9e5f3 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 app/controllers/ops_controller/settings/label_tag_mapping.rb
spec/controllers/ops_controller/settings/label_tag_mapping_spec.rb
|
This PR is based on the changes in ManageIQ/manageiq#14288. In that PR the mappable types are scoped by provider, e.g. "Amazon::Vm" or "Kubernetes::ContainerNode".
Instead of automatically using the hard coded AUTOTAG_PREFIX, it parses the provider name from the selected item if possible. The AUTOTAG_PREFIX is still the default value, which preserves backwards compatibility.