diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-08-16 12:13:51 +0200 |
---|---|---|
committer | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-08-17 16:42:34 +0200 |
commit | 8f016916eafb2052e472ba8eba78d0e7db4b5210 (patch) | |
tree | 2bed532ef00fea82de0fbca47494073712c9dd43 | |
parent | d07cc710fa8636ac88b18adab98b21cbde813ba1 (diff) | |
download | sonarqube-8f016916eafb2052e472ba8eba78d0e7db4b5210.tar.gz sonarqube-8f016916eafb2052e472ba8eba78d0e7db4b5210.zip |
SONAR-9605 Fix infinite spinner on project overview page
3 files changed, 26 insertions, 8 deletions
diff --git a/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js b/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js index dc43acba02c..11d09882375 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js +++ b/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js @@ -93,15 +93,23 @@ export default class OverviewApp extends React.PureComponent { return getMeasuresAndMeta(componentKey, METRICS, { additionalFields: 'metrics,periods' - }).then(r => { - if (this.mounted) { - this.setState({ - loading: false, - measures: enhanceMeasuresWithMetrics(r.component.measures, r.metrics), - periods: r.periods - }); + }).then( + r => { + if (this.mounted) { + this.setState({ + loading: false, + measures: enhanceMeasuresWithMetrics(r.component.measures, r.metrics), + periods: r.periods + }); + } + }, + error => { + throwGlobalError(error); + if (this.mounted) { + this.setState({ loading: false }); + } } - }, throwGlobalError); + ); } loadHistory(component /*: Component */) { diff --git a/server/sonar-web/src/main/js/apps/overview/main/BugsAndVulnerabilities.js b/server/sonar-web/src/main/js/apps/overview/main/BugsAndVulnerabilities.js index 95f88510f19..4841f32c2cb 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/BugsAndVulnerabilities.js +++ b/server/sonar-web/src/main/js/apps/overview/main/BugsAndVulnerabilities.js @@ -138,6 +138,11 @@ class BugsAndVulnerabilities extends React.PureComponent { } render() { + const { measures } = this.props; + const bugsMeasure = measures.find(measure => measure.metric.key === 'bugs'); + if (bugsMeasure == null) { + return null; + } return ( <div className="overview-card overview-card-special"> {this.renderHeader()} diff --git a/server/sonar-web/src/main/js/apps/overview/main/CodeSmells.js b/server/sonar-web/src/main/js/apps/overview/main/CodeSmells.js index 2c5a5e9289c..00e81e9d47a 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/CodeSmells.js +++ b/server/sonar-web/src/main/js/apps/overview/main/CodeSmells.js @@ -148,6 +148,11 @@ class CodeSmells extends React.PureComponent { } render() { + const { measures } = this.props; + const codeSmellsMeasure = measures.find(measure => measure.metric.key === 'code_smells'); + if (codeSmellsMeasure == null) { + return null; + } return ( <div className="overview-card" id="overview-code-smells"> {this.renderHeader()} |