CreateImageWizard: Add CentOS speedbump
When selecting a distribution during the Image Output step, only RHEL distributions are shown initially. A button at the bottom of the list of distributions can be clicked to expand the list and display all distributions, which at the moment adds CentOS-8 and CentOS-9 to the list. Implemented by passing a PF4 SelectViewMoreObject as the LoadingVariant prop to the <Select>. This feature (and therefore the ability to build CentOS images) is only available in beta.
This commit is contained in:
parent
11c337be78
commit
f6a98d2dca
3 changed files with 85 additions and 3 deletions
|
|
@ -15,6 +15,7 @@ const ImageOutputReleaseSelect = ({ label, isRequired, ...props }) => {
|
|||
const { change, getState } = useFormApi();
|
||||
const { input } = useFieldApi(props);
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const [showDevelopmentOptions, setShowDevelopmentOptions] = useState(false);
|
||||
|
||||
const setRelease = (_, selection) => {
|
||||
change(input.name, selection);
|
||||
|
|
@ -23,6 +24,11 @@ const ImageOutputReleaseSelect = ({ label, isRequired, ...props }) => {
|
|||
|
||||
const handleClear = () => {
|
||||
change(input.name, null);
|
||||
setShowDevelopmentOptions(false);
|
||||
};
|
||||
|
||||
const handleExpand = () => {
|
||||
setShowDevelopmentOptions(true);
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
@ -34,11 +40,18 @@ const ImageOutputReleaseSelect = ({ label, isRequired, ...props }) => {
|
|||
onClear={handleClear}
|
||||
selections={RELEASES[getState()?.values?.[input.name]]}
|
||||
isOpen={isOpen}
|
||||
{...(insights.chrome.isBeta() &&
|
||||
!showDevelopmentOptions && {
|
||||
loadingVariant: {
|
||||
text: 'Show options for further development of RHEL',
|
||||
onClick: handleExpand,
|
||||
},
|
||||
})}
|
||||
>
|
||||
{Object.entries(RELEASES)
|
||||
.filter(([key]) => {
|
||||
// Only show non-RHEL distros in beta
|
||||
if (insights.chrome.isBeta()) {
|
||||
// Only show non-RHEL distros if expanded
|
||||
if (showDevelopmentOptions) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue