diff options
author | Pascal Mugnier <pascal.mugnier@sonarsource.com> | 2018-03-07 14:28:11 +0100 |
---|---|---|
committer | Pascal Mugnier <pascal.mugnier@sonarsource.com> | 2018-03-07 14:28:11 +0100 |
commit | ec739303a171b09089a1987d69777fa988b19eb3 (patch) | |
tree | 5cccb0517561af90764113510bb6aa655df3c975 /server/sonar-web/src/main/js/apps/component-measures/sidebar/DomainFacet.js | |
parent | d39405a06b3ec3af82ec70ff71170a578ffbe284 (diff) | |
parent | da6a97014a1aba426ca6253623f6ff71281a64ac (diff) | |
download | sonarqube-ec739303a171b09089a1987d69777fa988b19eb3.tar.gz sonarqube-ec739303a171b09089a1987d69777fa988b19eb3.zip |
Merge branch 'master' of https://github.com/SonarSource/sonarqube
Diffstat (limited to 'server/sonar-web/src/main/js/apps/component-measures/sidebar/DomainFacet.js')
-rw-r--r-- | server/sonar-web/src/main/js/apps/component-measures/sidebar/DomainFacet.js | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/DomainFacet.js b/server/sonar-web/src/main/js/apps/component-measures/sidebar/DomainFacet.js index 6ea4bc1afd1..47338d7ac0d 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/DomainFacet.js +++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/DomainFacet.js @@ -67,9 +67,10 @@ export default class DomainFacet extends React.PureComponent { const { domain, selected } = this.props; const measureSelected = domain.measures.find(measure => measure.metric.key === selected); const overviewSelected = domain.name === selected && hasBubbleChart(domain.name); - return measureSelected - ? [getLocalizedMetricName(measureSelected.metric)] - : overviewSelected ? [translate('component_measures.domain_overview')] : []; + if (measureSelected) { + return [getLocalizedMetricName(measureSelected.metric)]; + } + return overviewSelected ? [translate('component_measures.domain_overview')] : []; }; renderItemFacetStat = (item /*: MeasureEnhanced */) => @@ -80,11 +81,19 @@ export default class DomainFacet extends React.PureComponent { const items = addMeasureCategories(domain.name, filterMeasures(domain.measures)); const hasCategories = items.some(item => typeof item === 'string'); const translateMetric = hasCategories ? getLocalizedCategoryMetricName : getLocalizedMetricName; - const sortedItems = sortMeasures(domain.name, items); + let sortedItems = sortMeasures(domain.name, items); + + sortedItems = sortedItems.filter((item, index) => { + return ( + typeof item !== 'string' || + (index + 1 !== sortedItems.length && typeof sortedItems[index + 1] !== 'string') + ); + }); + return sortedItems.map( item => typeof item === 'string' ? ( - <span key={item} className="facet search-navigator-facet facet-category"> + <span className="facet search-navigator-facet facet-category" key={item}> <span className="facet-name"> {translate('component_measures.facet_category', item)} </span> |