diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-07-15 17:10:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-15 17:10:39 +0200 |
commit | c844886cf44799e77093a2df5e0da8196bacb395 (patch) | |
tree | 248d2213692bb69a17752d77dc049bcae1ec6bff /server/sonar-web/src/main/js/helpers/measures.js | |
parent | 26c2600790d61b140b895f05050df9dd31f52393 (diff) | |
download | sonarqube-c844886cf44799e77093a2df5e0da8196bacb395.tar.gz sonarqube-c844886cf44799e77093a2df5e0da8196bacb395.zip |
SONAR-7492 Display an explanation tooltip for rating measures (#1104)
Diffstat (limited to 'server/sonar-web/src/main/js/helpers/measures.js')
-rw-r--r-- | server/sonar-web/src/main/js/helpers/measures.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/helpers/measures.js b/server/sonar-web/src/main/js/helpers/measures.js index c965c1577a6..a3e181e04cb 100644 --- a/server/sonar-web/src/main/js/helpers/measures.js +++ b/server/sonar-web/src/main/js/helpers/measures.js @@ -367,3 +367,24 @@ function shortDurationVariationFormatter (value) { const formatted = shortDurationFormatter(value); return formatted[0] !== '-' ? '+' + formatted : formatted; } + + +let maintainabilityRatingGrid; +export function getMaintainabilityRatingGrid () { + if (maintainabilityRatingGrid) { + return maintainabilityRatingGrid; + } + + const str = window.SS['sonar.technicalDebt.ratingGrid']; + const numbers = str.split(',') + .map(s => parseFloat(s)) + .filter(n => !isNaN(n)); + + if (numbers.length === 4) { + maintainabilityRatingGrid = numbers; + } else { + maintainabilityRatingGrid = [0, 0, 0, 0]; + } + + return maintainabilityRatingGrid; +} |