-
Notifications
You must be signed in to change notification settings - Fork 296
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 #35713 - Host details tab for Debian packages #10744
Conversation
Issues: #35713 |
284b57f
to
4d861db
Compare
4a8c724
to
d97b173
Compare
a3e56c3
to
51969bb
Compare
Hey @lfu , I saw that you created most of the host details packages tab and I am trying to reuse your code for Debian packages, but I got stuck at the tests. Do you have any idea what needs adjustment? Any hints are highly appreciated! |
Or maybe @jturel ? Not sure, who would be the right person to ping. |
cc @jeremylenz |
means the test is making an API request that wasn't planned for with a Nock instance. Each API request in a test must have a corresponding scope that matches the request, and then an
to see how Nock is doing its matching. Probably some adjustment of the nock |
Thanks @jeremylenz That debug output helped me a lot! |
51969bb
to
a9d347d
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.
Haven't tested this yet but here's a couple things I noticed :)
import { urlBuilder } from 'foremanReact/common/urlHelpers'; | ||
import SelectableDropdown from '../../../../SelectableDropdown'; | ||
import TableWrapper from '../../../../../components/Table/TableWrapper'; | ||
import { useBulkSelect, useTableSort, useUrlParams, useSet } from '../../../../../components/Table/TableHooks'; |
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.
After #10783 is merged you'll have to import these from foremanReact
, just fyi
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, applied! (at least where it was giving me an error)
df17355
to
bdb5865
Compare
@jeremylenz Got the react tests running! Might need some Ruby tests, though. I copied a lot of code from the packages tab. Shall I mention the developer - mostly @lfu I think - in the commit message? I think this should be credited. Another option is to have a common packages tab component for rpm packages and for deb packages and re-use it for the specific tabs. Would be the cleaner implementation, I guess, but would require quite some afford to change the code. |
Not necessary at all :) |
In our downstream product we rip out or disable most of the Debian-related stuff anyway, so this implementation with separate Deb components and files actually seems cleaner to me with that in mind. 👍 |
Okay, then let's leave the structure as is then. Theoretically, the PR should not affect rpm repos if it works correctly. It just adds a package tab to Debian repositories. |
6fa8d38
to
c818918
Compare
c818918
to
f9ba1a9
Compare
@jeremylenz This is ready for review :) |
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 @nadjaheitmann !
Spun up a Debian 11 host and everything seems to work ok. Some minor comments below.
webpack/components/extensions/HostDetails/Tabs/DebsTab/DebInstallModal.scss
Outdated
Show resolved
Hide resolved
@@ -560,6 +560,24 @@ def package_names_for_job_template(action:, search:, versions: nil) | |||
end | |||
end | |||
|
|||
def deb_names_for_job_template(action:, search:) |
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 wonder if we could avoid adding a new method here, and just check self.operatingsystem.family
within package_names_for_job_template
instead?
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.
@jeremylenz I think, it is a good idea and I have a added a commit on top of the actual commit for the host details page. However, rubocop does not like the changes. Not sure if I can make this any simpler.
[2024-01-05T09:07:35.947Z] Offenses:
[2024-01-05T09:07:35.947Z] /home/jenkins/workspace/katello-pr-test/app/models/katello/concerns/host_managed_extensions.rb:541:7: C: Metrics/AbcSize: Assignment Branch Condition size for package_names_for_job_template is too high. [<9, 56, 21> 60.48/60]
[2024-01-05T09:07:35.947Z] def package_names_for_job_template(action:, search:, versions: nil) ...
[2024-01-05T09:07:35.947Z] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2024-01-05T09:07:35.947Z] /home/jenkins/workspace/katello-pr-test/app/models/katello/concerns/host_managed_extensions.rb:541:7: C: Metrics/CyclomaticComplexity: Cyclomatic complexity for package_names_for_job_template is too high. [16/14]
[2024-01-05T09:07:35.947Z] def package_names_for_job_template(action:, search:, versions: nil) ...
[2024-01-05T09:07:35.947Z] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2024-01-05T09:07:35.947Z] /home/jenkins/workspace/katello-pr-test/app/models/katello/concerns/host_managed_extensions.rb:541:7: C: Metrics/MethodLength: Method has too many lines. [34/30]
[2024-01-05T09:07:35.947Z] def package_names_for_job_template(action:, search:, versions: nil) ...
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.
@nadjaheitmann Two options here. I would be fine with either one:
- Extract your
if / else
block to its own method. I would probably also do it as a case statement(case operatingsystem.family
) - Or, just disable that cop and enable it at the end of the method. We do that in several places.
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 tried option one, although I did not want to use a case statement. Seems safer to me to have Debian and everything else :)
eb77ed5
to
8abc54d
Compare
0484df6
to
57b957a
Compare
6acdc28
to
e8cc177
Compare
@nadjaheitmann Please squash and/or rename your commit to add 'Refs #35713', then we can merge. |
e8cc177
to
bb4e9ee
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.
Thanks @nadjaheitmann!
ACK 👍
(cherry picked from commit e48bd5b)
(cherry picked from commit e48bd5b)
What are the changes introduced in this pull request?
Host details tab for Debian packages
What are the testing steps for this pull request?
Try viewing, installing, removing and updating deb packages for hosts.
For code review: There are actually a lot of code pieces that were taken from the PackagesTab. Any re-structuring of the code needed?
What is missing: