import React, { useState } from 'react'; import { Alert, Button, Text, TextContent, TextInput, TextVariants, } from '@patternfly/react-core'; import { Select, SelectOption } from '@patternfly/react-core/deprecated'; import { MinusCircleIcon, PlusCircleIcon } from '@patternfly/react-icons'; import { ExternalLinkAltIcon } from '@patternfly/react-icons'; import { Td, Tr } from '@patternfly/react-table'; import { v4 as uuidv4 } from 'uuid'; import FileSystemTable from './FileSystemTable'; import { FILE_SYSTEM_CUSTOMIZATION_URL, UNIT_GIB, UNIT_KIB, UNIT_MIB, } from '../../../../constants'; import { useAppDispatch, useAppSelector } from '../../../../store/hooks'; import { addPartition, changePartitionMinSize, changePartitionMountpoint, selectImageTypes, removePartition, selectPartitions, changePartitionUnit, } from '../../../../store/wizardSlice'; import UsrSubDirectoriesDisabled from '../../UsrSubDirectoriesDisabled'; import { useFilesystemValidation } from '../../utilities/useValidation'; import { HookValidatedInput } from '../../ValidatedTextInput'; import { FileSystemContext } from './index'; export type Partition = { id: string; mountpoint: string; min_size: string; unit: Units; }; const FileSystemConfiguration = () => { const partitions = useAppSelector(selectPartitions); const environments = useAppSelector(selectImageTypes); const dispatch = useAppDispatch(); const handleAddPartition = () => { const id = uuidv4(); dispatch( addPartition({ id, mountpoint: '/home', min_size: '1', unit: 'GiB', }) ); }; 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') && ( )} ); }; type RowPropTypes = { partition: Partition; onDrop?: (event: React.DragEvent) => void; onDragEnd?: (event: React.DragEvent) => void; onDragStart?: (event: React.DragEvent) => void; }; const normalizeSuffix = (rawSuffix: string) => { const suffix = rawSuffix.replace(/^\/+/g, ''); return suffix.length > 0 ? '/' + suffix : ''; }; const getPrefix = (mountpoint: string) => { return mountpoint.split('/')[1] ? '/' + mountpoint.split('/')[1] : '/'; }; const getSuffix = (mountpoint: string) => { const prefix = getPrefix(mountpoint); return normalizeSuffix(mountpoint.substring(prefix.length)); }; export const Row = ({ partition, onDragEnd, onDragStart, onDrop, }: RowPropTypes) => { const dispatch = useAppDispatch(); const handleRemovePartition = (id: string) => { dispatch(removePartition(id)); }; const stepValidation = useFilesystemValidation(); const isPristine = React.useContext(FileSystemContext); return ( {!isPristine && stepValidation.errors[`mountpoint-${partition.id}`] && ( )} {partition.mountpoint !== '/' && !partition.mountpoint.startsWith('/boot') && !partition.mountpoint.startsWith('/usr') ? ( ) : ( )} xfs