aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/libs
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-09-15 10:17:05 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-09-15 10:17:05 +0200
commitb8c759cc3d00365bc88e1d9a9d7695caca32bd09 (patch)
treeeb8b007e39967034edf8014e7a2af819e32470f7 /server/sonar-web/src/main/js/libs
parent818c2fdae55e2761bc1269de3bf3d07f91b3ce6f (diff)
downloadsonarqube-b8c759cc3d00365bc88e1d9a9d7695caca32bd09.tar.gz
sonarqube-b8c759cc3d00365bc88e1d9a9d7695caca32bd09.zip
improve formatting of LEVEL measures
Diffstat (limited to 'server/sonar-web/src/main/js/libs')
-rw-r--r--server/sonar-web/src/main/js/libs/application.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/server/sonar-web/src/main/js/libs/application.js b/server/sonar-web/src/main/js/libs/application.js
index bdbc78a7524..82f612db355 100644
--- a/server/sonar-web/src/main/js/libs/application.js
+++ b/server/sonar-web/src/main/js/libs/application.js
@@ -500,6 +500,18 @@ function closeModalWindow () {
return String.fromCharCode(97 + value - 1).toUpperCase();
};
+
+ /**
+ * Format a level measure
+ * @param {number} value
+ */
+ var levelFormatter = function (value) {
+ var l10nKey = 'metric.level.' + value,
+ result = window.t(l10nKey);
+ // if couldn't translate, return the initial value
+ return l10nKey !== result ? result : value;
+ };
+
/**
* Format a measure according to its type
* @param measure
@@ -524,7 +536,8 @@ function closeModalWindow () {
},
'WORK_DUR': durationFormatter,
'SHORT_WORK_DUR': shortDurationFormatter,
- 'RATING': ratingFormatter
+ 'RATING': ratingFormatter,
+ 'LEVEL': levelFormatter
};
if (measure != null && type != null) {
formatted = formatters[type] != null ? formatters[type](measure) : measure;