From: Wouter Admiraal Date: Thu, 25 Aug 2022 11:46:31 +0000 (+0200) Subject: SONAR-16738 [891611] Visual list is not marked up as list X-Git-Tag: 9.7.0.61563~319 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6304d93991af2397eb8c5ab665a61ea93434030e;p=sonarqube.git SONAR-16738 [891611] Visual list is not marked up as list --- diff --git a/server/sonar-web/src/main/js/apps/projects/filters/Filter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/Filter.tsx index e4961f26995..7db00ac9c10 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/Filter.tsx +++ b/server/sonar-web/src/main/js/apps/projects/filters/Filter.tsx @@ -115,15 +115,16 @@ export default class Filter extends React.PureComponent { ); } - renderOption(option: Option) { + renderOption(option: Option, highlightable = false, lastHighlightable = false) { const { facet, getFacetValueForOption = defaultGetFacetValueForOption, value } = this.props; + const active = this.isSelected(option); const className = classNames( 'facet', 'search-navigator-facet', 'projects-facet', 'button-link', { - active: this.isSelected(option), + active, 'search-navigator-facet-half': this.props.halfWidth }, this.props.optionClassName @@ -139,26 +140,33 @@ export default class Filter extends React.PureComponent { option > value; return ( - + {facetValue != null && ( + + {formatMeasure(facetValue, 'SHORT_INT')} + {this.renderOptionBar(facetValue)} + + )} + + ); } @@ -171,24 +179,26 @@ export default class Filter extends React.PureComponent { const insideHighlight = options.slice(highlightUnder, max); const afterHighlight = options.slice(max); return ( -
+
    {beforeHighlight.map(option => this.renderOption(option))} -
    - {insideHighlight.map(option => this.renderOption(option))} -
    + {insideHighlight.map((option, i) => + this.renderOption(option, true, i === insideHighlight.length - 1) + )} {afterHighlight.map(option => this.renderOption(option))} -
- ); - } else { - return ( -
- {options.map(option => this.renderOption(option))} -
+ ); } - } else { - return
{translate('no_results')}
; + return ( +
    + {options.map(option => this.renderOption(option))} +
+ ); } + return ( +
+ {translate('projects.facets.no_available_filters_clear_others')} +
+ ); }; render() { diff --git a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/Filter-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/Filter-test.tsx.snap index e45056ac4a0..891db262a5d 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/Filter-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/__snapshots__/Filter-test.tsx.snap @@ -5,35 +5,39 @@ exports[`highlights under 1`] = ` className="search-navigator-facet-box" data-key="foo" > -
- -
+ 1 + + + +
  • +
  • +
  • -
  • -
    + + `; @@ -72,35 +80,39 @@ exports[`hightlights under selected 1`] = ` className="search-navigator-facet-box" data-key="foo" > -
    - -
    + 1 + + + +
  • +
  • +
  • -
  • -
    + + `; @@ -139,61 +155,73 @@ exports[`renders 1`] = ` className="search-navigator-facet-box" data-key="foo" > -
    - - + +
  • - - 2 - - - +
  • +
  • - - 3 - - -
  • + + 3 + + + + `; @@ -202,112 +230,124 @@ exports[`renders facet bar chart 1`] = ` className="search-navigator-facet-box" data-key="foo" > -
    - -
    + + + +
  • - - b - - - 15 -
    + b + + + 15
    +
    -
    - - -
    +
    + +
  • +
  • - - c - - - 24 -
    + c + + + 24
    +
    -
    - - -
    + /> +
    +
    + +
  • + `; @@ -317,61 +357,73 @@ exports[`renders header and footer 1`] = ` data-key="foo" >
    -
    - - + +
  • - - 2 - - - +
  • +
  • - - 3 - - -
  • + + 3 + + + +