Browse Source

SONAR-11066 Fix home link in unauthorized page

tags/7.5
Grégoire Aubert 5 years ago
parent
commit
a8f14ced18

+ 5
- 5
server/sonar-web/src/main/js/apps/sessions/components/Unauthorized.tsx View File

* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import * as React from 'react'; import * as React from 'react';
import { Link } from 'react-router';
import { translate } from '../../../helpers/l10n'; import { translate } from '../../../helpers/l10n';
import { getBaseUrl } from '../../../helpers/urls';


interface Props { interface Props {
location: { location: {
const { message } = props.location.query; const { message } = props.location.query;


return ( return (
<div id="bd" className="page-wrapper-simple">
<div id="nonav" className="page-simple">
<div className="page-wrapper-simple" id="bd">
<div className="page-simple" id="nonav">
<div className="text-center"> <div className="text-center">
<p id="unauthorized">{translate('unauthorized.message')}</p> <p id="unauthorized">{translate('unauthorized.message')}</p>


{!!message && (
{Boolean(message) && (
<p className="spacer-top"> <p className="spacer-top">
{translate('unauthorized.reason')} {message} {translate('unauthorized.reason')} {message}
</p> </p>
)} )}


<div className="big-spacer-top"> <div className="big-spacer-top">
<Link to="/">{translate('layout.home')}</Link>
<a href={getBaseUrl() + '/'}>{translate('layout.home')}</a>
</div> </div>
</div> </div>
</div> </div>

+ 26
- 0
server/sonar-web/src/main/js/apps/sessions/components/__tests__/Unauthorized-test.tsx View File

/*
* SonarQube
* Copyright (C) 2009-2018 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.
*/
import * as React from 'react';
import { shallow } from 'enzyme';
import Unauthorized from '../Unauthorized';

it('render', () => {
expect(shallow(<Unauthorized location={{ query: { message: 'Foo' } }} />)).toMatchSnapshot();
});

+ 39
- 0
server/sonar-web/src/main/js/apps/sessions/components/__tests__/__snapshots__/Unauthorized-test.tsx.snap View File

// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`render 1`] = `
<div
className="page-wrapper-simple"
id="bd"
>
<div
className="page-simple"
id="nonav"
>
<div
className="text-center"
>
<p
id="unauthorized"
>
unauthorized.message
</p>
<p
className="spacer-top"
>
unauthorized.reason
Foo
</p>
<div
className="big-spacer-top"
>
<a
href="/"
>
layout.home
</a>
</div>
</div>
</div>
</div>
`;

Loading…
Cancel
Save