-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MGMT-17477: Update dev preview badge when user selects custom OCP rel…
…ease (#2553) (#2558) * Update dev preview badge when user select custom OCP release * Do not store helper text in react/formik state * Adjusting tests --------- Co-authored-by: rawagner <[email protected]>
- Loading branch information
Showing
6 changed files
with
90 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
libs/ui-lib/lib/ocm/components/clusterConfiguration/OpenshiftVersionHelperText.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import * as React from 'react'; | ||
import { | ||
OPENSHIFT_LIFE_CYCLE_DATES_LINK, | ||
OpenshiftVersionOptionType, | ||
UiIcon, | ||
} from '../../../common'; | ||
import { TFunction } from 'i18next'; | ||
import { ExclamationCircleIcon } from '@patternfly/react-icons/dist/js/icons/exclamation-circle-icon'; | ||
import { ExclamationTriangleIcon } from '@patternfly/react-icons/dist/js/icons/exclamation-triangle-icon'; | ||
import { ExternalLinkAltIcon } from '@patternfly/react-icons/dist/js/icons/external-link-alt-icon'; | ||
|
||
import { useTranslation } from '../../../common/hooks/use-translation-wrapper'; | ||
|
||
const OpenShiftLifeCycleDatesLink = () => { | ||
const { t } = useTranslation(); | ||
return ( | ||
<a href={OPENSHIFT_LIFE_CYCLE_DATES_LINK} target="_blank" rel="noopener noreferrer"> | ||
{t('ai:Learn more')} <ExternalLinkAltIcon /> | ||
</a> | ||
); | ||
}; | ||
|
||
export const getOpenshiftVersionHelperText = ( | ||
versions: OpenshiftVersionOptionType[], | ||
selectedVersionValue: string | undefined, | ||
t: TFunction, | ||
isModal?: boolean, | ||
) => { | ||
if (!versions.length && !isModal) { | ||
return ( | ||
<> | ||
<UiIcon status="danger" size="sm" icon={<ExclamationCircleIcon />} /> | ||
{t('ai:No release image is available.')} | ||
</> | ||
); | ||
} | ||
|
||
const selectedVersion = versions.find((version) => version.value === selectedVersionValue); | ||
if (!selectedVersionValue || !selectedVersion) { | ||
return null; | ||
} | ||
|
||
if ( | ||
selectedVersion.supportLevel !== 'production' && | ||
selectedVersion.supportLevel !== 'maintenance' | ||
) { | ||
let messageSelectedVersion = t('ai:Please note that this version is not production-ready.'); | ||
if (selectedVersion.supportLevel === 'end-of-life') { | ||
messageSelectedVersion = t('ai:Please note that this version is not maintained anymore.'); | ||
} | ||
return ( | ||
<> | ||
<UiIcon status="warning" icon={<ExclamationTriangleIcon />} /> | ||
| ||
{messageSelectedVersion} | ||
<OpenShiftLifeCycleDatesLink /> | ||
</> | ||
); | ||
} | ||
|
||
return null; | ||
}; |