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

Fix UI mapping for label tag mapping. #780

merged 3 commits into from
Mar 27, 2017

Conversation

djberg96
Copy link
Contributor

The change to the MAPPABLE_ENTITIES to "Provider::Resource" format caused in issue in the entity_ui_name_or_all method. First, the model name now needs to be parsed out. Second, the "Image" string doesn't map to an existing model, so we have to specially handle that.

@djberg96
Copy link
Contributor Author

@cben Look good?

@cben
Copy link
Contributor

cben commented Mar 23, 2017

Thanks! LGTM

@cben
Copy link
Contributor

cben commented Mar 23, 2017

cc @zgalor

@djberg96
Copy link
Contributor Author

Not sure what's up with Hakiri lately.

@cben
Copy link
Contributor

cben commented Mar 27, 2017

@miq-bot add-label bug, i18n

Should fix https://bugzilla.redhat.com/show_bug.cgi?id=1435172

else
if entity
entity = entity.split('::').last
entity = 'VmOrTemplate' if entity == 'Image'
Copy link
Contributor

@cben cben Mar 27, 2017

Choose a reason for hiding this comment

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

so 'Amazon::Vm' becomes ui_lookup(model: 'Vm') == "VM and Instance",
Amazon::Image becomes ui_lookup(model: 'VmOrTemplate') == "VM or Template".
Would user understand the distinction? Perhaps you want something like _("VM") and _("VM Image")?

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 I don't see a way around it. Unless there's to an option to Dictionary.gettext that we can pass (which is being called in the ui_lookup method in lib/global_methods.rb), I don't see a way around this for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

@djberg96 how abut using ui_lookup(:model => 'ManageIQ::Providers::CloudManager::Template')

@cben
Copy link
Contributor

cben commented Mar 27, 2017

Also this drops the provider prefix "Kubernetes" / "Amazon" from the UI.

  • The Kubernetes entities are mostly called "Container Something" so it's acceptably clear, in fact maybe better as saying "Kubernetes" might sound like it won't work for OpenShift?
  • But for VMs & images, user can think this mapping would apply to all VMs, so saying "Amazon VM" is better.

@djberg96 djberg96 changed the title Fix UI mapping for label tag mapping. [WIP] Fix UI mapping for label tag mapping. Mar 27, 2017
@djberg96
Copy link
Contributor Author

@miq-bot add_label wip

@miq-bot miq-bot added the wip label Mar 27, 2017
@djberg96
Copy link
Contributor Author

@cben There's not much I can do for now, but it is working on the backend, i.e. it's creating the proper tag prefix based on the type so I think we have to live with it for now. That, or we live with the "Pod" vs "ContainerGroup" issue for now.

@djberg96
Copy link
Contributor Author

@bronaghs @bascar This is what he means the UI will look like:

screen shot 2017-03-27 at 8 40 05 am

It's not really intuitive which one is an "image". We can go with it for now and refactor later, or we can leave this BZ in place: https://bugzilla.redhat.com/show_bug.cgi?id=1435172

What say you?

@bronaghs
Copy link

Thanks @h-kataria

@djberg96 - I tried @h-kataria's suggestion and made a similar change for VMs:
ui_lookup(:model => 'ManageIQ::Providers::CloudManager::Vm')and it seems to look good to me, what do you think?

screen shot 2017-03-27 at 1 04 57 pm 2

@djberg96
Copy link
Contributor Author

@bronaghs I think that's as good as we can do for now. Maybe we could add some helper text in there (outside the menu) that let's people know that "Vm" and "Image" are Amazon only.

@bronaghs
Copy link

well what is interesting is that when i use the Amazon namespace, like this:

  entity = 'ManageIQ::Providers::Amazon::CloudManager::Template' if entity == 'Image'
  entity = 'ManageIQ::Providers::Amazon::CloudManager::Vm' if entity == 'Vm'

the instances are listed nicely as Amazon in the drop down but templates are not, see screenshot.
@h-kataria - any pointers as to where we would fix this for templates?

screen shot 2017-03-27 at 1 19 34 pm 2

@h-kataria
Copy link
Contributor

@bronaghs that is due to the fact that there are separate entries to handle different types of instances in the dictionary lookup file, see here https://github.com/ManageIQ/manageiq/blob/master/locale/en.yml#L774-L780

@bronaghs
Copy link

bronaghs commented Mar 27, 2017

So I added ManageIQ::Providers::Amazon::CloudManager::Template: Image (Amazon)
to https://github.com/ManageIQ/manageiq/blob/master/locale/en.yml
and I see "Images (Amazon)" displayed.

@h-kataria - It seems thats this has to be implemented for multiple languages, who would make that PR?

@h-kataria
Copy link
Contributor

@bronaghs all you need to do is add it to en.yml, rest is all automated.

@bronaghs
Copy link

@djberg96 - can you push a commit that adds ManageIQ::Providers::Amazon::CloudManager::Template: Image (Amazon) to https://github.com/ManageIQ/manageiq/blob/master/locale/en.yml

Then i think this is good.

@djberg96
Copy link
Contributor Author

@bronaghs @h-kataria Ok, I'll add that, thanks!

@djberg96
Copy link
Contributor Author

@djberg96
Copy link
Contributor Author

@bronaghs @h-kataria Please take a look and verify. My local dev instance is refusing to pickup local dev changes now for some reason.

@miq-bot
Copy link
Member

miq-bot commented Mar 27, 2017

Checked commits https://github.com/djberg96/manageiq-ui-classic/compare/d7d90a18a0b6c03605826b53ee32838ebf9d0fc7~...27439ab201235a4a7ca8bb13dcb3f96099bf8ae9 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
1 file checked, 0 offenses detected
Everything looks good. 🏆

@bronaghs
Copy link

LGTM

@h-kataria
Copy link
Contributor

@djberg96 verified changes in UI:
map_tags

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.

@djberg96 djberg96 changed the title [WIP] Fix UI mapping for label tag mapping. Fix UI mapping for label tag mapping. Mar 27, 2017
@djberg96
Copy link
Contributor Author

@miq-bot remove_label wip

@miq-bot miq-bot removed the wip label Mar 27, 2017
@h-kataria h-kataria added this to the Sprint 57 Ending Mar 27, 2017 milestone Mar 27, 2017
@h-kataria h-kataria merged commit 60e0707 into ManageIQ:master Mar 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants