updating useFlag to omit feature flag from onPrem env
This commit is contained in:
parent
522d61447e
commit
830e22fcdc
6 changed files with 17 additions and 7 deletions
|
|
@ -10,7 +10,6 @@ import {
|
||||||
PageSection,
|
PageSection,
|
||||||
} from '@patternfly/react-core';
|
} from '@patternfly/react-core';
|
||||||
import { WizardStepType } from '@patternfly/react-core/dist/esm/components/Wizard';
|
import { WizardStepType } from '@patternfly/react-core/dist/esm/components/Wizard';
|
||||||
import { useFlag } from '@unleash/proxy-client-react';
|
|
||||||
import { useNavigate, useSearchParams } from 'react-router-dom';
|
import { useNavigate, useSearchParams } from 'react-router-dom';
|
||||||
|
|
||||||
import DetailsStep from './steps/Details';
|
import DetailsStep from './steps/Details';
|
||||||
|
|
@ -65,6 +64,7 @@ import {
|
||||||
addImageType,
|
addImageType,
|
||||||
} from '../../store/wizardSlice';
|
} from '../../store/wizardSlice';
|
||||||
import { resolveRelPath } from '../../Utilities/path';
|
import { resolveRelPath } from '../../Utilities/path';
|
||||||
|
import { useFlag } from '../../Utilities/useGetEnvironment';
|
||||||
import { useGetEnvironment } from '../../Utilities/useGetEnvironment';
|
import { useGetEnvironment } from '../../Utilities/useGetEnvironment';
|
||||||
import { ImageBuilderHeader } from '../sharedComponents/ImageBuilderHeader';
|
import { ImageBuilderHeader } from '../sharedComponents/ImageBuilderHeader';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ import {
|
||||||
useWizardContext,
|
useWizardContext,
|
||||||
} from '@patternfly/react-core';
|
} from '@patternfly/react-core';
|
||||||
import { ArrowRightIcon } from '@patternfly/react-icons';
|
import { ArrowRightIcon } from '@patternfly/react-icons';
|
||||||
import { useFlag } from '@unleash/proxy-client-react';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ContentList,
|
ContentList,
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ import {
|
||||||
ToolbarContent,
|
ToolbarContent,
|
||||||
} from '@patternfly/react-core';
|
} from '@patternfly/react-core';
|
||||||
import { ExternalLinkAltIcon, HelpIcon } from '@patternfly/react-icons';
|
import { ExternalLinkAltIcon, HelpIcon } from '@patternfly/react-icons';
|
||||||
import { useFlag } from '@unleash/proxy-client-react';
|
|
||||||
import { Outlet, useLocation, useNavigate } from 'react-router-dom';
|
import { Outlet, useLocation, useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
import './LandingPage.scss';
|
import './LandingPage.scss';
|
||||||
|
|
@ -28,6 +27,7 @@ import { NewAlert } from './NewAlert';
|
||||||
import { MANAGING_WITH_DNF_URL, OSTREE_URL } from '../../constants';
|
import { MANAGING_WITH_DNF_URL, OSTREE_URL } from '../../constants';
|
||||||
import { manageEdgeImagesUrlName } from '../../Utilities/edge';
|
import { manageEdgeImagesUrlName } from '../../Utilities/edge';
|
||||||
import { resolveRelPath } from '../../Utilities/path';
|
import { resolveRelPath } from '../../Utilities/path';
|
||||||
|
import { useFlag } from '../../Utilities/useGetEnvironment';
|
||||||
import BlueprintsSidebar from '../Blueprints/BlueprintsSideBar';
|
import BlueprintsSidebar from '../Blueprints/BlueprintsSideBar';
|
||||||
import EdgeImagesTable from '../edge/ImagesTable';
|
import EdgeImagesTable from '../edge/ImagesTable';
|
||||||
import ImagesTable from '../ImagesTable/ImagesTable';
|
import ImagesTable from '../ImagesTable/ImagesTable';
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
import React, { lazy, Suspense } from 'react';
|
import React, { lazy, Suspense } from 'react';
|
||||||
|
|
||||||
import { useFlag } from '@unleash/proxy-client-react';
|
|
||||||
import { Route, Routes } from 'react-router-dom';
|
import { Route, Routes } from 'react-router-dom';
|
||||||
|
|
||||||
import EdgeImageDetail from './Components/edge/ImageDetails';
|
import EdgeImageDetail from './Components/edge/ImageDetails';
|
||||||
import ShareImageModal from './Components/ShareImageModal/ShareImageModal';
|
import ShareImageModal from './Components/ShareImageModal/ShareImageModal';
|
||||||
import { manageEdgeImagesUrlName } from './Utilities/edge';
|
import { manageEdgeImagesUrlName } from './Utilities/edge';
|
||||||
import { useFlagWithEphemDefault } from './Utilities/useGetEnvironment';
|
import {
|
||||||
|
useFlag,
|
||||||
|
useFlagWithEphemDefault,
|
||||||
|
} from './Utilities/useGetEnvironment';
|
||||||
|
|
||||||
const LandingPage = lazy(() => import('./Components/LandingPage/LandingPage'));
|
const LandingPage = lazy(() => import('./Components/LandingPage/LandingPage'));
|
||||||
const ImportImageWizard = lazy(
|
const ImportImageWizard = lazy(
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { useChrome } from '@redhat-cloud-services/frontend-components/useChrome';
|
import { useChrome } from '@redhat-cloud-services/frontend-components/useChrome';
|
||||||
import { useFlag } from '@unleash/proxy-client-react';
|
import { useFlag as useUnleashFlag } from '@unleash/proxy-client-react';
|
||||||
|
|
||||||
export const useGetEnvironment = () => {
|
export const useGetEnvironment = () => {
|
||||||
const { isBeta, isProd, getEnvironment } = useChrome();
|
const { isBeta, isProd, getEnvironment } = useChrome();
|
||||||
|
|
@ -24,5 +24,14 @@ export const useFlagWithEphemDefault = (
|
||||||
): boolean => {
|
): boolean => {
|
||||||
const getFlag = useFlag(flag);
|
const getFlag = useFlag(flag);
|
||||||
const { getEnvironment } = useChrome();
|
const { getEnvironment } = useChrome();
|
||||||
|
if (process.env.IS_ON_PREMISE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return (getEnvironment() === 'qa' && ephemDefault) || getFlag;
|
return (getEnvironment() === 'qa' && ephemDefault) || getFlag;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Since some of these flags are only relevant to
|
||||||
|
// the service, we need a way of bypassing this for on-prem
|
||||||
|
export const useFlag = !process.env.IS_ON_PREMISE
|
||||||
|
? useUnleashFlag
|
||||||
|
: () => false;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { useFlag } from '@unleash/proxy-client-react';
|
import { useFlag } from '../../../Utilities/useGetEnvironment';
|
||||||
|
|
||||||
describe('mocking unleash calls', () => {
|
describe('mocking unleash calls', () => {
|
||||||
test('the ege local image table is set to true', () => {
|
test('the ege local image table is set to true', () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue