diff options
Diffstat (limited to 'server/sonar-web/src/main/js/components/controls/HomePageSelect.tsx')
-rw-r--r-- | server/sonar-web/src/main/js/components/controls/HomePageSelect.tsx | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/server/sonar-web/src/main/js/components/controls/HomePageSelect.tsx b/server/sonar-web/src/main/js/components/controls/HomePageSelect.tsx index 9d68ef7e1fc..572e65cb5ae 100644 --- a/server/sonar-web/src/main/js/components/controls/HomePageSelect.tsx +++ b/server/sonar-web/src/main/js/components/controls/HomePageSelect.tsx @@ -24,11 +24,12 @@ import Tooltip from './Tooltip'; import HomeIcon from '../icons-components/HomeIcon'; import { CurrentUser, isLoggedIn, HomePage, isSameHomePage } from '../../app/types'; import { translate } from '../../helpers/l10n'; -import { getCurrentUser } from '../../store/rootReducer'; +import { getCurrentUser, getGlobalSettingValue } from '../../store/rootReducer'; import { setHomePage } from '../../store/users/actions'; interface StateProps { currentUser: CurrentUser; + onSonarCloud: boolean; } interface DispatchProps { @@ -48,9 +49,9 @@ class HomePageSelect extends React.PureComponent<Props> { }; render() { - const { currentPage, currentUser } = this.props; + const { currentPage, currentUser, onSonarCloud } = this.props; - if (!isLoggedIn(currentUser)) { + if (!isLoggedIn(currentUser) || !onSonarCloud) { return null; } @@ -59,7 +60,7 @@ class HomePageSelect extends React.PureComponent<Props> { const tooltip = checked ? translate('homepage.current') : translate('homepage.check'); return ( - <Tooltip overlay={tooltip}> + <Tooltip overlay={tooltip} placement="left"> {checked ? ( <span className={classNames('display-inline-block', this.props.className)}> <HomeIcon filled={checked} /> @@ -81,9 +82,14 @@ class HomePageSelect extends React.PureComponent<Props> { } } -const mapStateToProps = (state: any): StateProps => ({ - currentUser: getCurrentUser(state) -}); +const mapStateToProps = (state: any): StateProps => { + const sonarCloudSetting = getGlobalSettingValue(state, 'sonar.sonarcloud.enabled'); + + return { + currentUser: getCurrentUser(state), + onSonarCloud: Boolean(sonarCloudSetting && sonarCloudSetting.value === 'true') + }; +}; const mapDispatchToProps: DispatchProps = { setHomePage }; |