webpack/scenes/ContentViews/components/EnvironmentLabels.js in katello-4.1.4 vs webpack/scenes/ContentViews/components/EnvironmentLabels.js in katello-4.2.0.rc1

- old
+ new

@@ -1,16 +1,28 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { Label } from '@patternfly/react-core'; -const EnvironmentLabels = environments => environments.map(env => - <React.Fragment key={env.id}><Label color="purple" href={`/lifecycle_environments/${env.id}`}>{`${env.name}`}</Label></React.Fragment>); - -EnvironmentLabels.propTypes = { - environments: PropTypes.instanceOf(Array), -}; - -EnvironmentLabels.defaultProps = { - environments: [], +const EnvironmentLabels = (environments) => { + const { environments: singleEnvironment } = environments || {}; + const { name } = singleEnvironment || {}; + switch (environments) { + case Array: + return environments.map(env => ( + <React.Fragment key={env.id} style={{ marginBottom: '5px' }}> + <Label + color="purple" + >{`${env.name}`} + </Label> + </React.Fragment> + )); + default: + return ( + <React.Fragment> + <Label color="purple"> + {`${name}`} + </Label> + </React.Fragment> + ); + } }; export default EnvironmentLabels;