CreateImageWizard: oscap options add spinner

The select `loadingVariant` seems to do nothing. Add a loader for when the
oscap profiles are being loaded.
This commit is contained in:
Gianluca Zuccarelli 2025-03-10 12:08:52 +00:00 committed by Lucas Garfield
parent c38e821ae5
commit 18c329be2a

View file

@ -7,6 +7,7 @@ import {
TextContent,
Text,
Button,
Spinner,
} from '@patternfly/react-core';
import {
Select,
@ -290,6 +291,10 @@ const ProfileSelector = () => {
};
const options = () => {
if (isFetching) {
return [<OScapLoadingOption key="oscap-loading-option" />];
}
if (profiles) {
return [<OScapNoneOption key="oscap-none-option" />].concat(
profiles.map((profile_id, index) => {
@ -322,7 +327,6 @@ const ProfileSelector = () => {
>
{complianceType === 'openscap' && (
<Select
loadingVariant={isFetching ? 'spinner' : undefined}
ouiaId="profileSelect"
variant={SelectVariant.typeahead}
onToggle={handleToggle}
@ -335,6 +339,9 @@ const ProfileSelector = () => {
typeAheadAriaLabel="Select a profile"
isDisabled={!isSuccess || hasWslTargetOnly}
onFilter={(_event, value) => {
if (isFetching) {
return [<OScapLoadingOption key="oscap-loading-option" />];
}
if (profiles) {
return [<OScapNoneOption key="oscap-none-option" />].concat(
profiles.map((profile_id, index) => {
@ -389,6 +396,16 @@ const OScapNoneOption = () => {
);
};
const OScapLoadingOption = () => {
return (
<SelectOption
value={{ toString: () => 'Loading...', compareTo: () => false }}
>
<Spinner size="lg" />
</SelectOption>
);
};
type OScapSelectOptionPropType = {
profile_id: DistributionProfileItem;
filter?: string;