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

cockpit: add package search (HMS-5423) #2815

Merged
merged 6 commits into from
Feb 3, 2025

Conversation

kingsleyzissou
Copy link
Collaborator

@kingsleyzissou kingsleyzissou commented Jan 29, 2025

This PR adds the ability to search for packages in the CreateImageWizard.

This required some more plumbing and some refactoring of the store:

  • split the cockpit & service store apis into different directories
  • add a contentSourcesApi for the cockpit frontend
  • add a baseQuery function to dry up the endpoint calls
  • add an initial rpm search mutation

JIRA: HMS-5423

@kingsleyzissou
Copy link
Collaborator Author

This is based on @bcl's PR here osbuild/osbuild-composer#4579

Copy link

codecov bot commented Jan 30, 2025

Codecov Report

Attention: Patch coverage is 72.25806% with 172 lines in your changes missing coverage. Please review.

Project coverage is 82.96%. Comparing base (5f7f958) to head (4a9dacc).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
src/store/service/edgeApi.ts 53.64% 70 Missing ⚠️
src/store/cockpit/contentSourcesApi.ts 30.00% 35 Missing ⚠️
src/store/service/imageBuilderApi.ts 86.88% 24 Missing ⚠️
src/store/service/contentSourcesApi.ts 82.60% 16 Missing ⚠️
...ents/CreateImageWizard/steps/Packages/Packages.tsx 64.00% 9 Missing ⚠️
src/store/service/rhsmApi.ts 85.18% 4 Missing ⚠️
api/config/compliance.ts 0.00% 2 Missing ⚠️
api/config/contentSources.ts 0.00% 2 Missing ⚠️
api/config/edge.ts 0.00% 2 Missing ⚠️
api/config/imageBuilder.ts 0.00% 2 Missing ⚠️
... and 3 more

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2815      +/-   ##
==========================================
- Coverage   83.08%   82.96%   -0.13%     
==========================================
  Files         192      199       +7     
  Lines       22324    22395      +71     
  Branches     2180     2183       +3     
==========================================
+ Hits        18549    18581      +32     
- Misses       3753     3792      +39     
  Partials       22       22              
Files with missing lines Coverage Δ
src/Components/Blueprints/BlueprintsSideBar.tsx 86.70% <100.00%> (ø)
...Components/CreateImageWizard/CreateImageWizard.tsx 96.96% <100.00%> (+<0.01%) ⬆️
...teImageWizard/steps/Review/ReviewStepTextLists.tsx 95.02% <ø> (ø)
src/store/backendApi.ts 67.50% <100.00%> (+0.05%) ⬆️
src/store/cockpit/cockpitApi.ts 16.57% <100.00%> (ø)
src/store/cockpit/emptyCockpitApi.ts 100.00% <ø> (ø)
src/store/cockpit/enhancedCockpitApi.ts 52.08% <ø> (ø)
src/store/cockpit/types.ts 100.00% <ø> (ø)
src/store/complianceApi.ts 100.00% <100.00%> (ø)
src/store/edgeApi.ts 100.00% <100.00%> (+46.35%) ⬆️
... and 26 more

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5f7f958...4a9dacc. Read the comment docs.

@kingsleyzissou kingsleyzissou force-pushed the cockpit_store_structure branch 2 times, most recently from 08a2a5b to 68d5ea3 Compare January 31, 2025 16:06
@kingsleyzissou kingsleyzissou marked this pull request as ready for review January 31, 2025 16:06
@kingsleyzissou
Copy link
Collaborator Author

/jira-epic COMPOSER-2411

@schutzbot schutzbot changed the title cockpit: add package search cockpit: add package search (HMS-5423) Jan 31, 2025
Copy link
Member

@croissanne croissanne left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

Theoretically we could have 2 'cockpitapis' right? One for content sources and one for the cloudapi? Probably just makes it more complicated though.

@croissanne croissanne force-pushed the cockpit_store_structure branch from 68d5ea3 to 5fd010d Compare February 3, 2025 11:46
@kingsleyzissou
Copy link
Collaborator Author

Theoretically we could and probably should, but RTK query really doesn't like it and we get a bunch of weird errors in the console

@croissanne
Copy link
Member

croissanne commented Feb 3, 2025

Ooh IC, yea I think I get it fully now, they both just call the cloudapi after all, makes perfect sense! Interesting that RTK query can tell what's happening under the hood there.

@croissanne
Copy link
Member

Hm IG because they would use the same basequery?

Hide the registration step for on-prem frontend
Since we will need to add other api endpoints, e.g. `contentSourcesApi` for
the on-prem frontend, this PR restructures the store directory to make future
changes more manageable.
This is just a workaround to keep imports to the api definitions the same as before.
The added benefit is that we can then use these files to handle the mixed api types
between the service frontend and on-prem frontend.
Tidy up the imports and the exports in the `backendApi` mixed api to
make things more consistent.
Add a `contentSourcesApi` for the on-prem frontend. We need to add a small
workaround and put these endpoints under the `cockpitApi` reducer.
since RTK query here, doesn't like splitting out apis when they are
fundamentally the same.

To workaround this we can will just chain the endpoints so:
`emptyCockpitApi` -> `contentSourcesApi` -> `cockpitApi`

This allows us to keep the `contentSourcesApi` separate so
we can export some of the endpoints so that the `cockpitApi`
doesn't become a monolith.
Add initial package search. Include the version, release & arch information
in the summary, since some packages might have a release with the specific
architecture and a `noarch` version.
@croissanne croissanne force-pushed the cockpit_store_structure branch from 5fd010d to 4a9dacc Compare February 3, 2025 11:54
@croissanne croissanne merged commit eac03dd into osbuild:main Feb 3, 2025
16 of 18 checks passed
@kingsleyzissou kingsleyzissou deleted the cockpit_store_structure branch February 4, 2025 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants