diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-10-27 15:04:06 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-10-27 15:04:06 +0100 |
commit | 631c474b504dabbf68cf39b836407675ef59e725 (patch) | |
tree | 5ae0325ab0bb23ac1efa1507619cc19e9226cee1 | |
parent | f95fb67038a9ca90836f337f74b6d1eeb71cdd65 (diff) | |
download | sonarqube-631c474b504dabbf68cf39b836407675ef59e725.tar.gz sonarqube-631c474b504dabbf68cf39b836407675ef59e725.zip |
SONAR-6331 apply feedback
-rw-r--r-- | server/sonar-web/src/main/js/apps/overview/domain/timeline.js | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/server/sonar-web/src/main/js/apps/overview/domain/timeline.js b/server/sonar-web/src/main/js/apps/overview/domain/timeline.js index 7fdee332a63..baa63d6016c 100644 --- a/server/sonar-web/src/main/js/apps/overview/domain/timeline.js +++ b/server/sonar-web/src/main/js/apps/overview/domain/timeline.js @@ -10,6 +10,13 @@ import { getEvents } from '../../../api/events'; const HEIGHT = 280; +function parseValue (value, type) { + return type === 'RATING' && typeof value === 'string' ? + value.charCodeAt(0) - 'A'.charCodeAt(0) + 1 : + value; +} + + export class DomainTimeline extends React.Component { constructor (props) { super(props); @@ -90,20 +97,23 @@ export class DomainTimeline extends React.Component { return this.renderLoading(); } - if (!this.state.events.length || !this.state.snapshots.length) { + let events = this.prepareEvents(); + + if (!events.length) { return this.renderWhenNoHistoricalData(); } - let events = this.prepareEvents(); let currentMetricType = _.findWhere(this.props.metrics, { key: this.state.currentMetric }).type; let data = events.map((event, index) => { - return { x: index, y: event.value }; + return { x: index, y: parseValue(event.value, currentMetricType) }; }); let xTicks = events.map(event => event.version.substr(0, 6)); - let xValues = events.map(event => window.formatMeasure(event.value, currentMetricType)); + let xValues = events.map(event => { + return currentMetricType === 'RATING' ? event.value : window.formatMeasure(event.value, currentMetricType); + }); // TODO use leak period let backdropConstraints = [ |