aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2019-01-11 17:19:13 +0100
committersonartech <sonartech@sonarsource.com>2019-01-16 09:43:13 +0100
commit56d62256140fbec5383c6c78b620881d3c4b03f3 (patch)
treeb6eda10100f843dbab7cf8b7de712e65e60c7bd6 /server/sonar-web/src/main/js
parent2d70af2266bfe2871ed871a23edea807f54aaf64 (diff)
downloadsonarqube-56d62256140fbec5383c6c78b620881d3c4b03f3.tar.gz
sonarqube-56d62256140fbec5383c6c78b620881d3c4b03f3.zip
SONAR-11565 Fix blank treemap for leak measures without new lines
Diffstat (limited to 'server/sonar-web/src/main/js')
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/charts/TreeMap.tsx17
2 files changed, 3 insertions, 17 deletions
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.tsx b/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.tsx
index deb57ee0584..747a761824e 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.tsx
@@ -78,6 +78,9 @@ export default class TreeMapView extends React.PureComponent<Props, State> {
}
const sizeValue = Number(rawSizeValue);
+ if (sizeValue < 1) {
+ return undefined;
+ }
return {
color:
colorValue !== undefined ? (colorScale as Function)(colorValue) : theme.secondFontColor,
diff --git a/server/sonar-web/src/main/js/components/charts/TreeMap.tsx b/server/sonar-web/src/main/js/components/charts/TreeMap.tsx
index b9594542a61..dd0ee34003e 100644
--- a/server/sonar-web/src/main/js/components/charts/TreeMap.tsx
+++ b/server/sonar-web/src/main/js/components/charts/TreeMap.tsx
@@ -20,7 +20,6 @@
import * as React from 'react';
import { treemap as d3Treemap, hierarchy as d3Hierarchy } from 'd3-hierarchy';
import TreeMapRect from './TreeMapRect';
-import { translate } from '../../helpers/l10n';
import { Location } from '../../helpers/urls';
import './TreeMap.css';
@@ -61,24 +60,8 @@ export default class TreeMap extends React.PureComponent<Props> {
return prefix.substr(0, prefix.length - lastPrefixPart.length);
};
- renderNoData() {
- return (
- <div className="sonar-d3">
- <div
- className="treemap-container"
- style={{ width: this.props.width, height: this.props.height }}>
- {translate('no_data')}
- </div>
- </div>
- );
- }
-
render() {
const { items, height, width } = this.props;
- if (items.length <= 0) {
- return this.renderNoData();
- }
-
const hierarchy = d3Hierarchy({ children: items } as HierarchicalTreemapItem)
.sum(d => d.size)
.sort((a, b) => (b.value || 0) - (a.value || 0));