Wizard: Hide FSC step for WSL targets

This hides FSC step when only WSL target is selected.
This commit is contained in:
regexowl 2025-06-30 14:04:13 +02:00 committed by Klara Simickova
parent e8d46dd716
commit 1f34e95469
3 changed files with 43 additions and 16 deletions

View file

@ -38,6 +38,7 @@ import Gcp from './steps/TargetEnvironment/Gcp';
import TimezoneStep from './steps/Timezone';
import UsersStep from './steps/Users';
import { getHostArch, getHostDistro } from './utilities/getHostInfo';
import { useHasSpecificTargetOnly } from './utilities/hasSpecificTargetOnly';
import {
useFilesystemValidation,
useSnapshotValidation,
@ -292,6 +293,8 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
// Users
const usersValidation = useUsersValidation();
const hasWslTargetOnly = useHasSpecificTargetOnly('wsl');
let startIndex = 1; // default index
if (isEdit) {
startIndex = 22;
@ -490,6 +493,7 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
id="step-file-system"
key="step-file-system"
navItem={CustomStatusNavItem}
isHidden={hasWslTargetOnly}
footer={
<CustomWizardFooter
beforeNext={() => {

View file

@ -12,8 +12,12 @@ import { v4 as uuidv4 } from 'uuid';
import FileSystemTable from './FileSystemTable';
import { FILE_SYSTEM_CUSTOMIZATION_URL } from '../../../../../constants';
import {
FILE_SYSTEM_CUSTOMIZATION_URL,
targetOptions,
} from '../../../../../constants';
import { useAppDispatch, useAppSelector } from '../../../../../store/hooks';
import { ImageTypes } from '../../../../../store/imageBuilderApi';
import {
addPartition,
selectImageTypes,
@ -39,6 +43,17 @@ const FileSystemConfiguration = () => {
);
};
const automaticPartitioningOnlyTargets: ImageTypes[] = [
'image-installer',
'wsl',
];
const filteredTargets = (
automaticPartitioningOnlyTargets.filter((env) =>
environments.includes(env)
) as ImageTypes[]
).map((env) => targetOptions[env]);
return (
<>
<Content>
@ -70,11 +85,14 @@ const FileSystemConfiguration = () => {
</Button>
</Content>
</Content>
{environments.includes('image-installer') && (
{(environments.includes('image-installer') ||
environments.includes('wsl')) && (
<Alert
variant="warning"
isInline
title="Filesystem customizations are not applied to 'Bare metal - Installer' images"
title={`Filesystem customizations are not applied to ${filteredTargets.join(
' and '
)} images`}
/>
)}
<FileSystemTable />

View file

@ -60,6 +60,7 @@ import {
selectUsers,
selectKernel,
} from '../../../../store/wizardSlice';
import { useHasSpecificTargetOnly } from '../../utilities/hasSpecificTargetOnly';
const Review = () => {
const { goToStepById } = useWizardContext();
@ -133,6 +134,8 @@ const Review = () => {
const onToggleUsers = (isExpandedUsers: boolean) =>
setIsExpandedUsers(isExpandedUsers);
const hasWslTargetOnly = useHasSpecificTargetOnly('wsl');
type RevisitStepButtonProps = {
ariaLabel: string;
testId: string;
@ -344,19 +347,21 @@ const Review = () => {
<OscapList />
</ExpandableSection>
)}
<ExpandableSection
toggleContent={composeExpandable(
'File system configuration',
'revisit-file-system',
'step-file-system'
)}
onToggle={(_event, isExpandedFSC) => onToggleFSC(isExpandedFSC)}
isExpanded={isExpandedFSC}
isIndented
data-testid="file-system-configuration-expandable"
>
<FSCList />
</ExpandableSection>
{!hasWslTargetOnly && (
<ExpandableSection
toggleContent={composeExpandable(
'File system configuration',
'revisit-file-system',
'step-file-system'
)}
onToggle={(_event, isExpandedFSC) => onToggleFSC(isExpandedFSC)}
isExpanded={isExpandedFSC}
isIndented
data-testid="file-system-configuration-expandable"
>
<FSCList />
</ExpandableSection>
)}
<ExpandableSection
toggleContent={composeExpandable(
'Content',