From 857fa7ab1c9be83516139e72a1eeb4a3eef3f19d Mon Sep 17 00:00:00 2001 From: Ondrej Ezr Date: Wed, 10 Jul 2024 13:54:35 +0200 Subject: [PATCH] Wizard: feature flag to decide environments to be enabled in Feature flags now support enablement in Preview specifically. This allows us to use single feature flag for rollout. --- .../CreateImageWizardV2/CreateImageWizard.tsx | 4 ++-- .../CreateImageWizardV2/steps/Review/ReviewStep.tsx | 4 ++-- src/Utilities/useBetaFlag.ts | 11 ----------- 3 files changed, 4 insertions(+), 15 deletions(-) delete mode 100644 src/Utilities/useBetaFlag.ts diff --git a/src/Components/CreateImageWizardV2/CreateImageWizard.tsx b/src/Components/CreateImageWizardV2/CreateImageWizard.tsx index ea4815fba1..ce503bbac0 100644 --- a/src/Components/CreateImageWizardV2/CreateImageWizard.tsx +++ b/src/Components/CreateImageWizardV2/CreateImageWizard.tsx @@ -10,6 +10,7 @@ import { useWizardContext, } from '@patternfly/react-core'; import { useNavigate, useSearchParams } from 'react-router-dom'; +import { useFlag } from '@unleash/proxy-client-react'; import DetailsStep from './steps/Details'; import FileSystemStep, { FileSystemContext } from './steps/FileSystem'; @@ -63,7 +64,6 @@ 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'; @@ -135,7 +135,7 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => { // =========================TO REMOVE======================= - const isFirstBootEnabled = useBetaFlag('image-builder.firstboot.enabled'); + const isFirstBootEnabled = useFlag('image-builder.firstboot.enabled'); // IMPORTANT: Ensure the wizard starts with a fresh initial state useEffect(() => { dispatch(initializeWizard()); diff --git a/src/Components/CreateImageWizardV2/steps/Review/ReviewStep.tsx b/src/Components/CreateImageWizardV2/steps/Review/ReviewStep.tsx index 5f603560bd..9cebef2ca9 100644 --- a/src/Components/CreateImageWizardV2/steps/Review/ReviewStep.tsx +++ b/src/Components/CreateImageWizardV2/steps/Review/ReviewStep.tsx @@ -9,6 +9,7 @@ import { useWizardContext, } from '@patternfly/react-core'; import { ArrowRightIcon } from '@patternfly/react-icons'; +import { useFlag } from '@unleash/proxy-client-react'; import { ContentList, @@ -37,7 +38,6 @@ import { selectProfile, selectRegistrationType, } from '../../../../store/wizardSlice'; -import useBetaFlag from '../../../../Utilities/useBetaFlag'; const Review = ({ snapshottingEnabled }: { snapshottingEnabled: boolean }) => { const { goToStepById } = useWizardContext(); @@ -99,7 +99,7 @@ const Review = ({ snapshottingEnabled }: { snapshottingEnabled: boolean }) => { goToStepById(stepId); }; - const isFirstBootEnabled = useBetaFlag('image-builder.firstboot.enabled'); + const isFirstBootEnabled = useFlag('image-builder.firstboot.enabled'); return ( <> { - const getFlag = useFlag(flag); - const { isBeta } = useGetEnvironment(); - return isBeta() && getFlag; -}; - -export default useBetaFlag;