Fedora-services: add support for fedora env

This commit is contained in:
Amir 2025-03-12 19:05:44 +02:00 committed by Klara Simickova
parent 72aed71662
commit 1d86950f45
10 changed files with 111 additions and 45 deletions

View file

@ -20,6 +20,7 @@ import {
RHEL_9_MAINTENANCE_SUPPORT,
RHEL_10_BETA,
ON_PREM_RELEASES,
FEDORA_RELEASES,
} from '../../../../constants';
import { useAppDispatch, useAppSelector } from '../../../../store/hooks';
import { Distributions } from '../../../../store/imageBuilderApi';
@ -30,7 +31,10 @@ import {
} from '../../../../store/wizardSlice';
import isRhel from '../../../../Utilities/isRhel';
import { toMonthAndYear } from '../../../../Utilities/time';
import { useFlag } from '../../../../Utilities/useGetEnvironment';
import {
useFlag,
useGetEnvironment,
} from '../../../../Utilities/useGetEnvironment';
const ReleaseSelect = () => {
// What the UI refers to as the "release" is referred to as the "distribution" in the API.
@ -39,12 +43,18 @@ const ReleaseSelect = () => {
const distribution = useAppSelector(selectDistribution);
const dispatch = useAppDispatch();
const [isOpen, setIsOpen] = useState(false);
const [showDevelopmentOptions, setShowDevelopmentOptions] = useState(false);
const { isFedoraEnv } = useGetEnvironment();
const [showDevelopmentOptions, setShowDevelopmentOptions] =
useState(isFedoraEnv);
const isRHEL9BetaEnabled = useFlag('image-builder.rhel9.beta.enabled');
const isRHEL10BetaEnabled = useFlag('image-builder.rhel10.beta.enabled');
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;
const handleSelect = (_event: React.MouseEvent, selection: Distributions) => {
if (selection !== ('loader' as Distributions)) {

View file

@ -28,18 +28,25 @@ import {
selectDistribution,
selectImageTypes,
} from '../../../../store/wizardSlice';
import { useFlag } from '../../../../Utilities/useGetEnvironment';
import isRhel from '../../../../Utilities/isRhel';
import {
useFlag,
useGetEnvironment,
} from '../../../../Utilities/useGetEnvironment';
const TargetEnvironment = () => {
const arch = useAppSelector(selectArchitecture);
const environments = useAppSelector(selectImageTypes);
const distribution = useAppSelector(selectDistribution);
const { isFedoraEnv } = useGetEnvironment();
const wslFlag = useFlag('image-builder.wsl.enabled');
const { data } = useGetArchitecturesQuery({
distribution: distribution,
});
const { data } = useGetArchitecturesQuery(
{
distribution: distribution,
},
{ skip: isFedoraEnv && isRhel(distribution) }
);
// TODO: Handle isFetching state (add skeletons)
// TODO: Handle isError state (very unlikely...)
@ -51,7 +58,7 @@ const TargetEnvironment = () => {
const prefetchActivationKeys = rhsmApi.usePrefetch('listActivationKeys');
useEffect(() => {
prefetchActivationKeys();
if (!isFedoraEnv) prefetchActivationKeys();
}, []);
const supportedEnvironments = data?.find(