]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9173 Hide some elements of the footer when the user is not logged
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Tue, 2 May 2017 13:18:15 +0000 (15:18 +0200)
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>
Fri, 5 May 2017 13:05:12 +0000 (15:05 +0200)
it/it-tests/src/test/java/it/ui/UiTest.java
server/sonar-web/src/main/js/app/components/GlobalFooter.js
server/sonar-web/src/main/js/app/components/SimpleContainer.js
server/sonar-web/src/main/js/app/utils/startReactApp.js
server/sonar-web/src/main/js/apps/sessions/components/SimpleSessionsContainer.js [new file with mode: 0644]
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index b75534fd12f44e24f193e47d011d817b68933992..b60c9e2768c0395cf2f90d22951c03472fb413c7 100644 (file)
@@ -62,6 +62,15 @@ public class UiTest {
     nav.getFooter().should(hasText((String) statusMap.get("version")));
   }
 
+  @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();
index 0a8dd3789ab976c0ec911c5ebf85dc17fcff4482..ef7c06582464d3883cf4f2a0389ded50757ef55e 100644 (file)
@@ -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>
   );
index cc3309d0a25a3c46484f7dc32bfb021b0bc9d94e..a661748ec07bbe4a184fcf69429ab5ffef865c7e 100644 (file)
 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>
     );
   }
index 932192fabc32b0ed5e46ff5498e060626651ffe4..fa8714220bfe441a12d55efc0122a0eff5cd0d2b 100644 (file)
@@ -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 (file)
index 0000000..1973d6f
--- /dev/null
@@ -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>;
+}
index c61609ac996570f1dff55846156d1efd4ab0ef07..09ef00e5afea760668c02142245a0b49159f697b 100644 (file)
@@ -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