]> source.dussan.org Git - sonarqube.git/commitdiff
filter out empty components on the overview treemap
authorStas Vilchik <vilchiks@gmail.com>
Wed, 9 Dec 2015 08:57:23 +0000 (09:57 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Wed, 9 Dec 2015 15:29:49 +0000 (16:29 +0100)
server/sonar-web/src/main/js/apps/overview/components/domain-treemap.js

index 033a791ead48f02eff41f2f0605fc0c6e84de579..03253cbcf5a5d28e5b528eb1b6b2ae1a49881afd 100644 (file)
@@ -95,20 +95,21 @@ export class DomainTreemap extends React.Component {
       return this.renderLoading();
     }
 
-    // TODO filter out zero sized components
-    let items = this.state.components.map(component => {
-      let colorMeasure = this.props.colorMetric ? component.measures[this.props.colorMetric] : null;
-      return {
-        key: component.key,
-        name: component.name,
-        qualifier: component.qualifier,
-        size: component.measures[this.props.sizeMetric],
-        color: colorMeasure != null ? this.props.scale(colorMeasure) : '#777',
-        tooltip: this.getTooltip(component),
-        label: component.name,
-        link: getComponentUrl(component.key)
-      };
-    });
+    let items = this.state.components
+        .filter(component => component.measures[this.props.sizeMetric])
+        .map(component => {
+          let colorMeasure = this.props.colorMetric ? component.measures[this.props.colorMetric] : null;
+          return {
+            key: component.key,
+            name: component.name,
+            qualifier: component.qualifier,
+            size: component.measures[this.props.sizeMetric],
+            color: colorMeasure != null ? this.props.scale(colorMeasure) : '#777',
+            tooltip: this.getTooltip(component),
+            label: component.name,
+            link: getComponentUrl(component.key)
+          };
+        });
 
     const canBeClicked = node => node.qualifier !== 'FIL' && node.qualifier !== 'UTS';