import React, { useState } from 'react'; import { Alert, Button, Popover, Text, TextContent, TextInput, TextVariants, } from '@patternfly/react-core'; import { Select, SelectOption } from '@patternfly/react-core/deprecated'; import { HelpIcon, MinusCircleIcon, PlusCircleIcon, } from '@patternfly/react-icons'; import { ExternalLinkAltIcon } from '@patternfly/react-icons'; import { Table, Tbody, Td, Th, Thead, Tr } from '@patternfly/react-table'; import { v4 as uuidv4 } from 'uuid'; import { UNIT_GIB, UNIT_KIB, UNIT_MIB } from '../../../../constants'; import { useAppDispatch, useAppSelector } from '../../../../store/hooks'; import { addPartition, changePartitionMinSize, changePartitionMountpoint, selectImageTypes, removePartition, selectPartitions, } from '../../../../store/wizardSlice'; import UsrSubDirectoriesDisabled from '../../UsrSubDirectoriesDisabled'; import { ValidatedTextInput } from '../../ValidatedTextInput'; export type Partition = { id: string; mountpoint: string; min_size: string; }; const FileSystemConfiguration = () => { const partitions = useAppSelector((state) => selectPartitions(state)); const environments = useAppSelector((state) => selectImageTypes(state)); const dispatch = useAppDispatch(); const handleAddPartition = () => { const id = uuidv4(); dispatch( addPartition({ id, mountpoint: '/home', min_size: '1', }) ); }; return ( <> Configure partitions {partitions?.find((partition) => partition?.mountpoint?.includes('/usr') ) && } Create partitions for your image by defining mount points and minimum sizes. Image builder creates partitions with a logical volume (LVM) device type. The order of partitions may change when the image is installed in order to conform to best practices and ensure functionality.

{environments.includes('image-installer') && ( )} {partitions && partitions.map((partition) => ( ))}
Mount point Type Minimum size Image Builder may extend this size based on requirements, selected packages, and configurations. } >
); }; type RowPropTypes = { partition: Partition; }; const getPrefix = (mountpoint: string) => { return mountpoint.split('/')[1] ? '/' + mountpoint.split('/')[1] : '/'; }; const getSuffix = (mountpoint: string) => { const prefix = getPrefix(mountpoint); return mountpoint.substring(prefix.length); }; const Row = ({ partition }: RowPropTypes) => { const [units, setUnits] = useState('MiB'); const dispatch = useAppDispatch(); const handleRemovePartition = (id: string) => { dispatch(removePartition(id)); }; return ( {partition.mountpoint !== '/' && !partition.mountpoint.startsWith('/boot') && !partition.mountpoint.startsWith('/usr') ? ( ) : ( )} xfs