diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-10-28 10:25:13 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-10-30 10:46:02 +0100 |
commit | 1e5830fb652fda2da6f18460c92f82d93c52130c (patch) | |
tree | 8383c08cc17ed71555b1cd8468292968f9bf07f1 /server/sonar-web/src/main/js/apps/overview/overview.js | |
parent | a3528799883487e180ce90985e96cf87281e645f (diff) | |
download | sonarqube-1e5830fb652fda2da6f18460c92f82d93c52130c.tar.gz sonarqube-1e5830fb652fda2da6f18460c92f82d93c52130c.zip |
SONAR-6331 improve UX of the project overview page
Diffstat (limited to 'server/sonar-web/src/main/js/apps/overview/overview.js')
-rw-r--r-- | server/sonar-web/src/main/js/apps/overview/overview.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/apps/overview/overview.js b/server/sonar-web/src/main/js/apps/overview/overview.js new file mode 100644 index 00000000000..f03573a2677 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/overview/overview.js @@ -0,0 +1,54 @@ +import React from 'react'; + +import Gate from './gate/gate'; +import GeneralMain from './general/main'; +import Meta from './meta'; +import { getMetrics } from '../../api/metrics'; + + +export const Overview = React.createClass({ + getInitialState () { + return { ready: false }; + }, + + componentDidMount () { + this.requestMetrics(); + }, + + requestMetrics () { + return getMetrics().then(metrics => this.setState({ ready: true, metrics })); + }, + + renderLoading () { + return <div className="text-center"> + <i className="spinner spinner-margin"/> + </div>; + }, + + render () { + if (!this.state.ready) { + return this.renderLoading(); + } + + return <div className="overview"> + <div className="overview-main"> + <Gate component={this.props.component} gate={this.props.gate}/> + <GeneralMain {...this.props} {...this.state}/> + </div> + <Meta component={this.props.component}/> + </div>; + } +}); + + +export const EmptyOverview = React.createClass({ + render() { + return ( + <div className="page"> + <div className="alert alert-warning"> + {window.t('provisioning.no_analysis')} + </div> + </div> + ); + } +}); |