The FSC step is added to the wizard and takes full advantage of Redux for state management. This is still a work in progress. Supported features: 1. Select partition mountpoint prefix (e.g. /var, /home) 2. Edit partition mountpoint suffix (e.g. /home/videogames) 3. Change displayed units (KiB, MiB, GiB) Supported but buggy features: 1. Edit partition size Unsupported features: 1. Add partitions 2. Remove partitions 3. Validation
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import React, { useEffect } from 'react';
|
|
|
|
import { useNavigate } from 'react-router-dom';
|
|
|
|
import CreateImageWizard from './CreateImageWizard';
|
|
import { mapRequestToState } from './utilities/requestMapper';
|
|
|
|
import { useAppDispatch } from '../../store/hooks';
|
|
import { useGetBlueprintQuery } from '../../store/imageBuilderApi';
|
|
import { loadWizardState, initializeWizard } from '../../store/wizardSlice';
|
|
import { resolveRelPath } from '../../Utilities/path';
|
|
|
|
type EditImageWizardProps = {
|
|
blueprintId: string;
|
|
};
|
|
|
|
const EditImageWizard = ({ blueprintId }: EditImageWizardProps) => {
|
|
const dispatch = useAppDispatch();
|
|
const navigate = useNavigate();
|
|
|
|
const { data: blueprintDetails, error } = useGetBlueprintQuery({
|
|
id: blueprintId,
|
|
});
|
|
useEffect(() => {
|
|
if (blueprintId && blueprintDetails) {
|
|
const editBlueprintState = mapRequestToState(blueprintDetails);
|
|
dispatch(loadWizardState(editBlueprintState));
|
|
} else {
|
|
dispatch(initializeWizard());
|
|
}
|
|
}, [blueprintId, blueprintDetails, dispatch]);
|
|
useEffect(() => {
|
|
// redirect to the main page if the composeId is invalid
|
|
|
|
if (error) {
|
|
navigate(resolveRelPath(''));
|
|
}
|
|
}, [error, navigate]);
|
|
return <CreateImageWizard startStepIndex={13} />;
|
|
};
|
|
|
|
export default EditImageWizard;
|