From 1f34e954691a8fa837e61beb3d76e652561fd369 Mon Sep 17 00:00:00 2001 From: regexowl Date: Mon, 30 Jun 2025 14:04:13 +0200 Subject: [PATCH] Wizard: Hide FSC step for WSL targets This hides FSC step when only WSL target is selected. --- .../CreateImageWizard/CreateImageWizard.tsx | 4 +++ .../components/FileSystemConfiguration.tsx | 24 ++++++++++++-- .../steps/Review/ReviewStep.tsx | 31 +++++++++++-------- 3 files changed, 43 insertions(+), 16 deletions(-) diff --git a/src/Components/CreateImageWizard/CreateImageWizard.tsx b/src/Components/CreateImageWizard/CreateImageWizard.tsx index f3dea3eb..23a1b1fb 100644 --- a/src/Components/CreateImageWizard/CreateImageWizard.tsx +++ b/src/Components/CreateImageWizard/CreateImageWizard.tsx @@ -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={ { diff --git a/src/Components/CreateImageWizard/steps/FileSystem/components/FileSystemConfiguration.tsx b/src/Components/CreateImageWizard/steps/FileSystem/components/FileSystemConfiguration.tsx index 29e64e81..aec6f409 100644 --- a/src/Components/CreateImageWizard/steps/FileSystem/components/FileSystemConfiguration.tsx +++ b/src/Components/CreateImageWizard/steps/FileSystem/components/FileSystemConfiguration.tsx @@ -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 ( <> @@ -70,11 +85,14 @@ const FileSystemConfiguration = () => { - {environments.includes('image-installer') && ( + {(environments.includes('image-installer') || + environments.includes('wsl')) && ( )} diff --git a/src/Components/CreateImageWizard/steps/Review/ReviewStep.tsx b/src/Components/CreateImageWizard/steps/Review/ReviewStep.tsx index f17600e1..113fdad3 100644 --- a/src/Components/CreateImageWizard/steps/Review/ReviewStep.tsx +++ b/src/Components/CreateImageWizard/steps/Review/ReviewStep.tsx @@ -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 = () => { )} - onToggleFSC(isExpandedFSC)} - isExpanded={isExpandedFSC} - isIndented - data-testid="file-system-configuration-expandable" - > - - + {!hasWslTargetOnly && ( + onToggleFSC(isExpandedFSC)} + isExpanded={isExpandedFSC} + isIndented + data-testid="file-system-configuration-expandable" + > + + + )}