aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-08-14 17:10:50 +0200
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-08-16 09:14:40 +0200
commitba116aa74c68625be4bedbca31a10e21d5b86055 (patch)
treea3b6255bd6eb2145551aef9fbb2dbe62290a8873 /server/sonar-web/src/main/js
parenta212d447fddcff546a0d274d5186d5963f9ecf83 (diff)
downloadsonarqube-ba116aa74c68625be4bedbca31a10e21d5b86055.tar.gz
sonarqube-ba116aa74c68625be4bedbca31a10e21d5b86055.zip
SONAR-8805 In measures page treemap use new_lines as the size measure for the leak metrics
Diffstat (limited to 'server/sonar-web/src/main/js')
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.js18
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.js14
2 files changed, 20 insertions, 12 deletions
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.js b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.js
index 13973073e8a..b4c91f405cc 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.js
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.js
@@ -111,22 +111,22 @@ export default class MeasureContent extends React.PureComponent {
const strategy = view === 'list' ? 'leaves' : 'children';
const metricKeys = [metric.key];
const opts /*: Object */ = { metricSortFilter: 'withMeasuresOnly' };
+ const isDiff = isDiffMetric(metric.key);
+ if (isDiff) {
+ opts.metricPeriodSort = 1;
+ }
if (view === 'treemap') {
- metricKeys.push('ncloc');
+ const sizeMetric = isDiff ? 'new_lines' : 'ncloc';
+ metricKeys.push(sizeMetric);
+ opts.metricSort = sizeMetric;
+ opts.s = isDiff ? 'metricPeriod' : 'metric';
opts.asc = false;
- opts.metricSort = 'ncloc';
- opts.s = 'metric';
} else {
metricKeys.push(...(complementary[metric.key] || []));
opts.asc = metric.direction === 1;
opts.ps = 100;
opts.metricSort = metric.key;
- if (isDiffMetric(metric.key)) {
- opts.s = 'metricPeriod,name';
- opts.metricPeriodSort = 1;
- } else {
- opts.s = 'metric,name';
- }
+ opts.s = isDiff ? 'metricPeriod,name' : 'metric,name';
}
return { metricKeys, opts: { ...opts, ...options }, strategy };
};
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.js b/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.js
index d6b2542f09b..5bfa9a7873f 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.js
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.js
@@ -169,20 +169,28 @@ export default class TreeMapView extends React.PureComponent {
if (treemapItems.length <= 0) {
return <EmptyResult />;
}
-
+ const { components, metric } = this.props;
+ const sizeMeasure =
+ components.length > 0
+ ? components[0].measures.find(measure => measure.metric.key !== metric.key)
+ : null;
return (
<div className="measure-details-treemap">
<ul className="list-inline note spacer-bottom">
<li>
{translateWithParameters(
'component_measures.legend.color_x',
- getLocalizedMetricName(this.props.metric)
+ getLocalizedMetricName(metric)
)}
</li>
<li>
{translateWithParameters(
'component_measures.legend.size_x',
- translate('metric.ncloc.name')
+ translate(
+ 'metric',
+ sizeMeasure && sizeMeasure.metric ? sizeMeasure.metric.key : 'ncloc',
+ 'name'
+ )
)}
</li>
<li className="pull-right">