From b0bb06b6b6522c403c2935830db4ae155caa6840 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Mon, 30 Nov 2015 13:51:24 +0100 Subject: [PATCH] SONAR-6945 Limit the number of bubbles on the overview bubble chart --- .../js/apps/overview/components/domain-bubble-chart.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/sonar-web/src/main/js/apps/overview/components/domain-bubble-chart.js b/server/sonar-web/src/main/js/apps/overview/components/domain-bubble-chart.js index 69c2be4f1ba..b1905b695c4 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/domain-bubble-chart.js +++ b/server/sonar-web/src/main/js/apps/overview/components/domain-bubble-chart.js @@ -8,6 +8,7 @@ import { formatMeasure } from '../../../helpers/measures'; const HEIGHT = 360; +const BUBBLES_LIMIT = 500; function getMeasure (component, metric) { @@ -41,10 +42,15 @@ export class DomainBubbleChart extends React.Component { }); return _.extend(file, { measures }); }); - this.setState({ loading: false, files }); + this.setState({ loading: false, files: this.limitFiles(files) }); }); } + limitFiles (files) { + const comparator = file => -1 * this.getSizeMetricsValue(file); + return _.sortBy(files, comparator).slice(0, BUBBLES_LIMIT); + } + getMetricObject (metrics, metricKey) { return _.findWhere(metrics, { key: metricKey }); } -- 2.39.5