CreateImageWizard/requestMapper: fix enabling firstboot

Reorder the code to be easier to read:

when there none of service.{enabled|masked|disabled}
firstboot also is not enabled (if requested)
this patch fixes this bug
This commit is contained in:
Florian Schüller 2024-09-30 09:43:55 +02:00 committed by Klara Simickova
parent bd8eaaf8b9
commit faa3385054

View file

@ -494,15 +494,6 @@ const getCustomizations = (state: RootState, orgID: string): Customizations => {
const getServices = (state: RootState): Services | undefined => {
const services = selectServices(state);
if (
services.enabled.length === 0 &&
services.masked.length === 0 &&
services.disabled.length === 0 &&
!selectFirstBootScript(state)
) {
return undefined;
}
let enabledSvcs = services.enabled || [];
const includeFBSvc: boolean =
!!selectFirstBootScript(state) &&
@ -510,6 +501,13 @@ const getServices = (state: RootState): Services | undefined => {
if (includeFBSvc) {
enabledSvcs = [...enabledSvcs, FIRST_BOOT_SERVICE];
}
if (
enabledSvcs.length === 0 &&
services.masked.length === 0 &&
services.disabled.length === 0
) {
return undefined;
}
return {
enabled: enabledSvcs.length ? enabledSvcs : undefined,