diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-11-29 17:03:24 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2016-12-07 14:36:18 +0100 |
commit | f1976a3f56f03c67ccbf6dca7ee5060b6a21a1da (patch) | |
tree | f8741034e51ae45b37201e90a305ebb3802da7c7 /server/sonar-web/src/main/js/apps/permissions | |
parent | b117943f3efa541d6c8cd8e62ad157c4f8194211 (diff) | |
download | sonarqube-f1976a3f56f03c67ccbf6dca7ee5060b6a21a1da.tar.gz sonarqube-f1976a3f56f03c67ccbf6dca7ee5060b6a21a1da.zip |
SONAR-8451 Run js app outside of ruby container
Diffstat (limited to 'server/sonar-web/src/main/js/apps/permissions')
-rw-r--r-- | server/sonar-web/src/main/js/apps/permissions/project/components/App.js | 14 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/permissions/project/components/PageHeader.js | 3 |
2 files changed, 14 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/App.js b/server/sonar-web/src/main/js/apps/permissions/project/components/App.js index ba2b4e44e2e..c7657ddcc51 100644 --- a/server/sonar-web/src/main/js/apps/permissions/project/components/App.js +++ b/server/sonar-web/src/main/js/apps/permissions/project/components/App.js @@ -18,14 +18,16 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import React from 'react'; +import { connect } from 'react-redux'; import PageHeader from './PageHeader'; import AllHoldersList from './AllHoldersList'; import PageError from '../../shared/components/PageError'; +import { getComponent, getCurrentUser } from '../../../../app/store/rootReducer'; import '../../styles.css'; // TODO helmet -export default class App extends React.Component { +class App extends React.Component { static propTypes = { component: React.PropTypes.object }; @@ -37,10 +39,18 @@ export default class App extends React.Component { return ( <div className="page page-limited"> - <PageHeader project={this.props.component}/> + <PageHeader project={this.props.component} currentUser={this.props.currentUser}/> <PageError/> <AllHoldersList project={this.props.component}/> </div> ); } } + +const mapStateToProps = (state, ownProps) => ({ + component: getComponent(state, ownProps.location.query.id), + currentUser: getCurrentUser(state) +}); + +export default connect(mapStateToProps)(App); + diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/PageHeader.js b/server/sonar-web/src/main/js/apps/permissions/project/components/PageHeader.js index 14fcf947ee9..456a16cf7a3 100644 --- a/server/sonar-web/src/main/js/apps/permissions/project/components/PageHeader.js +++ b/server/sonar-web/src/main/js/apps/permissions/project/components/PageHeader.js @@ -23,6 +23,7 @@ import { translate } from '../../../../helpers/l10n'; import ApplyTemplateView from '../views/ApplyTemplateView'; import { loadHolders } from '../store/actions'; import { isPermissionsAppLoading } from '../../../../app/store/rootReducer'; +import { isUserAdmin } from '../../../../helpers/users'; class PageHeader extends React.Component { static propTypes = { @@ -59,7 +60,7 @@ class PageHeader extends React.Component { <i className="spinner"/> )} - {!!window.SS.isUserAdmin && ( + {isUserAdmin(this.props.currentUser) && ( <div className="page-actions"> <button className="js-apply-template" onClick={this.handleApplyTemplate}> Apply Template |