diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-03-31 15:24:48 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-03-31 15:25:14 +0200 |
commit | e5b20e3ae06b80d852a91968e975d0894ddfac82 (patch) | |
tree | 5145b000d04fb8243274b9040f9a6b476dfa265d /server/sonar-web/src/main | |
parent | ac60aa9eef80689f24b10857dbaf83dd1eb412fe (diff) | |
download | sonarqube-e5b20e3ae06b80d852a91968e975d0894ddfac82.tar.gz sonarqube-e5b20e3ae06b80d852a91968e975d0894ddfac82.zip |
SONAR-6331 add a sqale rating
Diffstat (limited to 'server/sonar-web/src/main')
-rw-r--r-- | server/sonar-web/src/main/hbs/overview/overview-debt.hbs | 3 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/application.js | 12 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/overview/models/state.js | 8 |
3 files changed, 21 insertions, 2 deletions
diff --git a/server/sonar-web/src/main/hbs/overview/overview-debt.hbs b/server/sonar-web/src/main/hbs/overview/overview-debt.hbs index 232cc2228fe..132f040fcbd 100644 --- a/server/sonar-web/src/main/hbs/overview/overview-debt.hbs +++ b/server/sonar-web/src/main/hbs/overview/overview-debt.hbs @@ -4,6 +4,9 @@ <tr> <td class="width-55"> <div class="overview-main-measure"> + {{#notNull sqaleRating}} + <a href="{{urlForDrilldown componentKey 'sqale_rating'}}"><span class="rating rating-{{formatMeasure sqaleRating 'RATING'}}">{{formatMeasure sqaleRating 'RATING'}}</span></a> + {{/notNull}} <a href="{{urlForDrilldown componentKey 'sqale_index'}}">{{formatMeasure debt 'WORK_DUR'}}</a> </div> <div class="overview-trend"> diff --git a/server/sonar-web/src/main/js/application.js b/server/sonar-web/src/main/js/application.js index 24088b89b81..cde3f74828b 100644 --- a/server/sonar-web/src/main/js/application.js +++ b/server/sonar-web/src/main/js/application.js @@ -423,6 +423,15 @@ function fileFromPath (path) { }; /** + * Format a rating measure + * @param value + */ + var ratingFormatter = function (value) { + var intValue = +value; + return String.fromCharCode(97 + intValue - 1).toUpperCase(); + }; + + /** * Format a measure according to its type * @param measure * @param {string} type @@ -440,7 +449,8 @@ function fileFromPath (path) { 'PERCENT': function (value) { return numeral(+value / 100).format('0,0.0%'); }, - 'WORK_DUR': durationFormatter + 'WORK_DUR': durationFormatter, + 'RATING': ratingFormatter }; if (measure != null && type != null) { formatted = formatters[type] != null ? formatters[type](measure) : measure; diff --git a/server/sonar-web/src/main/js/overview/models/state.js b/server/sonar-web/src/main/js/overview/models/state.js index c8b2f228aeb..b62181ada55 100644 --- a/server/sonar-web/src/main/js/overview/models/state.js +++ b/server/sonar-web/src/main/js/overview/models/state.js @@ -24,6 +24,7 @@ define(function () { SIZE_METRIC = 'ncloc', ISSUES_METRIC = 'violations', DEBT_METRIC = 'sqale_index', + SQALE_RATING_METRIC = 'sqale_rating', COVERAGE_METRIC = 'overall_coverage', NEW_COVERAGE_METRIC = 'new_overall_coverage', DUPLICATIONS_METRIC = 'duplicated_lines_density'; @@ -67,6 +68,7 @@ define(function () { GATE_METRIC, SIZE_METRIC, DEBT_METRIC, + SQALE_RATING_METRIC, COVERAGE_METRIC, NEW_COVERAGE_METRIC, DUPLICATIONS_METRIC @@ -153,7 +155,8 @@ define(function () { }, parseDebt: function (msr) { - var debtMeasure = _.findWhere(msr, { key: DEBT_METRIC }); + var debtMeasure = _.findWhere(msr, { key: DEBT_METRIC }), + sqaleRatingMeasure = _.findWhere(msr, { key: SQALE_RATING_METRIC }); if (debtMeasure != null) { this.set({ debt: debtMeasure.val, @@ -162,6 +165,9 @@ define(function () { debt3: debtMeasure.var3 }); } + if (sqaleRatingMeasure != null) { + this.set({ sqaleRating: sqaleRatingMeasure.val }); + } }, parseCoverage: function (msr) { |