Project

General

Profile

Bug #12712

No searchable link for "Owner" in host properties in non-english languages

Added by René Kaak over 4 years ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Inventory
Target version:
-

Description

If the language isnt english the link in host properties doenst work. This comes from hosts_helper.rb in line 263. Is there any reason for the if-else? It filters for the word "User" which obviously only works for english.

I've attached a screenshot of the code and my workaround.

hosts_helper_bug.PNG View hosts_helper_bug.PNG 8.14 KB bug or intened? René Kaak, 12/07/2015 01:42 AM
hosts_helper_fix.PNG View hosts_helper_fix.PNG 10.6 KB my personal workaround René Kaak, 12/07/2015 01:42 AM
Hosts helper bug Hosts helper fix

Associated revisions

Revision 9fdf33b8 (diff)
Added by Tomer Brisker 3 months ago

Fixes #12712 - Fix owner link from host info page

The link only displays if the locale is set to English.

History

#1 Updated by Dominic Cleal over 4 years ago

  • Category set to Web Interface
  • Difficulty set to trivial

The owner_type will only ever be in English, so it should actually check for if host.owner_type == "User" as it's a DB column.

The second part of the conditional is used when a host is owned by a user group rather than a user, so it doesn't link to the individual user (it could actually link to a search for the group).

If you'd like to get this fixed, please do send the fix via a pull request (see http://theforeman.org/contribute.html).

#2 Updated by René Kaak over 4 years ago

The problem with my workaround is that it leads to a 500 error if the Owner is actually a usergroup. Need to find a way to fix this behaviour.. What is the search-context for usergroup? Trying to figure something out and will report back as soon as I understood some of the helpers better..

#3 Updated by Dominic Cleal over 4 years ago

Yeah, that's why I think the conditional needs fixing instead, because a usergroup object won't have the ".login" that a user does.

It looks like you could use a search like this for hosts owned by a user group: owner_type = Usergroup and owner_id = #{host.owner.id} (instead of user.login = ...).

#4 Updated by The Foreman Bot over 4 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/2963 added

#5 Updated by The Foreman Bot over 4 years ago

  • Pull request https://github.com/theforeman/foreman/pull/2965 added

#6 Updated by Dominic Cleal almost 4 years ago

  • Status changed from Ready For Testing to New

#7 Updated by The Foreman Bot 3 months ago

  • Assignee set to Tomer Brisker
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/7315 added

#8 Updated by The Foreman Bot 3 months ago

  • Fixed in Releases 2.0.0 added

#9 Updated by Tomer Brisker 3 months ago

  • Status changed from Ready For Testing to Closed

#10 Updated by Tomer Brisker 3 months ago

  • Category changed from Web Interface to Inventory
  • Fixed in Releases 1.24.1 added

Also available in: Atom PDF