]> source.dussan.org Git - sonarqube.git/commitdiff
improve formatting of LEVEL measures
authorStas Vilchik <vilchiks@gmail.com>
Tue, 15 Sep 2015 08:17:05 +0000 (10:17 +0200)
committerStas Vilchik <vilchiks@gmail.com>
Tue, 15 Sep 2015 08:17:05 +0000 (10:17 +0200)
server/sonar-web/src/main/js/libs/application.js
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index bdbc78a752432cb231ee1d19b8fc630b9b898db1..82f612db355934a3980615ec158510a104bafdec 100644 (file)
@@ -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;
index 29ff7210aaed5f43aa4e19eac17e9d97dfb2832c..4a5d04c377ca5d00c08631d838276e861be1456f 100644 (file)
@@ -2787,6 +2787,10 @@ metric.type.DISTRIB=Distribution
 metric.type.RATING=Rating
 metric.type.WORK_DUR=Work Duration
 
+metric.level.ERROR=Error
+metric.level.WARN=Warning
+metric.level.OK=Ok
+
 
 #------------------------------------------------------------------------------
 #