diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-09-16 13:41:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-16 13:41:29 +0200 |
commit | 2e79ddbc769ea669173acbafcacf93eb4a088cc4 (patch) | |
tree | e3e9688737853b553cb44b1571b802915658eb47 /server/sonar-web/src/main/js/apps/code | |
parent | df422565d7e3a3718e1c321ec22c68260a72d799 (diff) | |
download | sonarqube-2e79ddbc769ea669173acbafcacf93eb4a088cc4.tar.gz sonarqube-2e79ddbc769ea669173acbafcacf93eb4a088cc4.zip |
SONAR-7932 Useless WS call on the Code page (#1248)
Diffstat (limited to 'server/sonar-web/src/main/js/apps/code')
-rw-r--r-- | server/sonar-web/src/main/js/apps/code/components/App.js | 9 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/code/utils.js | 7 |
2 files changed, 9 insertions, 7 deletions
diff --git a/server/sonar-web/src/main/js/apps/code/components/App.js b/server/sonar-web/src/main/js/apps/code/components/App.js index fda516734ca..86563c2875f 100644 --- a/server/sonar-web/src/main/js/apps/code/components/App.js +++ b/server/sonar-web/src/main/js/apps/code/components/App.js @@ -25,8 +25,8 @@ import Breadcrumbs from './Breadcrumbs'; import SourceViewer from './../../../components/source-viewer/SourceViewer'; import Search from './Search'; import ListFooter from '../../../components/controls/ListFooter'; -import { retrieveComponentBase, retrieveComponent, loadMoreChildren, parseError } from '../utils'; -import { addComponentBreadcrumbs } from '../bucket'; +import { retrieveComponentChildren, retrieveComponent, loadMoreChildren, parseError } from '../utils'; +import { addComponent, addComponentBreadcrumbs } from '../bucket'; import { selectCoverageMetric } from '../../../helpers/measures'; import '../code.css'; @@ -68,8 +68,9 @@ export default class App extends React.Component { this.setState({ loading: true }); const isView = component.qualifier === 'VW' || component.qualifier === 'SVW'; - retrieveComponentBase(component.key, isView).then(component => { - const prefix = selectCoverageMetric(component.measures); + retrieveComponentChildren(component.key, isView).then(r => { + addComponent(r.baseComponent); + const prefix = selectCoverageMetric(r.baseComponent.measures); this.coverageMetric = `${prefix}coverage`; this.handleUpdate(); }).catch(e => { diff --git a/server/sonar-web/src/main/js/apps/code/utils.js b/server/sonar-web/src/main/js/apps/code/utils.js index 2236c75dde8..b0a6e4b2ad0 100644 --- a/server/sonar-web/src/main/js/apps/code/utils.js +++ b/server/sonar-web/src/main/js/apps/code/utils.js @@ -91,7 +91,8 @@ function prepareChildren (r) { return { components: r.components, total: r.paging.total, - page: r.paging.pageIndex + page: r.paging.pageIndex, + baseComponent: r.baseComponent }; } @@ -124,7 +125,7 @@ function getMetrics (isView) { * @param {boolean} isView * @returns {Promise} */ -export function retrieveComponentBase (componentKey, isView) { +function retrieveComponentBase (componentKey, isView) { const existing = getComponentFromBucket(componentKey); if (existing) { return Promise.resolve(existing); @@ -143,7 +144,7 @@ export function retrieveComponentBase (componentKey, isView) { * @param {boolean} isView * @returns {Promise} */ -function retrieveComponentChildren (componentKey, isView) { +export function retrieveComponentChildren (componentKey, isView) { const existing = getComponentChildren(componentKey); if (existing) { return Promise.resolve({ |