imagesTable: capitalize all release values

This commit change the value of release column to be consistently,
and always show with Capital letter
related to issue - https://github.com/RedHatInsights/image-builder-frontend/issues/946
This commit is contained in:
mgold1234 2023-06-20 14:07:14 +03:00 committed by Lucas Garfield
parent 27c620939a
commit 795aa99fc3
3 changed files with 46 additions and 32 deletions

View file

@ -1,22 +0,0 @@
import PropTypes from 'prop-types';
import { RHEL_8, RHEL_9 } from '../../constants.js';
const Release = (props) => {
const releaseOptions = {
[RHEL_8]: 'RHEL 8',
[RHEL_9]: 'RHEL 9',
'centos-8': 'CentOS Stream 8',
'centos-9': 'CentOS Stream 9',
};
const release = releaseOptions[props.release]
? releaseOptions[props.release]
: props.release;
return release;
};
Release.propTypes = {
release: PropTypes.string,
};
export default Release;

View file

@ -0,0 +1,30 @@
import { Distributions } from '../../../types';
type ReleaseProps = {
release: Distributions;
};
const Release = ({ release }: ReleaseProps) => {
const releaseDisplayValue = {
'rhel-8': 'RHEL 8',
'rhel-84': 'RHEL 8.4',
'rhel-85': 'RHEL 8.5',
'rhel-86': 'RHEL 8.6',
'rhel-87': 'RHEL 8.7',
'rhel-88': 'RHEL 8.8',
'rhel-9': 'RHEL 9',
'rhel-90': 'RHEL 9.0',
'rhel-91': 'RHEL 9.1',
'rhel-92': 'RHEL 9.2',
'centos-8': 'CentOS Stream 8',
'centos-9': 'CentOS Stream 9',
'fedora-35': 'Fedora 35',
'fedora-36': 'Fedora 36',
'fedora-37': 'Fedora 37',
'fedora-38': 'Fedora 38',
};
return releaseDisplayValue[release];
};
export default Release;