diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-07-20 11:59:30 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2016-07-20 13:22:02 +0200 |
commit | f7ee2c8e215706399ddfac74760b53f8f139c5a6 (patch) | |
tree | 3a174a5c0b0317597cf301846bfb6b907cc734ef /server/sonar-web/src/main/js/apps/overview/main | |
parent | 70979ecf22b6dd89ff50fe0107129e2d462863a9 (diff) | |
download | sonarqube-f7ee2c8e215706399ddfac74760b53f8f139c5a6.tar.gz sonarqube-f7ee2c8e215706399ddfac74760b53f8f139c5a6.zip |
SONAR-7492 display rating tooltips on measures page
Diffstat (limited to 'server/sonar-web/src/main/js/apps/overview/main')
-rw-r--r-- | server/sonar-web/src/main/js/apps/overview/main/enhance.js | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/server/sonar-web/src/main/js/apps/overview/main/enhance.js b/server/sonar-web/src/main/js/apps/overview/main/enhance.js index 91f3b8a37b4..26e57e1afa7 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/enhance.js +++ b/server/sonar-web/src/main/js/apps/overview/main/enhance.js @@ -34,7 +34,7 @@ import { import { translateWithParameters, translate } from '../../../helpers/l10n'; import { getPeriodDate } from '../../../helpers/periods'; import { getComponentIssuesUrl } from '../../../helpers/urls'; -import { getMaintainabilityRatingGrid } from '../../../helpers/measures'; +import { getRatingTooltip } from '../../../helpers/measures'; export default function enhance (ComposedComponent) { return class extends React.Component { @@ -132,27 +132,6 @@ export default function enhance (ComposedComponent) { ); } - getMaintainabilityRatingTooltip (rating) { - const maintainabilityGrid = getMaintainabilityRatingGrid(); - const maintainabilityRatingThreshold = - maintainabilityGrid[Math.floor(rating) - 2]; - - console.log(maintainabilityGrid[0]); - - if (rating < 2) { - return translateWithParameters( - 'metric.sqale_rating.tooltip.A', - `${maintainabilityGrid[0]}%`); - } - - const ratingLetter = formatMeasure(rating, 'RATING'); - - return translateWithParameters( - 'metric.sqale_rating.tooltip', - ratingLetter, - `${maintainabilityRatingThreshold}%`); - } - renderRating (metricKey) { const { component, measures } = this.props; const measure = measures.find(measure => measure.metric.key === metricKey); @@ -161,11 +140,7 @@ export default function enhance (ComposedComponent) { return null; } - const ratingLetter = formatMeasure(measure.value, 'RATING'); - - const title = metricKey === 'sqale_rating' ? - this.getMaintainabilityRatingTooltip(measure.value) : - translate('metric', metricKey, 'tooltip', ratingLetter); + const title = getRatingTooltip(metricKey, measure.value); return ( <div className="overview-domain-measure-sup" |