Fix: package search bug with RH repos in template
This fixes a bug inside of the package search step where packages from additional (not the 2 default ones) RH repos were not coming up when searching. This only happens when using a content template as that's currently the only way to add more RH repos.
This commit is contained in:
parent
8d106499fd
commit
eaead88a78
1 changed files with 47 additions and 11 deletions
|
|
@ -70,6 +70,7 @@ import {
|
||||||
useSearchPackageGroupMutation,
|
useSearchPackageGroupMutation,
|
||||||
ApiSearchRpmResponse,
|
ApiSearchRpmResponse,
|
||||||
ApiPackageSourcesResponse,
|
ApiPackageSourcesResponse,
|
||||||
|
useGetTemplateQuery,
|
||||||
} from '../../../../store/contentSourcesApi';
|
} from '../../../../store/contentSourcesApi';
|
||||||
import { useAppSelector } from '../../../../store/hooks';
|
import { useAppSelector } from '../../../../store/hooks';
|
||||||
import { Package } from '../../../../store/imageBuilderApi';
|
import { Package } from '../../../../store/imageBuilderApi';
|
||||||
|
|
@ -89,6 +90,7 @@ import {
|
||||||
addModule,
|
addModule,
|
||||||
removeModule,
|
removeModule,
|
||||||
selectModules,
|
selectModules,
|
||||||
|
selectTemplate,
|
||||||
} from '../../../../store/wizardSlice';
|
} from '../../../../store/wizardSlice';
|
||||||
import {
|
import {
|
||||||
getEpelDefinitionForDistribution,
|
getEpelDefinitionForDistribution,
|
||||||
|
|
@ -138,6 +140,24 @@ const Packages = () => {
|
||||||
const packages = useAppSelector(selectPackages);
|
const packages = useAppSelector(selectPackages);
|
||||||
const groups = useAppSelector(selectGroups);
|
const groups = useAppSelector(selectGroups);
|
||||||
const modules = useAppSelector(selectModules);
|
const modules = useAppSelector(selectModules);
|
||||||
|
const template = useAppSelector(selectTemplate);
|
||||||
|
|
||||||
|
const { data: templateData } = useGetTemplateQuery({
|
||||||
|
uuid: template,
|
||||||
|
});
|
||||||
|
|
||||||
|
const {
|
||||||
|
data: { data: reposInTemplate = [] } = {},
|
||||||
|
isLoading: isLoadingReposInTemplate,
|
||||||
|
} = useListRepositoriesQuery({
|
||||||
|
contentType: 'rpm',
|
||||||
|
limit: 100,
|
||||||
|
offset: 0,
|
||||||
|
uuid:
|
||||||
|
templateData && templateData.repository_uuids
|
||||||
|
? templateData.repository_uuids.join(',')
|
||||||
|
: '',
|
||||||
|
});
|
||||||
|
|
||||||
const { data: distroRepositories, isSuccess: isSuccessDistroRepositories } =
|
const { data: distroRepositories, isSuccess: isSuccessDistroRepositories } =
|
||||||
useGetArchitecturesQuery({
|
useGetArchitecturesQuery({
|
||||||
|
|
@ -256,7 +276,9 @@ const Packages = () => {
|
||||||
searchDistroRpms({
|
searchDistroRpms({
|
||||||
apiContentUnitSearchRequest: {
|
apiContentUnitSearchRequest: {
|
||||||
search: debouncedSearchTerm,
|
search: debouncedSearchTerm,
|
||||||
urls: distroRepositories
|
urls:
|
||||||
|
template === ''
|
||||||
|
? distroRepositories
|
||||||
?.filter((archItem) => {
|
?.filter((archItem) => {
|
||||||
return archItem.arch === arch;
|
return archItem.arch === arch;
|
||||||
})[0]
|
})[0]
|
||||||
|
|
@ -265,7 +287,12 @@ const Packages = () => {
|
||||||
throw new Error(`Repository ${repo} missing baseurl`);
|
throw new Error(`Repository ${repo} missing baseurl`);
|
||||||
}
|
}
|
||||||
return repo.baseurl;
|
return repo.baseurl;
|
||||||
}),
|
})
|
||||||
|
: reposInTemplate
|
||||||
|
.filter((r) => r.org_id === '-1' && !!r.url)
|
||||||
|
.flatMap((r) =>
|
||||||
|
r.url!.endsWith('/') ? r.url!.slice(0, -1) : r.url!
|
||||||
|
),
|
||||||
limit: 500,
|
limit: 500,
|
||||||
include_package_sources: true,
|
include_package_sources: true,
|
||||||
},
|
},
|
||||||
|
|
@ -302,9 +329,11 @@ const Packages = () => {
|
||||||
searchRecommendedRpms,
|
searchRecommendedRpms,
|
||||||
epelRepoUrlByDistribution,
|
epelRepoUrlByDistribution,
|
||||||
isSuccessDistroRepositories,
|
isSuccessDistroRepositories,
|
||||||
searchDistroRpms,
|
|
||||||
distroRepositories,
|
distroRepositories,
|
||||||
arch,
|
arch,
|
||||||
|
template,
|
||||||
|
distribution,
|
||||||
|
debouncedSearchTermIsGroup,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -353,6 +382,11 @@ const Packages = () => {
|
||||||
debouncedSearchTerm,
|
debouncedSearchTerm,
|
||||||
activeTabKey,
|
activeTabKey,
|
||||||
epelRepoUrlByDistribution,
|
epelRepoUrlByDistribution,
|
||||||
|
debouncedSearchTermIsGroup,
|
||||||
|
arch,
|
||||||
|
distroRepositories,
|
||||||
|
isSuccessDistroRepositories,
|
||||||
|
isSuccessEpelRepo,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const EmptySearch = () => {
|
const EmptySearch = () => {
|
||||||
|
|
@ -1338,6 +1372,7 @@ const Packages = () => {
|
||||||
(isLoadingDistroPackages ||
|
(isLoadingDistroPackages ||
|
||||||
isLoadingCustomPackages ||
|
isLoadingCustomPackages ||
|
||||||
isLoadingDistroGroups ||
|
isLoadingDistroGroups ||
|
||||||
|
isLoadingReposInTemplate ||
|
||||||
isLoadingCustomGroups) &&
|
isLoadingCustomGroups) &&
|
||||||
activeTabKey === Repos.INCLUDED):
|
activeTabKey === Repos.INCLUDED):
|
||||||
return <Searching />;
|
return <Searching />;
|
||||||
|
|
@ -1384,6 +1419,7 @@ const Packages = () => {
|
||||||
sortedPackages,
|
sortedPackages,
|
||||||
activeSortDirection,
|
activeSortDirection,
|
||||||
activeSortIndex,
|
activeSortIndex,
|
||||||
|
template,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const PackagesTable = () => {
|
const PackagesTable = () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue