Wizard: Gate snapshots behind an unleash flag

This gates snapshots behind a 'image-builder.snapshots.enabled' unleash flag instead of `isBeta()`.
This commit is contained in:
regexowl 2024-08-01 13:23:20 +02:00 committed by Klara Simickova
parent fc88b09ce6
commit 3174dbd706

View file

@ -65,7 +65,6 @@ import {
selectUseLatest, selectUseLatest,
} from '../../store/wizardSlice'; } from '../../store/wizardSlice';
import { resolveRelPath } from '../../Utilities/path'; import { resolveRelPath } from '../../Utilities/path';
import { useGetEnvironment } from '../../Utilities/useGetEnvironment';
import { ImageBuilderHeader } from '../sharedComponents/ImageBuilderHeader'; import { ImageBuilderHeader } from '../sharedComponents/ImageBuilderHeader';
type CustomWizardFooterPropType = { type CustomWizardFooterPropType = {
@ -112,7 +111,6 @@ type CreateImageWizardProps = {
}; };
const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => { const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
const { isBeta } = useGetEnvironment();
const navigate = useNavigate(); const navigate = useNavigate();
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const [searchParams] = useSearchParams(); const [searchParams] = useSearchParams();
@ -122,8 +120,10 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
const { data, isSuccess, isFetching, isError } = const { data, isSuccess, isFetching, isError } =
useListFeaturesQuery(undefined); useListFeaturesQuery(undefined);
const snapshotsFlag = useFlag('image-builder.snapshots.enabled');
const snapshottingEnabled = useMemo(() => { const snapshottingEnabled = useMemo(() => {
if (!isBeta()) return false; if (!snapshotsFlag) return false;
// The below checks if other environments permit the snapshot step // The below checks if other environments permit the snapshot step
return !( return !(
!isError && !isError &&
@ -132,7 +132,7 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
data?.snapshots?.accessible === false && data?.snapshots?.accessible === false &&
data?.snapshots?.enabled === false data?.snapshots?.enabled === false
); );
}, [data, isSuccess, isFetching, isError, isBeta]); }, [data, isSuccess, isFetching, isError, snapshotsFlag]);
// =========================TO REMOVE======================= // =========================TO REMOVE=======================