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';
|
} from '../../store/imageBuilderApi';
|
||||||
import { imageBuilderApi } from '../../store/service/enhancedImageBuilderApi';
|
import { imageBuilderApi } from '../../store/service/enhancedImageBuilderApi';
|
||||||
import { resolveRelPath } from '../../Utilities/path';
|
import { resolveRelPath } from '../../Utilities/path';
|
||||||
import { useGetEnvironment } from '../../Utilities/useGetEnvironment';
|
|
||||||
|
|
||||||
type blueprintSearchProps = {
|
type blueprintSearchProps = {
|
||||||
blueprintsTotal: number;
|
blueprintsTotal: number;
|
||||||
|
|
@ -62,7 +61,6 @@ type emptyBlueprintStateProps = {
|
||||||
|
|
||||||
const BlueprintsSidebar = () => {
|
const BlueprintsSidebar = () => {
|
||||||
const [userData, setUserData] = useState<ChromeUser | void>(undefined);
|
const [userData, setUserData] = useState<ChromeUser | void>(undefined);
|
||||||
const { isFedoraEnv } = useGetEnvironment();
|
|
||||||
const { analytics, auth } = useChrome();
|
const { analytics, auth } = useChrome();
|
||||||
|
|
||||||
const selectedBlueprintId = useAppSelector(selectSelectedBlueprintId);
|
const selectedBlueprintId = useAppSelector(selectSelectedBlueprintId);
|
||||||
|
|
@ -124,7 +122,7 @@ const BlueprintsSidebar = () => {
|
||||||
dispatch(setBlueprintId(undefined));
|
dispatch(setBlueprintId(undefined));
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!process.env.IS_ON_PREMISE && !isFedoraEnv) {
|
if (!process.env.IS_ON_PREMISE) {
|
||||||
const orgId = userData?.identity?.internal?.org_id;
|
const orgId = userData?.identity?.internal?.org_id;
|
||||||
|
|
||||||
analytics.group(orgId, {
|
analytics.group(orgId, {
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,6 @@ import {
|
||||||
RHEL_10_BETA,
|
RHEL_10_BETA,
|
||||||
RHEL_10,
|
RHEL_10,
|
||||||
AARCH64,
|
AARCH64,
|
||||||
CENTOS_9,
|
|
||||||
AMPLITUDE_MODULE_NAME,
|
AMPLITUDE_MODULE_NAME,
|
||||||
RHEL_9,
|
RHEL_9,
|
||||||
} from '../../constants';
|
} from '../../constants';
|
||||||
|
|
@ -88,11 +87,10 @@ import {
|
||||||
selectGcpShareMethod,
|
selectGcpShareMethod,
|
||||||
selectImageTypes,
|
selectImageTypes,
|
||||||
addImageType,
|
addImageType,
|
||||||
changeRegistrationType,
|
|
||||||
} from '../../store/wizardSlice';
|
} from '../../store/wizardSlice';
|
||||||
import isRhel from '../../Utilities/isRhel';
|
import isRhel from '../../Utilities/isRhel';
|
||||||
import { resolveRelPath } from '../../Utilities/path';
|
import { resolveRelPath } from '../../Utilities/path';
|
||||||
import { useFlag, useGetEnvironment } from '../../Utilities/useGetEnvironment';
|
import { useFlag } from '../../Utilities/useGetEnvironment';
|
||||||
import { ImageBuilderHeader } from '../sharedComponents/ImageBuilderHeader';
|
import { ImageBuilderHeader } from '../sharedComponents/ImageBuilderHeader';
|
||||||
|
|
||||||
type CustomWizardFooterPropType = {
|
type CustomWizardFooterPropType = {
|
||||||
|
|
@ -197,17 +195,13 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const { isFedoraEnv } = useGetEnvironment();
|
|
||||||
// Feature flags
|
// Feature flags
|
||||||
const complianceEnabled = useFlag('image-builder.compliance.enabled');
|
const complianceEnabled = useFlag('image-builder.compliance.enabled');
|
||||||
|
|
||||||
// IMPORTANT: Ensure the wizard starts with a fresh initial state
|
// IMPORTANT: Ensure the wizard starts with a fresh initial state
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(initializeWizard());
|
dispatch(initializeWizard());
|
||||||
if (isFedoraEnv) {
|
|
||||||
dispatch(changeDistribution(CENTOS_9));
|
|
||||||
dispatch(changeRegistrationType('register-later'));
|
|
||||||
}
|
|
||||||
if (searchParams.get('release') === 'rhel8') {
|
if (searchParams.get('release') === 'rhel8') {
|
||||||
dispatch(changeDistribution(RHEL_8));
|
dispatch(changeDistribution(RHEL_8));
|
||||||
}
|
}
|
||||||
|
|
@ -331,14 +325,14 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Only this code is different from the original
|
// 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 (
|
return (
|
||||||
<WizardNavItem
|
<WizardNavItem
|
||||||
key={step?.id}
|
key={step.id}
|
||||||
id={step?.id}
|
id={step.id}
|
||||||
content={step.name}
|
content={step.name}
|
||||||
isCurrent={activeStep?.id === step?.id}
|
isCurrent={activeStep.id === step.id}
|
||||||
isDisabled={
|
isDisabled={
|
||||||
step.isDisabled ||
|
step.isDisabled ||
|
||||||
(!step.isVisited &&
|
(!step.isVisited &&
|
||||||
|
|
@ -523,9 +517,7 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
|
||||||
navItem={CustomStatusNavItem}
|
navItem={CustomStatusNavItem}
|
||||||
status={snapshotValidation.disabledNext ? 'error' : 'default'}
|
status={snapshotValidation.disabledNext ? 'error' : 'default'}
|
||||||
isHidden={
|
isHidden={
|
||||||
distribution === RHEL_10_BETA ||
|
distribution === RHEL_10_BETA || !!process.env.IS_ON_PREMISE
|
||||||
!!process.env.IS_ON_PREMISE ||
|
|
||||||
isFedoraEnv
|
|
||||||
}
|
}
|
||||||
footer={
|
footer={
|
||||||
<CustomWizardFooter
|
<CustomWizardFooter
|
||||||
|
|
@ -542,9 +534,7 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
|
||||||
key="wizard-custom-repositories"
|
key="wizard-custom-repositories"
|
||||||
navItem={CustomStatusNavItem}
|
navItem={CustomStatusNavItem}
|
||||||
isHidden={
|
isHidden={
|
||||||
distribution === RHEL_10_BETA ||
|
distribution === RHEL_10_BETA || !!process.env.IS_ON_PREMISE
|
||||||
!!process.env.IS_ON_PREMISE ||
|
|
||||||
isFedoraEnv
|
|
||||||
}
|
}
|
||||||
isDisabled={snapshotValidation.disabledNext}
|
isDisabled={snapshotValidation.disabledNext}
|
||||||
footer={
|
footer={
|
||||||
|
|
@ -558,7 +548,6 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
|
||||||
id="wizard-additional-packages"
|
id="wizard-additional-packages"
|
||||||
key="wizard-additional-packages"
|
key="wizard-additional-packages"
|
||||||
navItem={CustomStatusNavItem}
|
navItem={CustomStatusNavItem}
|
||||||
isHidden={isFedoraEnv}
|
|
||||||
isDisabled={snapshotValidation.disabledNext}
|
isDisabled={snapshotValidation.disabledNext}
|
||||||
footer={
|
footer={
|
||||||
<CustomWizardFooter disableNext={false} optional={true} />
|
<CustomWizardFooter disableNext={false} optional={true} />
|
||||||
|
|
@ -677,7 +666,7 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
|
||||||
key="wizard-first-boot"
|
key="wizard-first-boot"
|
||||||
navItem={CustomStatusNavItem}
|
navItem={CustomStatusNavItem}
|
||||||
status={firstBootValidation.disabledNext ? 'error' : 'default'}
|
status={firstBootValidation.disabledNext ? 'error' : 'default'}
|
||||||
isHidden={!!process.env.IS_ON_PREMISE || isFedoraEnv}
|
isHidden={!!process.env.IS_ON_PREMISE}
|
||||||
footer={
|
footer={
|
||||||
<CustomWizardFooter
|
<CustomWizardFooter
|
||||||
disableNext={firstBootValidation.disabledNext}
|
disableNext={firstBootValidation.disabledNext}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import {
|
||||||
RHEL_10_FULL_SUPPORT,
|
RHEL_10_FULL_SUPPORT,
|
||||||
RHEL_10_MAINTENANCE_SUPPORT,
|
RHEL_10_MAINTENANCE_SUPPORT,
|
||||||
ON_PREM_RELEASES,
|
ON_PREM_RELEASES,
|
||||||
FEDORA_RELEASES,
|
|
||||||
} from '../../../../../constants';
|
} from '../../../../../constants';
|
||||||
import { useAppDispatch, useAppSelector } from '../../../../../store/hooks';
|
import { useAppDispatch, useAppSelector } from '../../../../../store/hooks';
|
||||||
import { Distributions } from '../../../../../store/imageBuilderApi';
|
import { Distributions } from '../../../../../store/imageBuilderApi';
|
||||||
|
|
@ -34,10 +33,7 @@ import {
|
||||||
} from '../../../../../store/wizardSlice';
|
} from '../../../../../store/wizardSlice';
|
||||||
import isRhel from '../../../../../Utilities/isRhel';
|
import isRhel from '../../../../../Utilities/isRhel';
|
||||||
import { toMonthAndYear } from '../../../../../Utilities/time';
|
import { toMonthAndYear } from '../../../../../Utilities/time';
|
||||||
import {
|
import { useFlag } from '../../../../../Utilities/useGetEnvironment';
|
||||||
useFlag,
|
|
||||||
useGetEnvironment,
|
|
||||||
} from '../../../../../Utilities/useGetEnvironment';
|
|
||||||
|
|
||||||
const ReleaseSelect = () => {
|
const ReleaseSelect = () => {
|
||||||
// What the UI refers to as the "release" is referred to as the "distribution" in the API.
|
// 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 distribution = useAppSelector(selectDistribution);
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const { isFedoraEnv } = useGetEnvironment();
|
const [showDevelopmentOptions, setShowDevelopmentOptions] = useState(false);
|
||||||
const [showDevelopmentOptions, setShowDevelopmentOptions] =
|
|
||||||
useState(isFedoraEnv);
|
|
||||||
|
|
||||||
const isRHEL9BetaEnabled = useFlag('image-builder.rhel9.beta.enabled');
|
const isRHEL9BetaEnabled = useFlag('image-builder.rhel9.beta.enabled');
|
||||||
const isRHEL10BetaEnabled = useFlag('image-builder.rhel10.beta.enabled');
|
const isRHEL10BetaEnabled = useFlag('image-builder.rhel10.beta.enabled');
|
||||||
|
|
||||||
const releases = isFedoraEnv
|
const releases = process.env.IS_ON_PREMISE ? ON_PREM_RELEASES : RELEASES;
|
||||||
? FEDORA_RELEASES
|
|
||||||
: process.env.IS_ON_PREMISE
|
|
||||||
? ON_PREM_RELEASES
|
|
||||||
: RELEASES;
|
|
||||||
|
|
||||||
const handleSelect = (_event: React.MouseEvent, selection: Distributions) => {
|
const handleSelect = (_event: React.MouseEvent, selection: Distributions) => {
|
||||||
if (selection !== ('loader' as Distributions)) {
|
if (selection !== ('loader' as Distributions)) {
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,6 @@ import {
|
||||||
selectDistribution,
|
selectDistribution,
|
||||||
selectImageTypes,
|
selectImageTypes,
|
||||||
} from '../../../../../store/wizardSlice';
|
} from '../../../../../store/wizardSlice';
|
||||||
import isRhel from '../../../../../Utilities/isRhel';
|
|
||||||
import { useGetEnvironment } from '../../../../../Utilities/useGetEnvironment';
|
|
||||||
|
|
||||||
type TargetEnvironmentCardProps = {
|
type TargetEnvironmentCardProps = {
|
||||||
title: string;
|
title: string;
|
||||||
|
|
@ -101,14 +99,10 @@ const TargetEnvironment = () => {
|
||||||
const arch = useAppSelector(selectArchitecture);
|
const arch = useAppSelector(selectArchitecture);
|
||||||
const environments = useAppSelector(selectImageTypes);
|
const environments = useAppSelector(selectImageTypes);
|
||||||
const distribution = useAppSelector(selectDistribution);
|
const distribution = useAppSelector(selectDistribution);
|
||||||
const { isFedoraEnv } = useGetEnvironment();
|
|
||||||
|
|
||||||
const { data } = useGetArchitecturesQuery(
|
const { data } = useGetArchitecturesQuery({
|
||||||
{
|
distribution: distribution,
|
||||||
distribution: distribution,
|
});
|
||||||
},
|
|
||||||
{ skip: isFedoraEnv && isRhel(distribution) }
|
|
||||||
);
|
|
||||||
// TODO: Handle isFetching state (add skeletons)
|
// TODO: Handle isFetching state (add skeletons)
|
||||||
// TODO: Handle isError state (very unlikely...)
|
// TODO: Handle isError state (very unlikely...)
|
||||||
|
|
||||||
|
|
@ -120,7 +114,7 @@ const TargetEnvironment = () => {
|
||||||
const prefetchActivationKeys = rhsmApi.usePrefetch('listActivationKeys');
|
const prefetchActivationKeys = rhsmApi.usePrefetch('listActivationKeys');
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isFedoraEnv) prefetchActivationKeys();
|
prefetchActivationKeys();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const supportedEnvironments = data?.find(
|
const supportedEnvironments = data?.find(
|
||||||
|
|
|
||||||
|
|
@ -37,16 +37,12 @@ import {
|
||||||
selectComplianceType,
|
selectComplianceType,
|
||||||
clearKernelAppend,
|
clearKernelAppend,
|
||||||
} from '../../../../store/wizardSlice';
|
} from '../../../../store/wizardSlice';
|
||||||
import {
|
import { useFlag } from '../../../../Utilities/useGetEnvironment';
|
||||||
useFlag,
|
|
||||||
useGetEnvironment,
|
|
||||||
} from '../../../../Utilities/useGetEnvironment';
|
|
||||||
import { useOnPremOpenSCAPAvailable } from '../../../../Utilities/useOnPremOpenSCAP';
|
import { useOnPremOpenSCAPAvailable } from '../../../../Utilities/useOnPremOpenSCAP';
|
||||||
|
|
||||||
const OscapContent = () => {
|
const OscapContent = () => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const { analytics } = useChrome();
|
const { analytics } = useChrome();
|
||||||
const { isFedoraEnv } = useGetEnvironment();
|
|
||||||
const complianceEnabled = useFlag('image-builder.compliance.enabled');
|
const complianceEnabled = useFlag('image-builder.compliance.enabled');
|
||||||
const complianceType = useAppSelector(selectComplianceType);
|
const complianceType = useAppSelector(selectComplianceType);
|
||||||
const profileID = useAppSelector(selectComplianceProfileID);
|
const profileID = useAppSelector(selectComplianceProfileID);
|
||||||
|
|
@ -93,7 +89,7 @@ const OscapContent = () => {
|
||||||
dispatch(clearKernelAppend());
|
dispatch(clearKernelAppend());
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!process.env.IS_ON_PREMISE && !isFedoraEnv) {
|
if (!process.env.IS_ON_PREMISE) {
|
||||||
if (complianceEnabled) {
|
if (complianceEnabled) {
|
||||||
analytics.screen('ib-createimagewizard-step-security-compliance');
|
analytics.screen('ib-createimagewizard-step-security-compliance');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import {
|
||||||
} from '../../../../../store/imageBuilderApi';
|
} from '../../../../../store/imageBuilderApi';
|
||||||
import { selectPackages } from '../../../../../store/wizardSlice';
|
import { selectPackages } from '../../../../../store/wizardSlice';
|
||||||
import { createAnalytics } from '../../../../../Utilities/analytics';
|
import { createAnalytics } from '../../../../../Utilities/analytics';
|
||||||
import { useGetEnvironment } from '../../../../../Utilities/useGetEnvironment';
|
|
||||||
|
|
||||||
type CreateDropdownProps = {
|
type CreateDropdownProps = {
|
||||||
getBlueprintPayload: () => Promise<'' | CreateBlueprintRequest | undefined>;
|
getBlueprintPayload: () => Promise<'' | CreateBlueprintRequest | undefined>;
|
||||||
|
|
@ -52,12 +51,11 @@ export const CreateSaveAndBuildBtn = ({
|
||||||
fixedCacheKey: 'createBlueprintKey',
|
fixedCacheKey: 'createBlueprintKey',
|
||||||
});
|
});
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const { isFedoraEnv } = useGetEnvironment();
|
|
||||||
const onSaveAndBuild = async () => {
|
const onSaveAndBuild = async () => {
|
||||||
const requestBody = await getBlueprintPayload();
|
const requestBody = await getBlueprintPayload();
|
||||||
setIsOpen(false);
|
setIsOpen(false);
|
||||||
|
|
||||||
if (!process.env.IS_ON_PREMISE && !isFedoraEnv && requestBody) {
|
if (!process.env.IS_ON_PREMISE && requestBody) {
|
||||||
const analyticsData = createAnalytics(requestBody, packages, isBeta);
|
const analyticsData = createAnalytics(requestBody, packages, isBeta);
|
||||||
analytics.track(`${AMPLITUDE_MODULE_NAME} - Blueprint Created`, {
|
analytics.track(`${AMPLITUDE_MODULE_NAME} - Blueprint Created`, {
|
||||||
...analyticsData,
|
...analyticsData,
|
||||||
|
|
@ -108,7 +106,6 @@ export const CreateSaveButton = ({
|
||||||
})();
|
})();
|
||||||
}, [auth]);
|
}, [auth]);
|
||||||
const packages = useAppSelector(selectPackages);
|
const packages = useAppSelector(selectPackages);
|
||||||
const { isFedoraEnv } = useGetEnvironment();
|
|
||||||
|
|
||||||
const [createBlueprint, { isLoading }] = useCreateBlueprintMutation({
|
const [createBlueprint, { isLoading }] = useCreateBlueprintMutation({
|
||||||
fixedCacheKey: 'createBlueprintKey',
|
fixedCacheKey: 'createBlueprintKey',
|
||||||
|
|
@ -161,7 +158,7 @@ export const CreateSaveButton = ({
|
||||||
const requestBody = await getBlueprintPayload();
|
const requestBody = await getBlueprintPayload();
|
||||||
setIsOpen(false);
|
setIsOpen(false);
|
||||||
|
|
||||||
if (!process.env.IS_ON_PREMISE && !isFedoraEnv && requestBody) {
|
if (!process.env.IS_ON_PREMISE && requestBody) {
|
||||||
const analyticsData = createAnalytics(requestBody, packages, isBeta);
|
const analyticsData = createAnalytics(requestBody, packages, isBeta);
|
||||||
analytics.track(`${AMPLITUDE_MODULE_NAME} - Blueprint Created`, {
|
analytics.track(`${AMPLITUDE_MODULE_NAME} - Blueprint Created`, {
|
||||||
...analyticsData,
|
...analyticsData,
|
||||||
|
|
@ -169,11 +166,13 @@ export const CreateSaveButton = ({
|
||||||
account_id: userData?.identity.internal?.account_id || 'Not found',
|
account_id: userData?.identity.internal?.account_id || 'Not found',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const blueprint =
|
const blueprint =
|
||||||
requestBody &&
|
requestBody &&
|
||||||
(await createBlueprint({
|
(await createBlueprint({
|
||||||
createBlueprintRequest: requestBody,
|
createBlueprintRequest: requestBody,
|
||||||
}).unwrap());
|
}).unwrap());
|
||||||
|
|
||||||
if (blueprint) {
|
if (blueprint) {
|
||||||
dispatch(setBlueprintId(blueprint?.id));
|
dispatch(setBlueprintId(blueprint?.id));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ import {
|
||||||
useUpdateBlueprintMutation,
|
useUpdateBlueprintMutation,
|
||||||
} from '../../../../../store/backendApi';
|
} from '../../../../../store/backendApi';
|
||||||
import { resolveRelPath } from '../../../../../Utilities/path';
|
import { resolveRelPath } from '../../../../../Utilities/path';
|
||||||
import { useGetEnvironment } from '../../../../../Utilities/useGetEnvironment';
|
|
||||||
import { mapRequestFromState } from '../../../utilities/requestMapper';
|
import { mapRequestFromState } from '../../../utilities/requestMapper';
|
||||||
import { useIsBlueprintValid } from '../../../utilities/useValidation';
|
import { useIsBlueprintValid } from '../../../utilities/useValidation';
|
||||||
|
|
||||||
|
|
@ -35,7 +34,6 @@ const ReviewWizardFooter = () => {
|
||||||
useUpdateBlueprintMutation({ fixedCacheKey: 'updateBlueprintKey' });
|
useUpdateBlueprintMutation({ fixedCacheKey: 'updateBlueprintKey' });
|
||||||
const { auth } = useChrome();
|
const { auth } = useChrome();
|
||||||
const { composeId } = useParams();
|
const { composeId } = useParams();
|
||||||
const { isFedoraEnv } = useGetEnvironment();
|
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const onToggleClick = () => {
|
const onToggleClick = () => {
|
||||||
|
|
@ -53,7 +51,7 @@ const ReviewWizardFooter = () => {
|
||||||
}, [isUpdateSuccess, isCreateSuccess, resetCreate, resetUpdate, navigate]);
|
}, [isUpdateSuccess, isCreateSuccess, resetCreate, resetUpdate, navigate]);
|
||||||
|
|
||||||
const getBlueprintPayload = async () => {
|
const getBlueprintPayload = async () => {
|
||||||
if (!process.env.IS_ON_PREMISE && !isFedoraEnv) {
|
if (!process.env.IS_ON_PREMISE) {
|
||||||
const userData = await auth?.getUser();
|
const userData = await auth?.getUser();
|
||||||
const orgId = userData?.identity?.internal?.org_id;
|
const orgId = userData?.identity?.internal?.org_id;
|
||||||
const requestBody = orgId && mapRequestFromState(store, orgId);
|
const requestBody = orgId && mapRequestFromState(store, orgId);
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,6 @@ import {
|
||||||
selectUsers,
|
selectUsers,
|
||||||
selectKernel,
|
selectKernel,
|
||||||
} from '../../../../store/wizardSlice';
|
} from '../../../../store/wizardSlice';
|
||||||
import { useGetEnvironment } from '../../../../Utilities/useGetEnvironment';
|
|
||||||
|
|
||||||
const Review = () => {
|
const Review = () => {
|
||||||
const { goToStepById } = useWizardContext();
|
const { goToStepById } = useWizardContext();
|
||||||
|
|
@ -187,7 +186,6 @@ const Review = () => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const { isFedoraEnv } = useGetEnvironment();
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ExpandableSection
|
<ExpandableSection
|
||||||
|
|
@ -359,23 +357,21 @@ const Review = () => {
|
||||||
>
|
>
|
||||||
<FSCList />
|
<FSCList />
|
||||||
</ExpandableSection>
|
</ExpandableSection>
|
||||||
{!isFedoraEnv && (
|
<ExpandableSection
|
||||||
<ExpandableSection
|
toggleContent={composeExpandable(
|
||||||
toggleContent={composeExpandable(
|
'Content',
|
||||||
'Content',
|
'revisit-custom-repositories',
|
||||||
'revisit-custom-repositories',
|
'wizard-custom-repositories'
|
||||||
'wizard-custom-repositories'
|
)}
|
||||||
)}
|
onToggle={(_event, isExpandedContent) =>
|
||||||
onToggle={(_event, isExpandedContent) =>
|
onToggleContent(isExpandedContent)
|
||||||
onToggleContent(isExpandedContent)
|
}
|
||||||
}
|
isExpanded={isExpandedContent}
|
||||||
isExpanded={isExpandedContent}
|
isIndented
|
||||||
isIndented
|
data-testid="content-expandable"
|
||||||
data-testid="content-expandable"
|
>
|
||||||
>
|
<ContentList />
|
||||||
<ContentList />
|
</ExpandableSection>
|
||||||
</ExpandableSection>
|
|
||||||
)}
|
|
||||||
{users.length > 0 && (
|
{users.length > 0 && (
|
||||||
<ExpandableSection
|
<ExpandableSection
|
||||||
toggleContent={composeExpandable(
|
toggleContent={composeExpandable(
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ import {
|
||||||
import { FSReviewTable } from './ReviewStepTables';
|
import { FSReviewTable } from './ReviewStepTables';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
FEDORA_RELEASES,
|
|
||||||
ON_PREM_RELEASES,
|
ON_PREM_RELEASES,
|
||||||
RELEASES,
|
RELEASES,
|
||||||
RHEL_10,
|
RHEL_10,
|
||||||
|
|
@ -81,7 +80,6 @@ import {
|
||||||
selectRedHatRepositories,
|
selectRedHatRepositories,
|
||||||
} from '../../../../store/wizardSlice';
|
} from '../../../../store/wizardSlice';
|
||||||
import { toMonthAndYear, yyyyMMddFormat } from '../../../../Utilities/time';
|
import { toMonthAndYear, yyyyMMddFormat } from '../../../../Utilities/time';
|
||||||
import { useGetEnvironment } from '../../../../Utilities/useGetEnvironment';
|
|
||||||
import {
|
import {
|
||||||
getConversionFactor,
|
getConversionFactor,
|
||||||
MinimumSizePopover,
|
MinimumSizePopover,
|
||||||
|
|
@ -106,12 +104,8 @@ const ExpirationWarning = () => {
|
||||||
export const ImageOutputList = () => {
|
export const ImageOutputList = () => {
|
||||||
const distribution = useAppSelector(selectDistribution);
|
const distribution = useAppSelector(selectDistribution);
|
||||||
const arch = useAppSelector(selectArchitecture);
|
const arch = useAppSelector(selectArchitecture);
|
||||||
const { isFedoraEnv } = useGetEnvironment();
|
const releases = process.env.IS_ON_PREMISE ? ON_PREM_RELEASES : RELEASES;
|
||||||
const releases = isFedoraEnv
|
|
||||||
? FEDORA_RELEASES
|
|
||||||
: process.env.IS_ON_PREMISE
|
|
||||||
? ON_PREM_RELEASES
|
|
||||||
: RELEASES;
|
|
||||||
return (
|
return (
|
||||||
<Content>
|
<Content>
|
||||||
{(distribution === RHEL_8 || distribution === RHEL_9) && (
|
{(distribution === RHEL_8 || distribution === RHEL_9) && (
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,6 @@ import {
|
||||||
timestampToDisplayString,
|
timestampToDisplayString,
|
||||||
timestampToDisplayStringDetailed,
|
timestampToDisplayStringDetailed,
|
||||||
} from '../../Utilities/time';
|
} from '../../Utilities/time';
|
||||||
import { useGetEnvironment } from '../../Utilities/useGetEnvironment';
|
|
||||||
|
|
||||||
const ImagesTable = () => {
|
const ImagesTable = () => {
|
||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
|
|
@ -104,7 +103,6 @@ const ImagesTable = () => {
|
||||||
const blueprintsOffset = useAppSelector(selectOffset) || PAGINATION_OFFSET;
|
const blueprintsOffset = useAppSelector(selectOffset) || PAGINATION_OFFSET;
|
||||||
const blueprintsLimit = useAppSelector(selectLimit) || PAGINATION_LIMIT;
|
const blueprintsLimit = useAppSelector(selectLimit) || PAGINATION_LIMIT;
|
||||||
|
|
||||||
const { isFedoraEnv } = useGetEnvironment();
|
|
||||||
const { analytics, auth } = useChrome();
|
const { analytics, auth } = useChrome();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
|
|
@ -225,7 +223,7 @@ const ImagesTable = () => {
|
||||||
}
|
}
|
||||||
const itemCount = data?.meta.count || 0;
|
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;
|
const orgId = userData?.identity.internal?.org_id;
|
||||||
|
|
||||||
analytics.group(orgId, {
|
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';
|
import { useFlag as useUnleashFlag } from '@unleash/proxy-client-react';
|
||||||
|
|
||||||
export const useGetEnvironment = process.env.IS_ON_PREMISE
|
export const useGetEnvironment = process.env.IS_ON_PREMISE
|
||||||
? () => ({ isBeta: () => false, isProd: () => true, isFedoraEnv: false })
|
? () => ({ isBeta: () => false, isProd: () => true })
|
||||||
: () => {
|
: () => {
|
||||||
const { isBeta, isProd, getEnvironment, getEnvironmentDetails } =
|
const { isBeta, isProd, getEnvironment } = useChrome();
|
||||||
useChrome();
|
|
||||||
// Expose beta features in the ephemeral environment
|
// Expose beta features in the ephemeral environment
|
||||||
const isFedoraEnv: boolean =
|
|
||||||
getEnvironmentDetails()?.url.some((x: string) =>
|
|
||||||
x.includes('fedora')
|
|
||||||
) ?? false;
|
|
||||||
if (isBeta() || getEnvironment() === 'qa') {
|
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
|
// Since some of these flags are only relevant to
|
||||||
// the service, we need a way of bypassing this for on-prem
|
// the service, we need a way of bypassing this for on-prem
|
||||||
export const useFlag = (flag: string) => {
|
export const useFlag = !process.env.IS_ON_PREMISE ? useUnleashFlag : onPremFlag;
|
||||||
const { isFedoraEnv } = useGetEnvironment();
|
|
||||||
|
|
||||||
const onPremFlagValue = onPremFlag(flag);
|
|
||||||
const unleashFlagValue = useUnleashFlag(flag);
|
|
||||||
const shouldUseOnPrem = process.env.IS_ON_PREMISE || isFedoraEnv;
|
|
||||||
|
|
||||||
return shouldUseOnPrem ? onPremFlagValue : unleashFlagValue;
|
|
||||||
};
|
|
||||||
|
|
|
||||||
|
|
@ -107,13 +107,6 @@ export const ON_PREM_RELEASES = new Map([
|
||||||
[RHEL_10, 'Red Hat Enterprise Linux (RHEL) 10'],
|
[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_10_FULL_SUPPORT = ['2025-05-13', '2030-05-31'];
|
||||||
export const RHEL_9_FULL_SUPPORT = ['2022-05-18', '2027-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'];
|
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 { configure } from '@testing-library/react';
|
||||||
|
|
||||||
import { server } from './mocks/server';
|
import { server } from './mocks/server';
|
||||||
|
|
||||||
import 'vitest-canvas-mock';
|
import 'vitest-canvas-mock';
|
||||||
|
|
||||||
// scrollTo is not defined in jsdom - needed for the navigation to the wizard
|
// 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,
|
isBeta: () => true,
|
||||||
isProd: () => true,
|
isProd: () => true,
|
||||||
getEnvironment: () => 'prod',
|
getEnvironment: () => 'prod',
|
||||||
getEnvironmentDetails: () => ({
|
|
||||||
url: ['https://console.redhat.com'],
|
|
||||||
}),
|
|
||||||
}),
|
}),
|
||||||
default: () => ({
|
default: () => ({
|
||||||
analytics: {
|
analytics: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue