diff options
Diffstat (limited to 'server/sonar-web/src/main/js/apps/about/components/AboutApp.js')
-rw-r--r-- | server/sonar-web/src/main/js/apps/about/components/AboutApp.js | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutApp.js b/server/sonar-web/src/main/js/apps/about/components/AboutApp.js index ee0a05da356..f22509ca1d5 100644 --- a/server/sonar-web/src/main/js/apps/about/components/AboutApp.js +++ b/server/sonar-web/src/main/js/apps/about/components/AboutApp.js @@ -104,18 +104,17 @@ class AboutApp extends React.PureComponent { } render() { - if (this.state.loading) { - return null; - } - const { customText, sonarqubeDotCom } = this.props; - - // $FlowFixMe - const bugs = this.state.issueTypes['BUG'].count; - // $FlowFixMe - const vulnerabilities = this.state.issueTypes['VULNERABILITY'].count; - // $FlowFixMe - const codeSmells = this.state.issueTypes['CODE_SMELL'].count; + const { loading, issueTypes, projectsCount } = this.state; + + let bugs; + let vulnerabilities; + let codeSmells; + if (!loading && issueTypes) { + bugs = issueTypes['BUG'] && issueTypes['BUG'].count; + vulnerabilities = issueTypes['VULNERABILITY'] && issueTypes['VULNERABILITY'].count; + codeSmells = issueTypes['CODE_SMELL'] && issueTypes['CODE_SMELL'].count; + } if (sonarqubeDotCom && sonarqubeDotCom.value === 'true') { return ( @@ -125,7 +124,8 @@ class AboutApp extends React.PureComponent { codeSmells={codeSmells} currentUser={this.props.currentUser} customText={customText} - projectsCount={this.state.projectsCount} + loading={loading} + projectsCount={projectsCount} vulnerabilities={vulnerabilities} /> ); @@ -152,11 +152,12 @@ class AboutApp extends React.PureComponent { </div> <div className="about-page-instance"> - <AboutProjects count={this.state.projectsCount} /> + <AboutProjects count={projectsCount} loading={loading} /> <EntryIssueTypes bugs={bugs} - vulnerabilities={vulnerabilities} codeSmells={codeSmells} + loading={loading} + vulnerabilities={vulnerabilities} /> </div> </div> |