ソースを参照

SONAR-9173 Hide some elements of the footer when the user is not logged

tags/6.4-RC1
Grégoire Aubert 7年前
コミット
282c729e2a

+ 9
- 0
it/it-tests/src/test/java/it/ui/UiTest.java ファイルの表示

@@ -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();

+ 28
- 19
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>
);

+ 7
- 7
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>
);
}

+ 2
- 1
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>


+ 30
- 0
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>;
}

+ 16
- 0
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

読み込み中…
キャンセル
保存