V2Wizard: Hide first boot from review step

This commit is contained in:
Amir 2024-05-02 18:09:15 +03:00 committed by Klara Simickova
parent 824f30d4c5
commit 038f6f5ff5
3 changed files with 28 additions and 14 deletions

View file

@ -8,7 +8,6 @@ import {
WizardStepType,
useWizardContext,
} from '@patternfly/react-core';
import { useFlag } from '@unleash/proxy-client-react';
import { useNavigate, useSearchParams } from 'react-router-dom';
import DetailsStep from './steps/Details';
@ -61,6 +60,7 @@ import {
selectUseLatest,
} from '../../store/wizardSlice';
import { resolveRelPath } from '../../Utilities/path';
import useBetaFlag from '../../Utilities/useBetaFlag';
import { useGetEnvironment } from '../../Utilities/useGetEnvironment';
import { ImageBuilderHeader } from '../sharedComponents/ImageBuilderHeader';
@ -128,8 +128,7 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
// =========================TO REMOVE=======================
const firstbootFlag = useFlag('image-builder.firstboot.enabled');
const isFirstBootEnabled = isBeta() && firstbootFlag;
const isFirstBootEnabled = useBetaFlag('image-builder.firstboot.enabled');
// IMPORTANT: Ensure the wizard starts with a fresh initial state
useEffect(() => {
dispatch(initializeWizard());

View file

@ -33,6 +33,7 @@ import {
selectProfile,
selectRegistrationType,
} from '../../../../store/wizardSlice';
import useBetaFlag from '../../../../Utilities/useBetaFlag';
const Review = ({ snapshottingEnabled }: { snapshottingEnabled: boolean }) => {
const blueprintName = useAppSelector(selectBlueprintName);
@ -68,6 +69,7 @@ const Review = ({ snapshottingEnabled }: { snapshottingEnabled: boolean }) => {
const onToggleFirstBoot = (isExpandableFirstBoot: boolean) =>
setIsExpandedFirstBoot(isExpandableFirstBoot);
const isFirstBootEnabled = useBetaFlag('image-builder.firstboot.enabled');
return (
<>
<ExpandableSection
@ -179,17 +181,19 @@ const Review = ({ snapshottingEnabled }: { snapshottingEnabled: boolean }) => {
{/* Intentional prop drilling for simplicity - To be removed */}
<ContentList snapshottingEnabled={snapshottingEnabled} />
</ExpandableSection>
<ExpandableSection
toggleContent={'First boot'}
onToggle={(_event, isExpandableFirstBoot) =>
onToggleFirstBoot(isExpandableFirstBoot)
}
isExpanded={isExpandableFirstBoot}
isIndented
data-testid="firstboot-expandable"
>
<FirstBootList />
</ExpandableSection>
{isFirstBootEnabled && (
<ExpandableSection
toggleContent={'First boot'}
onToggle={(_event, isExpandableFirstBoot) =>
onToggleFirstBoot(isExpandableFirstBoot)
}
isExpanded={isExpandableFirstBoot}
isIndented
data-testid="firstboot-expandable"
>
<FirstBootList />
</ExpandableSection>
)}
{(blueprintName || blueprintDescription) && (
<ExpandableSection
toggleContent={'Image details'}

View file

@ -0,0 +1,11 @@
import { useFlag } from '@unleash/proxy-client-react';
import { useGetEnvironment } from './useGetEnvironment';
const useBetaFlag = (flag: string): boolean => {
const getFlag = useFlag(flag);
const { isBeta } = useGetEnvironment();
return isBeta() && getFlag;
};
export default useBetaFlag;