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.
This commit is contained in:
Ondrej Ezr 2024-07-10 13:54:35 +02:00 committed by Klara Simickova
parent da39efcbf7
commit e8b3814074
3 changed files with 4 additions and 15 deletions

View file

@ -9,6 +9,7 @@ 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';
@ -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());

View file

@ -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 (
<>
<ExpandableSection

View file

@ -1,11 +0,0 @@
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;