webpack/scenes/ContentViews/Details/Repositories/ContentCounts.js in katello-4.2.2 vs webpack/scenes/ContentViews/Details/Repositories/ContentCounts.js in katello-4.3.0.rc1

- old
+ new

@@ -1,8 +1,9 @@ import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; import { urlBuilder } from 'foremanReact/common/urlHelpers'; +import ContentConfig from '../../../Content/ContentConfig'; // type: [plural_name, singular_name, link] const repoLabels = { rpm: ['RPM packages', 'RPM package', 'packages'], module_stream: ['module streams', 'module stream', 'module_streams'], @@ -36,10 +37,17 @@ const ContentCounts = ({ productId, repoId, counts }) => { const allCounts = []; Object.keys(counts).forEach((type) => { const count = counts[type]; - const info = repoLabels[type]; + let info = repoLabels[type]; + const config = ContentConfig().find(typeConfig => + typeConfig.names.singularLabel === type); + + if (config) { + const { pluralLowercase, singularLowercase, pluralLabel } = config.names; + info = [pluralLowercase, singularLowercase, pluralLabel]; + } // package and rpm are the same if (type !== 'package' && count > 0) allCounts.push(appendCount(type, count, info, productId, repoId)); }); return <Fragment>{allCounts}</Fragment>;