Manually revert "Fedora-services: add support for fedora env"
This reverts #2984 as Fedora service frontend is not being currently actively maintained.
This commit is contained in:
parent
969497e722
commit
0597541af2
14 changed files with 47 additions and 216 deletions
|
|
@ -46,7 +46,6 @@ import {
|
|||
} from '../../store/imageBuilderApi';
|
||||
import { imageBuilderApi } from '../../store/service/enhancedImageBuilderApi';
|
||||
import { resolveRelPath } from '../../Utilities/path';
|
||||
import { useGetEnvironment } from '../../Utilities/useGetEnvironment';
|
||||
|
||||
type blueprintSearchProps = {
|
||||
blueprintsTotal: number;
|
||||
|
|
@ -62,7 +61,6 @@ type emptyBlueprintStateProps = {
|
|||
|
||||
const BlueprintsSidebar = () => {
|
||||
const [userData, setUserData] = useState<ChromeUser | void>(undefined);
|
||||
const { isFedoraEnv } = useGetEnvironment();
|
||||
const { analytics, auth } = useChrome();
|
||||
|
||||
const selectedBlueprintId = useAppSelector(selectSelectedBlueprintId);
|
||||
|
|
@ -124,7 +122,7 @@ const BlueprintsSidebar = () => {
|
|||
dispatch(setBlueprintId(undefined));
|
||||
};
|
||||
|
||||
if (!process.env.IS_ON_PREMISE && !isFedoraEnv) {
|
||||
if (!process.env.IS_ON_PREMISE) {
|
||||
const orgId = userData?.identity?.internal?.org_id;
|
||||
|
||||
analytics.group(orgId, {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ import {
|
|||
RHEL_10_BETA,
|
||||
RHEL_10,
|
||||
AARCH64,
|
||||
CENTOS_9,
|
||||
AMPLITUDE_MODULE_NAME,
|
||||
RHEL_9,
|
||||
} from '../../constants';
|
||||
|
|
@ -88,11 +87,10 @@ import {
|
|||
selectGcpShareMethod,
|
||||
selectImageTypes,
|
||||
addImageType,
|
||||
changeRegistrationType,
|
||||
} from '../../store/wizardSlice';
|
||||
import isRhel from '../../Utilities/isRhel';
|
||||
import { resolveRelPath } from '../../Utilities/path';
|
||||
import { useFlag, useGetEnvironment } from '../../Utilities/useGetEnvironment';
|
||||
import { useFlag } from '../../Utilities/useGetEnvironment';
|
||||
import { ImageBuilderHeader } from '../sharedComponents/ImageBuilderHeader';
|
||||
|
||||
type CustomWizardFooterPropType = {
|
||||
|
|
@ -197,17 +195,13 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
|
|||
const navigate = useNavigate();
|
||||
const dispatch = useAppDispatch();
|
||||
const [searchParams] = useSearchParams();
|
||||
const { isFedoraEnv } = useGetEnvironment();
|
||||
|
||||
// Feature flags
|
||||
const complianceEnabled = useFlag('image-builder.compliance.enabled');
|
||||
|
||||
// IMPORTANT: Ensure the wizard starts with a fresh initial state
|
||||
useEffect(() => {
|
||||
dispatch(initializeWizard());
|
||||
if (isFedoraEnv) {
|
||||
dispatch(changeDistribution(CENTOS_9));
|
||||
dispatch(changeRegistrationType('register-later'));
|
||||
}
|
||||
if (searchParams.get('release') === 'rhel8') {
|
||||
dispatch(changeDistribution(RHEL_8));
|
||||
}
|
||||
|
|
@ -331,14 +325,14 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
|
|||
);
|
||||
|
||||
// Only this code is different from the original
|
||||
const status = (step?.id !== activeStep?.id && step?.status) || 'default';
|
||||
const status = (step.id !== activeStep.id && step.status) || 'default';
|
||||
|
||||
return (
|
||||
<WizardNavItem
|
||||
key={step?.id}
|
||||
id={step?.id}
|
||||
key={step.id}
|
||||
id={step.id}
|
||||
content={step.name}
|
||||
isCurrent={activeStep?.id === step?.id}
|
||||
isCurrent={activeStep.id === step.id}
|
||||
isDisabled={
|
||||
step.isDisabled ||
|
||||
(!step.isVisited &&
|
||||
|
|
@ -523,9 +517,7 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
|
|||
navItem={CustomStatusNavItem}
|
||||
status={snapshotValidation.disabledNext ? 'error' : 'default'}
|
||||
isHidden={
|
||||
distribution === RHEL_10_BETA ||
|
||||
!!process.env.IS_ON_PREMISE ||
|
||||
isFedoraEnv
|
||||
distribution === RHEL_10_BETA || !!process.env.IS_ON_PREMISE
|
||||
}
|
||||
footer={
|
||||
<CustomWizardFooter
|
||||
|
|
@ -542,9 +534,7 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
|
|||
key="wizard-custom-repositories"
|
||||
navItem={CustomStatusNavItem}
|
||||
isHidden={
|
||||
distribution === RHEL_10_BETA ||
|
||||
!!process.env.IS_ON_PREMISE ||
|
||||
isFedoraEnv
|
||||
distribution === RHEL_10_BETA || !!process.env.IS_ON_PREMISE
|
||||
}
|
||||
isDisabled={snapshotValidation.disabledNext}
|
||||
footer={
|
||||
|
|
@ -558,7 +548,6 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
|
|||
id="wizard-additional-packages"
|
||||
key="wizard-additional-packages"
|
||||
navItem={CustomStatusNavItem}
|
||||
isHidden={isFedoraEnv}
|
||||
isDisabled={snapshotValidation.disabledNext}
|
||||
footer={
|
||||
<CustomWizardFooter disableNext={false} optional={true} />
|
||||
|
|
@ -677,7 +666,7 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
|
|||
key="wizard-first-boot"
|
||||
navItem={CustomStatusNavItem}
|
||||
status={firstBootValidation.disabledNext ? 'error' : 'default'}
|
||||
isHidden={!!process.env.IS_ON_PREMISE || isFedoraEnv}
|
||||
isHidden={!!process.env.IS_ON_PREMISE}
|
||||
footer={
|
||||
<CustomWizardFooter
|
||||
disableNext={firstBootValidation.disabledNext}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import {
|
|||
RHEL_10_FULL_SUPPORT,
|
||||
RHEL_10_MAINTENANCE_SUPPORT,
|
||||
ON_PREM_RELEASES,
|
||||
FEDORA_RELEASES,
|
||||
} from '../../../../../constants';
|
||||
import { useAppDispatch, useAppSelector } from '../../../../../store/hooks';
|
||||
import { Distributions } from '../../../../../store/imageBuilderApi';
|
||||
|
|
@ -34,10 +33,7 @@ import {
|
|||
} from '../../../../../store/wizardSlice';
|
||||
import isRhel from '../../../../../Utilities/isRhel';
|
||||
import { toMonthAndYear } from '../../../../../Utilities/time';
|
||||
import {
|
||||
useFlag,
|
||||
useGetEnvironment,
|
||||
} from '../../../../../Utilities/useGetEnvironment';
|
||||
import { useFlag } from '../../../../../Utilities/useGetEnvironment';
|
||||
|
||||
const ReleaseSelect = () => {
|
||||
// What the UI refers to as the "release" is referred to as the "distribution" in the API.
|
||||
|
|
@ -46,18 +42,12 @@ const ReleaseSelect = () => {
|
|||
const distribution = useAppSelector(selectDistribution);
|
||||
const dispatch = useAppDispatch();
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const { isFedoraEnv } = useGetEnvironment();
|
||||
const [showDevelopmentOptions, setShowDevelopmentOptions] =
|
||||
useState(isFedoraEnv);
|
||||
const [showDevelopmentOptions, setShowDevelopmentOptions] = useState(false);
|
||||
|
||||
const isRHEL9BetaEnabled = useFlag('image-builder.rhel9.beta.enabled');
|
||||
const isRHEL10BetaEnabled = useFlag('image-builder.rhel10.beta.enabled');
|
||||
|
||||
const releases = isFedoraEnv
|
||||
? FEDORA_RELEASES
|
||||
: process.env.IS_ON_PREMISE
|
||||
? ON_PREM_RELEASES
|
||||
: RELEASES;
|
||||
const releases = process.env.IS_ON_PREMISE ? ON_PREM_RELEASES : RELEASES;
|
||||
|
||||
const handleSelect = (_event: React.MouseEvent, selection: Distributions) => {
|
||||
if (selection !== ('loader' as Distributions)) {
|
||||
|
|
|
|||
|
|
@ -31,8 +31,6 @@ import {
|
|||
selectDistribution,
|
||||
selectImageTypes,
|
||||
} from '../../../../../store/wizardSlice';
|
||||
import isRhel from '../../../../../Utilities/isRhel';
|
||||
import { useGetEnvironment } from '../../../../../Utilities/useGetEnvironment';
|
||||
|
||||
type TargetEnvironmentCardProps = {
|
||||
title: string;
|
||||
|
|
@ -101,14 +99,10 @@ const TargetEnvironment = () => {
|
|||
const arch = useAppSelector(selectArchitecture);
|
||||
const environments = useAppSelector(selectImageTypes);
|
||||
const distribution = useAppSelector(selectDistribution);
|
||||
const { isFedoraEnv } = useGetEnvironment();
|
||||
|
||||
const { data } = useGetArchitecturesQuery(
|
||||
{
|
||||
distribution: distribution,
|
||||
},
|
||||
{ skip: isFedoraEnv && isRhel(distribution) }
|
||||
);
|
||||
const { data } = useGetArchitecturesQuery({
|
||||
distribution: distribution,
|
||||
});
|
||||
// TODO: Handle isFetching state (add skeletons)
|
||||
// TODO: Handle isError state (very unlikely...)
|
||||
|
||||
|
|
@ -120,7 +114,7 @@ const TargetEnvironment = () => {
|
|||
const prefetchActivationKeys = rhsmApi.usePrefetch('listActivationKeys');
|
||||
|
||||
useEffect(() => {
|
||||
if (!isFedoraEnv) prefetchActivationKeys();
|
||||
prefetchActivationKeys();
|
||||
}, []);
|
||||
|
||||
const supportedEnvironments = data?.find(
|
||||
|
|
|
|||
|
|
@ -37,16 +37,12 @@ import {
|
|||
selectComplianceType,
|
||||
clearKernelAppend,
|
||||
} from '../../../../store/wizardSlice';
|
||||
import {
|
||||
useFlag,
|
||||
useGetEnvironment,
|
||||
} from '../../../../Utilities/useGetEnvironment';
|
||||
import { useFlag } from '../../../../Utilities/useGetEnvironment';
|
||||
import { useOnPremOpenSCAPAvailable } from '../../../../Utilities/useOnPremOpenSCAP';
|
||||
|
||||
const OscapContent = () => {
|
||||
const dispatch = useAppDispatch();
|
||||
const { analytics } = useChrome();
|
||||
const { isFedoraEnv } = useGetEnvironment();
|
||||
const complianceEnabled = useFlag('image-builder.compliance.enabled');
|
||||
const complianceType = useAppSelector(selectComplianceType);
|
||||
const profileID = useAppSelector(selectComplianceProfileID);
|
||||
|
|
@ -93,7 +89,7 @@ const OscapContent = () => {
|
|||
dispatch(clearKernelAppend());
|
||||
};
|
||||
|
||||
if (!process.env.IS_ON_PREMISE && !isFedoraEnv) {
|
||||
if (!process.env.IS_ON_PREMISE) {
|
||||
if (complianceEnabled) {
|
||||
analytics.screen('ib-createimagewizard-step-security-compliance');
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import {
|
|||
} from '../../../../../store/imageBuilderApi';
|
||||
import { selectPackages } from '../../../../../store/wizardSlice';
|
||||
import { createAnalytics } from '../../../../../Utilities/analytics';
|
||||
import { useGetEnvironment } from '../../../../../Utilities/useGetEnvironment';
|
||||
|
||||
type CreateDropdownProps = {
|
||||
getBlueprintPayload: () => Promise<'' | CreateBlueprintRequest | undefined>;
|
||||
|
|
@ -52,12 +51,11 @@ export const CreateSaveAndBuildBtn = ({
|
|||
fixedCacheKey: 'createBlueprintKey',
|
||||
});
|
||||
const dispatch = useAppDispatch();
|
||||
const { isFedoraEnv } = useGetEnvironment();
|
||||
const onSaveAndBuild = async () => {
|
||||
const requestBody = await getBlueprintPayload();
|
||||
setIsOpen(false);
|
||||
|
||||
if (!process.env.IS_ON_PREMISE && !isFedoraEnv && requestBody) {
|
||||
if (!process.env.IS_ON_PREMISE && requestBody) {
|
||||
const analyticsData = createAnalytics(requestBody, packages, isBeta);
|
||||
analytics.track(`${AMPLITUDE_MODULE_NAME} - Blueprint Created`, {
|
||||
...analyticsData,
|
||||
|
|
@ -108,7 +106,6 @@ export const CreateSaveButton = ({
|
|||
})();
|
||||
}, [auth]);
|
||||
const packages = useAppSelector(selectPackages);
|
||||
const { isFedoraEnv } = useGetEnvironment();
|
||||
|
||||
const [createBlueprint, { isLoading }] = useCreateBlueprintMutation({
|
||||
fixedCacheKey: 'createBlueprintKey',
|
||||
|
|
@ -161,7 +158,7 @@ export const CreateSaveButton = ({
|
|||
const requestBody = await getBlueprintPayload();
|
||||
setIsOpen(false);
|
||||
|
||||
if (!process.env.IS_ON_PREMISE && !isFedoraEnv && requestBody) {
|
||||
if (!process.env.IS_ON_PREMISE && requestBody) {
|
||||
const analyticsData = createAnalytics(requestBody, packages, isBeta);
|
||||
analytics.track(`${AMPLITUDE_MODULE_NAME} - Blueprint Created`, {
|
||||
...analyticsData,
|
||||
|
|
@ -169,11 +166,13 @@ export const CreateSaveButton = ({
|
|||
account_id: userData?.identity.internal?.account_id || 'Not found',
|
||||
});
|
||||
}
|
||||
|
||||
const blueprint =
|
||||
requestBody &&
|
||||
(await createBlueprint({
|
||||
createBlueprintRequest: requestBody,
|
||||
}).unwrap());
|
||||
|
||||
if (blueprint) {
|
||||
dispatch(setBlueprintId(blueprint?.id));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import {
|
|||
useUpdateBlueprintMutation,
|
||||
} from '../../../../../store/backendApi';
|
||||
import { resolveRelPath } from '../../../../../Utilities/path';
|
||||
import { useGetEnvironment } from '../../../../../Utilities/useGetEnvironment';
|
||||
import { mapRequestFromState } from '../../../utilities/requestMapper';
|
||||
import { useIsBlueprintValid } from '../../../utilities/useValidation';
|
||||
|
||||
|
|
@ -35,7 +34,6 @@ const ReviewWizardFooter = () => {
|
|||
useUpdateBlueprintMutation({ fixedCacheKey: 'updateBlueprintKey' });
|
||||
const { auth } = useChrome();
|
||||
const { composeId } = useParams();
|
||||
const { isFedoraEnv } = useGetEnvironment();
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const store = useStore();
|
||||
const onToggleClick = () => {
|
||||
|
|
@ -53,7 +51,7 @@ const ReviewWizardFooter = () => {
|
|||
}, [isUpdateSuccess, isCreateSuccess, resetCreate, resetUpdate, navigate]);
|
||||
|
||||
const getBlueprintPayload = async () => {
|
||||
if (!process.env.IS_ON_PREMISE && !isFedoraEnv) {
|
||||
if (!process.env.IS_ON_PREMISE) {
|
||||
const userData = await auth?.getUser();
|
||||
const orgId = userData?.identity?.internal?.org_id;
|
||||
const requestBody = orgId && mapRequestFromState(store, orgId);
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ import {
|
|||
selectUsers,
|
||||
selectKernel,
|
||||
} from '../../../../store/wizardSlice';
|
||||
import { useGetEnvironment } from '../../../../Utilities/useGetEnvironment';
|
||||
|
||||
const Review = () => {
|
||||
const { goToStepById } = useWizardContext();
|
||||
|
|
@ -187,7 +186,6 @@ const Review = () => {
|
|||
);
|
||||
};
|
||||
|
||||
const { isFedoraEnv } = useGetEnvironment();
|
||||
return (
|
||||
<>
|
||||
<ExpandableSection
|
||||
|
|
@ -359,23 +357,21 @@ const Review = () => {
|
|||
>
|
||||
<FSCList />
|
||||
</ExpandableSection>
|
||||
{!isFedoraEnv && (
|
||||
<ExpandableSection
|
||||
toggleContent={composeExpandable(
|
||||
'Content',
|
||||
'revisit-custom-repositories',
|
||||
'wizard-custom-repositories'
|
||||
)}
|
||||
onToggle={(_event, isExpandedContent) =>
|
||||
onToggleContent(isExpandedContent)
|
||||
}
|
||||
isExpanded={isExpandedContent}
|
||||
isIndented
|
||||
data-testid="content-expandable"
|
||||
>
|
||||
<ContentList />
|
||||
</ExpandableSection>
|
||||
)}
|
||||
<ExpandableSection
|
||||
toggleContent={composeExpandable(
|
||||
'Content',
|
||||
'revisit-custom-repositories',
|
||||
'wizard-custom-repositories'
|
||||
)}
|
||||
onToggle={(_event, isExpandedContent) =>
|
||||
onToggleContent(isExpandedContent)
|
||||
}
|
||||
isExpanded={isExpandedContent}
|
||||
isIndented
|
||||
data-testid="content-expandable"
|
||||
>
|
||||
<ContentList />
|
||||
</ExpandableSection>
|
||||
{users.length > 0 && (
|
||||
<ExpandableSection
|
||||
toggleContent={composeExpandable(
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import {
|
|||
import { FSReviewTable } from './ReviewStepTables';
|
||||
|
||||
import {
|
||||
FEDORA_RELEASES,
|
||||
ON_PREM_RELEASES,
|
||||
RELEASES,
|
||||
RHEL_10,
|
||||
|
|
@ -81,7 +80,6 @@ import {
|
|||
selectRedHatRepositories,
|
||||
} from '../../../../store/wizardSlice';
|
||||
import { toMonthAndYear, yyyyMMddFormat } from '../../../../Utilities/time';
|
||||
import { useGetEnvironment } from '../../../../Utilities/useGetEnvironment';
|
||||
import {
|
||||
getConversionFactor,
|
||||
MinimumSizePopover,
|
||||
|
|
@ -106,12 +104,8 @@ const ExpirationWarning = () => {
|
|||
export const ImageOutputList = () => {
|
||||
const distribution = useAppSelector(selectDistribution);
|
||||
const arch = useAppSelector(selectArchitecture);
|
||||
const { isFedoraEnv } = useGetEnvironment();
|
||||
const releases = isFedoraEnv
|
||||
? FEDORA_RELEASES
|
||||
: process.env.IS_ON_PREMISE
|
||||
? ON_PREM_RELEASES
|
||||
: RELEASES;
|
||||
const releases = process.env.IS_ON_PREMISE ? ON_PREM_RELEASES : RELEASES;
|
||||
|
||||
return (
|
||||
<Content>
|
||||
{(distribution === RHEL_8 || distribution === RHEL_9) && (
|
||||
|
|
|
|||
|
|
@ -87,7 +87,6 @@ import {
|
|||
timestampToDisplayString,
|
||||
timestampToDisplayStringDetailed,
|
||||
} from '../../Utilities/time';
|
||||
import { useGetEnvironment } from '../../Utilities/useGetEnvironment';
|
||||
|
||||
const ImagesTable = () => {
|
||||
const [page, setPage] = useState(1);
|
||||
|
|
@ -104,7 +103,6 @@ const ImagesTable = () => {
|
|||
const blueprintsOffset = useAppSelector(selectOffset) || PAGINATION_OFFSET;
|
||||
const blueprintsLimit = useAppSelector(selectLimit) || PAGINATION_LIMIT;
|
||||
|
||||
const { isFedoraEnv } = useGetEnvironment();
|
||||
const { analytics, auth } = useChrome();
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
|
|
@ -225,7 +223,7 @@ const ImagesTable = () => {
|
|||
}
|
||||
const itemCount = data?.meta.count || 0;
|
||||
|
||||
if (!process.env.IS_ON_PREMISE && !isFedoraEnv) {
|
||||
if (!process.env.IS_ON_PREMISE) {
|
||||
const orgId = userData?.identity.internal?.org_id;
|
||||
|
||||
analytics.group(orgId, {
|
||||
|
|
|
|||
|
|
@ -2,19 +2,14 @@ import { useChrome } from '@redhat-cloud-services/frontend-components/useChrome'
|
|||
import { useFlag as useUnleashFlag } from '@unleash/proxy-client-react';
|
||||
|
||||
export const useGetEnvironment = process.env.IS_ON_PREMISE
|
||||
? () => ({ isBeta: () => false, isProd: () => true, isFedoraEnv: false })
|
||||
? () => ({ isBeta: () => false, isProd: () => true })
|
||||
: () => {
|
||||
const { isBeta, isProd, getEnvironment, getEnvironmentDetails } =
|
||||
useChrome();
|
||||
const { isBeta, isProd, getEnvironment } = useChrome();
|
||||
// Expose beta features in the ephemeral environment
|
||||
const isFedoraEnv: boolean =
|
||||
getEnvironmentDetails()?.url.some((x: string) =>
|
||||
x.includes('fedora')
|
||||
) ?? false;
|
||||
if (isBeta() || getEnvironment() === 'qa') {
|
||||
return { isBeta: () => true, isProd: isProd, isFedoraEnv };
|
||||
return { isBeta: () => true, isProd: isProd };
|
||||
}
|
||||
return { isBeta: () => false, isProd: isProd, isFedoraEnv };
|
||||
return { isBeta: () => false, isProd: isProd };
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -48,12 +43,4 @@ const onPremFlag = (flag: string): boolean => {
|
|||
|
||||
// Since some of these flags are only relevant to
|
||||
// the service, we need a way of bypassing this for on-prem
|
||||
export const useFlag = (flag: string) => {
|
||||
const { isFedoraEnv } = useGetEnvironment();
|
||||
|
||||
const onPremFlagValue = onPremFlag(flag);
|
||||
const unleashFlagValue = useUnleashFlag(flag);
|
||||
const shouldUseOnPrem = process.env.IS_ON_PREMISE || isFedoraEnv;
|
||||
|
||||
return shouldUseOnPrem ? onPremFlagValue : unleashFlagValue;
|
||||
};
|
||||
export const useFlag = !process.env.IS_ON_PREMISE ? useUnleashFlag : onPremFlag;
|
||||
|
|
|
|||
|
|
@ -107,13 +107,6 @@ export const ON_PREM_RELEASES = new Map([
|
|||
[RHEL_10, 'Red Hat Enterprise Linux (RHEL) 10'],
|
||||
]);
|
||||
|
||||
export const FEDORA_RELEASES = new Map([
|
||||
[FEDORA_41, 'Fedora Linux 41'],
|
||||
[FEDORA_42, 'Fedora Linux 42'],
|
||||
[CENTOS_9, 'CentOS Stream 9'],
|
||||
[CENTOS_10, 'CentOS Stream 10'],
|
||||
]);
|
||||
|
||||
export const RHEL_10_FULL_SUPPORT = ['2025-05-13', '2030-05-31'];
|
||||
export const RHEL_9_FULL_SUPPORT = ['2022-05-18', '2027-05-31'];
|
||||
export const RHEL_8_FULL_SUPPORT = ['2019-05-07', '2024-05-31'];
|
||||
|
|
|
|||
|
|
@ -1,97 +0,0 @@
|
|||
import { screen } from '@testing-library/react';
|
||||
import { waitFor } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
|
||||
import {
|
||||
blueprintRequest,
|
||||
clickNext,
|
||||
enterBlueprintName,
|
||||
interceptBlueprintRequest,
|
||||
interceptEditBlueprintRequest,
|
||||
renderCreateMode,
|
||||
renderEditMode,
|
||||
selectGuestImageTarget,
|
||||
} from './Components/CreateImageWizard/wizardTestUtils';
|
||||
import { mockBlueprintIds } from './fixtures/blueprints';
|
||||
import { centos9CreateBlueprintRequest } from './fixtures/editMode';
|
||||
|
||||
import { CREATE_BLUEPRINT, EDIT_BLUEPRINT } from '../constants';
|
||||
|
||||
const goToDetailsStep = async () => {
|
||||
await clickNext(); // OpenSCAP
|
||||
await clickNext(); // File system configuration
|
||||
await clickNext(); // Users
|
||||
await clickNext(); // Timezone
|
||||
await clickNext(); // Locale
|
||||
await clickNext(); // Hostname
|
||||
await clickNext(); // Kernel
|
||||
await clickNext(); // Firewall
|
||||
await clickNext(); // Services
|
||||
await clickNext(); // Details
|
||||
};
|
||||
|
||||
describe('Fedora Services', () => {
|
||||
beforeAll(async () => {
|
||||
vi.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
|
||||
useChrome: () => ({
|
||||
auth: {
|
||||
getUser: () => ({
|
||||
identity: {
|
||||
internal: { org_id: 5 },
|
||||
},
|
||||
}),
|
||||
},
|
||||
isBeta: () => true,
|
||||
isProd: () => true,
|
||||
getEnvironment: () => 'prod',
|
||||
getEnvironmentDetails: () => ({
|
||||
url: ['console.fedorainfracloud.org'],
|
||||
}),
|
||||
}),
|
||||
default: () => ({
|
||||
analytics: {
|
||||
track: () => 'test',
|
||||
},
|
||||
isBeta: () => true,
|
||||
}),
|
||||
}));
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
vi.resetModules();
|
||||
});
|
||||
|
||||
test('edit a blueprint', async () => {
|
||||
const id = mockBlueprintIds['centos9'];
|
||||
await renderEditMode(id);
|
||||
// starts on review step
|
||||
const receivedRequest = await interceptEditBlueprintRequest(
|
||||
`${EDIT_BLUEPRINT}/${id}`
|
||||
);
|
||||
const expectedRequest = centos9CreateBlueprintRequest;
|
||||
await waitFor(() => expect(receivedRequest).toEqual(expectedRequest));
|
||||
});
|
||||
|
||||
test('renders wizard with hidden steps', async () => {
|
||||
const user = userEvent.setup();
|
||||
await renderCreateMode();
|
||||
await selectGuestImageTarget();
|
||||
await goToDetailsStep();
|
||||
await enterBlueprintName('CentOS Blueprint');
|
||||
await clickNext();
|
||||
|
||||
const createBlueprintBtn = await screen.findByRole('button', {
|
||||
name: 'Create blueprint',
|
||||
});
|
||||
user.click(createBlueprintBtn);
|
||||
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
|
||||
|
||||
const expectedRequest = {
|
||||
...blueprintRequest,
|
||||
name: 'CentOS Blueprint',
|
||||
distribution: 'centos-9',
|
||||
};
|
||||
|
||||
await waitFor(() => expect(receivedRequest).toEqual(expectedRequest));
|
||||
});
|
||||
});
|
||||
|
|
@ -2,7 +2,6 @@ import '@testing-library/jest-dom';
|
|||
import { configure } from '@testing-library/react';
|
||||
|
||||
import { server } from './mocks/server';
|
||||
|
||||
import 'vitest-canvas-mock';
|
||||
|
||||
// scrollTo is not defined in jsdom - needed for the navigation to the wizard
|
||||
|
|
@ -32,9 +31,6 @@ vi.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
|
|||
isBeta: () => true,
|
||||
isProd: () => true,
|
||||
getEnvironment: () => 'prod',
|
||||
getEnvironmentDetails: () => ({
|
||||
url: ['https://console.redhat.com'],
|
||||
}),
|
||||
}),
|
||||
default: () => ({
|
||||
analytics: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue