diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-05-02 15:18:15 +0200 |
---|---|---|
committer | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-05-05 15:05:12 +0200 |
commit | 282c729e2aed2e3362c89e60ada017dbdf51f6dc (patch) | |
tree | 0534fcbae841c84b4235ddf2636dfaa96c0d06b4 | |
parent | 18a8b0a754b4fd6b44d677e4cd63155d826810d1 (diff) | |
download | sonarqube-282c729e2aed2e3362c89e60ada017dbdf51f6dc.tar.gz sonarqube-282c729e2aed2e3362c89e60ada017dbdf51f6dc.zip |
SONAR-9173 Hide some elements of the footer when the user is not logged
6 files changed, 92 insertions, 27 deletions
diff --git a/it/it-tests/src/test/java/it/ui/UiTest.java b/it/it-tests/src/test/java/it/ui/UiTest.java index b75534fd12f..b60c9e2768c 100644 --- a/it/it-tests/src/test/java/it/ui/UiTest.java +++ b/it/it-tests/src/test/java/it/ui/UiTest.java @@ -63,6 +63,15 @@ public class UiTest { } @Test + public void footer_doesnt_contains_version_on_login_page() { + WsResponse status = ItUtils.newAdminWsClient(ORCHESTRATOR).wsConnector().call(new GetRequest("api/navigation/global")); + Map<String, Object> statusMap = ItUtils.jsonToMap(status.content()); + + nav.openLogin(); + nav.getFooter().shouldNot(hasText((String) statusMap.get("version"))); + } + + @Test public void many_page_transitions() { analyzeSampleProject(); diff --git a/server/sonar-web/src/main/js/app/components/GlobalFooter.js b/server/sonar-web/src/main/js/app/components/GlobalFooter.js index 0a8dd3789ab..ef7c0658246 100644 --- a/server/sonar-web/src/main/js/app/components/GlobalFooter.js +++ b/server/sonar-web/src/main/js/app/components/GlobalFooter.js @@ -23,44 +23,53 @@ import { Link } from 'react-router'; import { connect } from 'react-redux'; import { getAppState } from '../../store/rootReducer'; import GlobalFooterBranding from './GlobalFooterBranding'; +import { translate, translateWithParameters } from '../../helpers/l10n'; -function GlobalFooter(props: Object) { - const { sonarqubeVersion, productionDatabase } = props; +type Props = { + hideLoggedInInfo?: boolean, + productionDatabase: boolean, + sonarqubeVersion?: string +}; +function GlobalFooter({ hideLoggedInInfo, sonarqubeVersion, productionDatabase }: Props) { return ( <div id="footer" className="page-footer page-container"> {productionDatabase === false && <div className="alert alert-danger"> <p className="big" id="evaluation_warning"> - Embedded database should be used for evaluation purpose only + {translate('footer.production_database_warning')} </p> <p> - The embedded database will not scale, it will not support upgrading to newer - {' '} - versions of SonarQube, and there is no support for migrating your data out of it - {' '} - into a different database engine. + {translate('footer.production_database_explanation')} </p> </div>} <GlobalFooterBranding /> <div> - Version {sonarqubeVersion} + {!hideLoggedInInfo && + sonarqubeVersion && + translateWithParameters('footer.version_x', sonarqubeVersion)} + {!hideLoggedInInfo && sonarqubeVersion && ' - '} + <a href="http://www.gnu.org/licenses/lgpl-3.0.txt">{translate('footer.licence')}</a> {' - '} - <a href="http://www.gnu.org/licenses/lgpl-3.0.txt">LGPL v3</a> + <a href="http://www.sonarqube.org">{translate('footer.community')}</a> {' - '} - <a href="http://www.sonarqube.org">Community</a> + <a href="https://redirect.sonarsource.com/doc/home.html"> + {translate('footer.documentation')} + </a> {' - '} - <a href="https://redirect.sonarsource.com/doc/home.html">Documentation</a> + <a href="https://redirect.sonarsource.com/doc/community.html"> + {translate('footer.support')} + </a> {' - '} - <a href="https://redirect.sonarsource.com/doc/community.html">Get Support</a> - {' - '} - <a href="https://redirect.sonarsource.com/doc/plugin-library.html">Plugins</a> - {' - '} - <Link to="/web_api">Web API</Link> - {' - '} - <Link to="/about">About</Link> + <a href="https://redirect.sonarsource.com/doc/plugin-library.html"> + {translate('footer.plugins')} + </a> + {!hideLoggedInInfo && ' - '} + {!hideLoggedInInfo && <Link to="/web_api">{translate('footer.web_api')}</Link>} + {!hideLoggedInInfo && ' - '} + {!hideLoggedInInfo && <Link to="/about">{translate('footer.about')}</Link>} </div> </div> ); diff --git a/server/sonar-web/src/main/js/app/components/SimpleContainer.js b/server/sonar-web/src/main/js/app/components/SimpleContainer.js index cc3309d0a25..a661748ec07 100644 --- a/server/sonar-web/src/main/js/app/components/SimpleContainer.js +++ b/server/sonar-web/src/main/js/app/components/SimpleContainer.js @@ -21,13 +21,13 @@ import React from 'react'; import GlobalFooter from './GlobalFooter'; +type Props = { + children?: React.Element<*> | Array<React.Element<*>>, + hideLoggedInInfo?: boolean +}; + export default class SimpleContainer extends React.PureComponent { - static propTypes = { - children: React.PropTypes.oneOfType([ - React.PropTypes.element, - React.PropTypes.arrayOf(React.PropTypes.element) - ]) - }; + props: Props; componentDidMount() { const html = document.querySelector('html'); @@ -57,7 +57,7 @@ export default class SimpleContainer extends React.PureComponent { </div> </div> </div> - <GlobalFooter /> + <GlobalFooter hideLoggedInInfo={this.props.hideLoggedInInfo} /> </div> ); } diff --git a/server/sonar-web/src/main/js/app/utils/startReactApp.js b/server/sonar-web/src/main/js/app/utils/startReactApp.js index 932192fabc3..fa8714220bf 100644 --- a/server/sonar-web/src/main/js/app/utils/startReactApp.js +++ b/server/sonar-web/src/main/js/app/utils/startReactApp.js @@ -26,6 +26,7 @@ import MigrationContainer from '../components/MigrationContainer'; import App from '../components/App'; import GlobalContainer from '../components/GlobalContainer'; import SimpleContainer from '../components/SimpleContainer'; +import SimpleSessionsContainer from '../../apps/sessions/components/SimpleSessionsContainer'; import Landing from '../components/Landing'; import ProjectContainer from '../components/ProjectContainer'; import ProjectAdminContainer from '../components/ProjectAdminContainer'; @@ -133,7 +134,7 @@ const startReactApp = () => { </Route> <Route component={MigrationContainer}> - <Route component={SimpleContainer}> + <Route component={SimpleSessionsContainer}> <Route path="/sessions">{sessionsRoutes}</Route> </Route> diff --git a/server/sonar-web/src/main/js/apps/sessions/components/SimpleSessionsContainer.js b/server/sonar-web/src/main/js/apps/sessions/components/SimpleSessionsContainer.js new file mode 100644 index 00000000000..1973d6fd996 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/sessions/components/SimpleSessionsContainer.js @@ -0,0 +1,30 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +// @flow +import React from 'react'; +import SimpleContainer from '../../../app/components/SimpleContainer'; + +type Props = { + children?: React.Element<*> | Array<React.Element<*>> +}; + +export default function SimpleSessionsContainer({ children }: Props) { + return <SimpleContainer hideLoggedInInfo={true}>{children}</SimpleContainer>; +} diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index c61609ac996..09ef00e5afe 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -2869,3 +2869,19 @@ organization.default_visibility_of_new_projects=Default visibility of new projec organization.change_visibility_form.header=Set Default Visibility of New Projects organization.change_visibility_form.warning=This will not change the visibility of already existing projects. organization.change_visibility_form.submit=Change Default Visibility + +#------------------------------------------------------------------------------ +# +# GLOBAL FOOTER +# +#------------------------------------------------------------------------------ +footer.about=About +footer.community=Community +footer.documentation=Documentation +footer.licence=LGPL v3 +footer.plugins=Plugins +footer.production_database_explanation=The embedded database will not scale, it will not support upgrading to newer versions of SonarQube, and there is no support for migrating your data out of it into a different database engine. +footer.production_database_warning=Embedded database should be used for evaluation purpose only +footer.support=Get Support +footer.version_x=Version {0} +footer.web_api=Web API |