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 #34211 - Hosts - Change content source #9873
Conversation
Issues: #34211 |
[test katello] |
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've left a lot of feedback here and so I haven't tested it end-to-end yet but overall it looks good.
This really needs some test coverage for the larger pieces (API, primary react components).
end | ||
|
||
@content_sources = SmartProxy.authorized(:view_smart_proxies).with_content.includes([:smart_proxy_features]) | ||
@environments = KTEnvironment.readable.includes([:organization, :env_priors, :priors]).order(: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.
It looks like this form implies changing organization by being able to select an environment that doesn't belong to the host's current organization, and that's made more complicated if you selected hosts that span organizations. Seems like we'd need to guard against this. What do you think?
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.
Hmm, yeah, there should be some checks. I'll look into it
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 added WithOrganization
so now user must select organization
app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
Outdated
Show resolved
Hide resolved
app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
Outdated
Show resolved
Hide resolved
param :content_view_id, :number, required: true, desc: N_("The id of the content view") | ||
param :content_source_id, :number, required: true, desc: N_("The id of the content source") | ||
def change_content_source | ||
hosts = ::Host.where(id: params[:host_ids]) |
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.
Do we have an "editable" scope or something similar for Host?
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.
There is a check for edit_hosts
permission when calling the endpoint:
def action_permission
case params[:action]
when 'host_collections'
'edit'
when 'change_content_source'
'edit'
else
super
end
end
@jturel updated, now requires selected organization prior to the change of content source. |
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.
Thanks @stejskalleos
JS code looks mostly fine; left some comments below. (please note this is code review only and I haven't tested functionality.)
webpack/scenes/Hosts/ChangeContentSource/ChangeContentSourcePage.js
Outdated
Show resolved
Hide resolved
webpack/scenes/Hosts/ChangeContentSource/ChangeContentSourcePage.js
Outdated
Show resolved
Hide resolved
webpack/scenes/Hosts/ChangeContentSource/ChangeContentSourcePage.js
Outdated
Show resolved
Hide resolved
webpack/scenes/Hosts/ChangeContentSource/components/ContentSourceTemplate.js
Outdated
Show resolved
Hide resolved
webpack/scenes/Hosts/ChangeContentSource/components/ContentSourceTemplate.js
Outdated
Show resolved
Hide resolved
888c0f5
to
cb5dbf3
Compare
Oh sorry my bad, did quick refactoring of |
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.
Thanks for doing the JSX refactoring I suggested! Found a couple more places that still need to be updated :)
webpack/scenes/Hosts/ChangeContentSource/components/ContentSourceForm.js
Outdated
Show resolved
Hide resolved
webpack/scenes/Hosts/ChangeContentSource/components/ContentSourceForm.js
Outdated
Show resolved
Hide resolved
webpack/scenes/Hosts/ChangeContentSource/components/ContentSourceForm.js
Outdated
Show resolved
Hide resolved
b366bd3
to
bb15a27
Compare
@jeremylenz has all of your feedback been addressed? If so I can start testing again |
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.
@jturel JS changes look good, thanks @stejskalleos! Left one more wording comment below, but please feel free to commence testing!
@stejskalleos this looks and works great! nice work. There's one thing I wanna bring to your attention:
It may be better to not show the any of the selection fields in this scenario and instead show some kind of message about the host not belonging to the selected organization. What do you think? |
You can use |
I thought withOrganization enforces that an organization is selected rather than ensuring that the selected organization contains the current resource on the page. Or maybe you meant that as a first step in shoring up the issue? |
Ah, you're right. Been a while. Delete that comment 😄 |
@jeremylenz @jturel fixed the wording and disabled fields when there are no hosts to configure (that case with changing the organization) |
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.
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.
ACK 👍
What are the changes introduced in this pull request?
New feature for changing host's content source & generating
bash
code for configuration on the host machinesConsiderations taken when implementing this change?
What are the testing steps for this pull request?
UI:
API:
TODO