-
Notifications
You must be signed in to change notification settings - Fork 96
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
Fixes #36982 - display short hostname on REX job pages #859
Fixes #36982 - display short hostname on REX job pages #859
Conversation
96812fe
to
acd3e18
Compare
@MariaAga Any idea why the tests are failing? |
|
Would adding this line here resolve the issue? Or is there a way I can test it locally? I couldn't find how. |
Yeah it should fix it. You can run |
a0252cd
to
68405c3
Compare
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.
The changes to the ruby code seem quite OK, but the JS doesn't have to know about this setting. It should just use display_name
where it is possible.
@@ -31,7 +33,7 @@ const SelectedChip = ({ selected, setSelected, categoryName }) => { | |||
onClick={() => deleteItem(id)} | |||
closeBtnAriaLabel={`Remove ${name}`} | |||
> | |||
{name} | |||
{displayFqdnForHosts ? name : name.split('.')[0]} |
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.
selected
variable is a set of hosts returned by the API, they all have display_name
property, you can use it here, as long as you change the map
statement:
instead of:
selected.map(({ name, id }, index) => (...)
You can add the display_name
:
selected.map(({ name, display_name, id }, index) => (...)
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.
I think we are using here gql for the query, which means that we don't have access to the display_name
property.
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.
Looks like we are missing display_name
from GQL definition in foreman. Let's add it first.
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.
theforeman/foreman#9968 added to the description
68405c3
to
3fe4eb7
Compare
c4dad98
to
a8b8619
Compare
a8b8619
to
33ff5f6
Compare
33ff5f6
to
cdf48ef
Compare
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.
If this still depends on theforeman/foreman#9968, can you raise the minimum required Foreman version so we don't accidentally cherry pick it?
<Button | ||
component="a" | ||
href={foremanUrl(`/hosts/${host}`)} | ||
href={foremanUrl(`/hosts/${host.name}`)} |
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.
I'd be tempted to use host IDs in URLs, not names to avoid breaking when you rename hosts. I know Foreman is inconsistent about that. This is why I think we should avoid constructing URLs all over the place and instead rely on helpers. foremanUrl
is really an anti-pattern.
If the UI relies on it so much, we should do what GH did and include html_url
in the API response.
@@ -84,7 +84,7 @@ const ReviewDetails = ({ | |||
return __('No Target Hosts'); | |||
} | |||
if (hosts.length === 1 || hosts.length === 2) { |
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.
Unrelated, but I'd have written < 3
and probably made 3
some constant.
b93143b
to
d8f5135
Compare
5b87230
to
6a67c5d
Compare
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.
🍏 LGTM
Did a quick test with enabled and disabled setting, with the new UI job wizard,
and worked fine.
Setting is applied everywhere and the job execution went well.
@adamruzicka @MariaAga I'll leave the final ACK on you
Could you please rebase? It should make packit turn green |
6a67c5d
to
f109215
Compare
<Button | ||
component="a" | ||
href={foremanUrl(`/hosts/${host}`)} | ||
href={foremanUrl(`/new/hosts/${host.name}`)} |
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.
Shouldn't it be dependent on a switch?
@Ron-Lavi?
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.
You are right, we should check user's settings here. I'll remove it and open a separate PR for that.
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.
I saw the same behaviour across the app so I think it is OK..
Probably we can try to load the correct host path to the React Context Settings and use that helper across the app ( but that's for another PR ). :)
Could you also deal with it here https://github.com/theforeman/foreman_remote_execution/blob/master/app/lib/actions/remote_execution/run_host_job.rb#L104 ? |
f109215
to
3240802
Compare
Is there a reason for the inconsistency in saving the |
Could you give an example? |
When I set the Update: |
3240802
to
b7ec528
Compare
I don't know in what environment you hit that, but it sounds like that either not all processes picked up your code changes or that not all processes picked up the setting change. Either way, I'm failing to reproduce it on a fresh nightly machine |
Thanks. Restarting my local environment seems to have solved the issue for me. Everything works as expected now. |
Is there anything else required before we proceed with the merge? |
b7ec528
to
b93fc23
Compare
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.
On a relevant side note, what does RunHostJob#host_name
(a thing usable in webhooks) end up being? Is it the short name or the fqdn?
I think this shouldn't be effected at all, however I didn't test it. |
If the `display_fqdn_for_hosts` setting is set to false, show the short hostname on REX job pages.
b93fc23
to
dfaad4e
Compare
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.
Looks good
Thank you @nofaralfasi ! |
If the
display_fqdn_for_hosts
setting is set to false, show the short hostname on REX job pages.Requires: