V2Wizard: Add partition function (HMS-3752)

this commit add the addPartition function to support the adding partition
at the file system step
This commit is contained in:
Michal Gold 2024-03-10 14:21:10 +02:00 committed by Klara Simickova
parent aa6b9789a7
commit 1b6a570f71
2 changed files with 20 additions and 1 deletions

View file

@ -17,10 +17,12 @@ import {
} 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,
@ -39,6 +41,19 @@ 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 (
<>
<TextContent>
@ -125,7 +140,7 @@ const FileSystemConfiguration = () => {
className="pf-u-text-align-left"
variant="link"
icon={<PlusCircleIcon />}
onClick={() => {}}
onClick={handleAddPartition}
>
Add partition
</Button>