debian-image-builder-frontend/src/Components/CreateImageWizard/steps/FileSystem/FileSystemConfiguration.tsx
regexowl e6b030ea4c src: Remove ouia-ids
Since we're moving away from IQE the `ouia-id` atributes should be no longer needed. This removes them from the entire code base.
2025-04-25 11:32:43 +02:00

97 lines
2.7 KiB
TypeScript

import React from 'react';
import {
Alert,
Button,
Text,
TextContent,
TextVariants,
} from '@patternfly/react-core';
import { PlusCircleIcon } from '@patternfly/react-icons';
import { ExternalLinkAltIcon } from '@patternfly/react-icons';
import { v4 as uuidv4 } from 'uuid';
import FileSystemTable from './FileSystemTable';
import { FILE_SYSTEM_CUSTOMIZATION_URL } from '../../../../constants';
import { useAppDispatch, useAppSelector } from '../../../../store/hooks';
import {
addPartition,
selectImageTypes,
selectPartitions,
} from '../../../../store/wizardSlice';
import UsrSubDirectoriesDisabled from '../../UsrSubDirectoriesDisabled';
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 (
<>
<TextContent>
<Text component={TextVariants.h3}>Configure partitions</Text>
</TextContent>
{partitions?.find((partition) =>
partition?.mountpoint?.includes('/usr')
) && <UsrSubDirectoriesDisabled />}
<TextContent>
<Text>
Create partitions for your image by defining mount points and minimum
sizes. Image builder creates partitions with a logical volume (LVM)
device type.
</Text>
<Text>
The order of partitions may change when the image is installed in
order to conform to best practices and ensure functionality.
<br></br>
<Button
component="a"
target="_blank"
variant="link"
icon={<ExternalLinkAltIcon />}
iconPosition="right"
href={FILE_SYSTEM_CUSTOMIZATION_URL}
className="pf-v5-u-pl-0"
>
Read more about manual configuration here
</Button>
</Text>
</TextContent>
{environments.includes('image-installer') && (
<Alert
variant="warning"
isInline
title="Filesystem customizations are not applied to 'Bare metal - Installer' images"
/>
)}
<FileSystemTable />
<TextContent>
<Button
data-testid="file-system-add-partition"
className="pf-v5-u-text-align-left"
variant="link"
icon={<PlusCircleIcon />}
onClick={handleAddPartition}
>
Add partition
</Button>
</TextContent>
</>
);
};
export default FileSystemConfiguration;