diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-01-20 15:01:03 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2016-01-20 15:01:21 +0100 |
commit | 1d8bdc592ad2f615c1fc7d358327fb77171baec3 (patch) | |
tree | 585451daa819af6f85c253678105222c20f17bcb /server/sonar-web/src/main/js/apps/overview/main | |
parent | bbda3cfd4c3463509430a0d9cf4e283167c9769a (diff) | |
download | sonarqube-1d8bdc592ad2f615c1fc7d358327fb77171baec3.tar.gz sonarqube-1d8bdc592ad2f615c1fc7d358327fb77171baec3.zip |
use new WS on overview page
Diffstat (limited to 'server/sonar-web/src/main/js/apps/overview/main')
-rw-r--r-- | server/sonar-web/src/main/js/apps/overview/main/main.js | 17 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/overview/main/structure.js | 2 |
2 files changed, 11 insertions, 8 deletions
diff --git a/server/sonar-web/src/main/js/apps/overview/main/main.js b/server/sonar-web/src/main/js/apps/overview/main/main.js index 454b65d0016..b30234371c5 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/main.js +++ b/server/sonar-web/src/main/js/apps/overview/main/main.js @@ -27,7 +27,7 @@ import { GeneralDuplications } from './duplications'; import { GeneralStructure } from './structure'; import { CoverageSelectionMixin } from '../components/coverage-selection-mixin'; import { getPeriodLabel, getPeriodDate } from './../helpers/periods'; -import { getMeasuresAndVariations } from '../../../api/measures'; +import { getMeasures } from '../../../api/measures'; import { getIssuesCount } from '../../../api/issues'; import { getTimeMachineData } from '../../../api/time-machine'; @@ -76,13 +76,13 @@ export default React.createClass({ this.requestIssuesAndDebt(), this.requestLeakIssuesAndDebt() ]).then(responses => { - let measures = this.getMeasuresValues(responses[0], 'value'); + let measures = this.getMeasuresValues(responses[0]); measures.issues = responses[1].issues; measures.debt = responses[1].debt; let leak; if (this.state.leakPeriodDate) { - leak = this.getMeasuresValues(responses[0], 'var' + this.props.leakPeriodIndex); + leak = this.getMeasuresValues(responses[0], Number(this.props.leakPeriodIndex)); leak.issues = responses[2].issues; leak.debt = responses[2].debt; } @@ -97,13 +97,16 @@ export default React.createClass({ }, requestMeasures () { - return getMeasuresAndVariations(this.props.component.key, METRICS_LIST); + return getMeasures(this.props.component.key, METRICS_LIST); }, - getMeasuresValues (measures, fieldKey) { + getMeasuresValues (measures, period) { let values = {}; - Object.keys(measures).forEach(measureKey => { - values[measureKey] = measures[measureKey][fieldKey]; + measures.forEach(measure => { + const container = period ? _.findWhere(measure.periods, { index: period }) : measure; + if (container) { + values[measure.metric] = container.value; + } }); return values; }, diff --git a/server/sonar-web/src/main/js/apps/overview/main/structure.js b/server/sonar-web/src/main/js/apps/overview/main/structure.js index 8ca70fa06f3..0e794d06126 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/structure.js +++ b/server/sonar-web/src/main/js/apps/overview/main/structure.js @@ -63,7 +63,7 @@ export const GeneralStructure = React.createClass({ } return <Measure composite={true}> <div style={{ width: 200 }}> - <LanguageDistribution lines={this.props.measures['ncloc']} + <LanguageDistribution lines={Number(this.props.measures['ncloc'])} distribution={this.props.measures['ncloc_language_distribution']}/> </div> </Measure>; |