Wizard: fix imported repositories not preselected

This fixes a bug that was caused by using incorrect ids of imported
custom repositories. Due to that bug, only in some cases the
repositories were correctly preselected.
This commit is contained in:
Anna Vítová 2025-04-15 13:55:03 +02:00 committed by Klara Simickova
parent 774714cb99
commit fad33a32c8
2 changed files with 100 additions and 57 deletions

View file

@ -37,6 +37,7 @@ import {
UploadTypes,
User,
} from '../../../store/imageBuilderApi';
import { ApiRepositoryImportResponseRead } from '../../../store/service/contentSourcesApi';
import {
selectActivationKey,
selectArchitecture,
@ -395,6 +396,24 @@ export const mapRequestToState = (request: BlueprintResponse): wizardState => {
};
};
export function mapToCustomRepositories(
repo: ApiRepositoryImportResponseRead
): CustomRepository[] {
if (!repo.uuid) return [];
return [
{
id: repo.uuid,
name: repo.name,
baseurl: repo.url ? [repo.url] : undefined,
gpgkey: repo.gpg_key ? [repo.gpg_key] : undefined,
check_gpg: repo.metadata_verification ?? undefined,
check_repo_gpg: repo.metadata_verification ?? undefined,
module_hotfixes: repo.module_hotfixes ?? undefined,
enabled: true,
},
];
}
/**
* This function maps the blueprint response to the wizard state, used to populate the wizard with the blueprint details
* @param request BlueprintExportResponse