V2Wizard: Make useHas<target>TargetOnly hook re-usable
This refines `useHasIsoTargetOnly` hook into `useHasSpecificTargetOnly` hook which takes an image type as an argument and can be re-used for non-iso targets as well.
This commit is contained in:
parent
a8112410b6
commit
f48bfd7c21
3 changed files with 10 additions and 9 deletions
|
|
@ -8,12 +8,12 @@ import FileSystemPartition from './FileSystemPartition';
|
|||
|
||||
import { useAppSelector } from '../../../../store/hooks';
|
||||
import { selectFileSystemPartitionMode } from '../../../../store/wizardSlice';
|
||||
import { useHasIsoTargetOnly } from '../../utilities/hasIsoTargetOnly';
|
||||
import { useHasSpecificTargetOnly } from '../../utilities/hasSpecificTargetOnly';
|
||||
export type FileSystemPartitionMode = 'automatic' | 'manual';
|
||||
|
||||
const FileSystemStep = () => {
|
||||
const fileSystemPartitionMode = useAppSelector(selectFileSystemPartitionMode);
|
||||
const hasIsoTargetOnly = useHasIsoTargetOnly();
|
||||
const hasIsoTargetOnly = useHasSpecificTargetOnly('image-installer');
|
||||
|
||||
return (
|
||||
<Form>
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
import { useAppSelector } from '../../../store/hooks';
|
||||
import { selectImageTypes } from '../../../store/wizardSlice';
|
||||
|
||||
export const useHasIsoTargetOnly = () => {
|
||||
const environments = useAppSelector(selectImageTypes);
|
||||
return environments.length === 1 && environments.includes('image-installer');
|
||||
};
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
import { useAppSelector } from '../../../store/hooks';
|
||||
import { ImageTypes } from '../../../store/imageBuilderApi';
|
||||
import { selectImageTypes } from '../../../store/wizardSlice';
|
||||
|
||||
export const useHasSpecificTargetOnly = (target: ImageTypes) => {
|
||||
const environments = useAppSelector(selectImageTypes);
|
||||
return environments.length === 1 && environments.includes(target);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue