@@ -0,0 +1,51 @@ | |||
/* | |||
* 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 classNames from 'classnames'; | |||
import Tooltip from '../../../components/controls/Tooltip'; | |||
import { translate } from '../../../helpers/l10n'; | |||
type Props = {| | |||
className?: string, | |||
tooltip?: boolean | |||
|}; | |||
export default function BuiltInBadge(props: Props) { | |||
const badge = ( | |||
<div className={classNames('built-in-badge', props.className)}> | |||
{translate('quality_profiles.built_in')} | |||
</div> | |||
); | |||
const overlay = ( | |||
<span> | |||
{translate('quality_profiles.built_in.description.1')} | |||
{' '} | |||
{translate('quality_profiles.built_in.description.2')} | |||
</span> | |||
); | |||
return props.tooltip ? <Tooltip overlay={overlay}>{badge}</Tooltip> : badge; | |||
} | |||
BuiltInBadge.defaultProps = { | |||
tooltip: true | |||
}; |
@@ -23,6 +23,7 @@ import { Link, IndexLink } from 'react-router'; | |||
import ProfileLink from '../components/ProfileLink'; | |||
import ProfileActions from '../components/ProfileActions'; | |||
import ProfileDate from '../components/ProfileDate'; | |||
import BuiltInBadge from '../components/BuiltInBadge'; | |||
import { translate } from '../../../helpers/l10n'; | |||
import { | |||
isStagnant, | |||
@@ -115,6 +116,7 @@ export default class ProfileHeader extends React.PureComponent { | |||
organization={organization}> | |||
<span>{profile.name}</span> | |||
</ProfileLink> | |||
{profile.isBuiltIn && <BuiltInBadge className="spacer-left" tooltip={false} />} | |||
</h1> | |||
<div className="pull-right"> | |||
@@ -146,6 +148,13 @@ export default class ProfileHeader extends React.PureComponent { | |||
</li> | |||
</ul> | |||
</div> | |||
{profile.isBuiltIn && | |||
<div className="page-description"> | |||
{translate('quality_profiles.built_in.description.1')} | |||
<br /> | |||
{translate('quality_profiles.built_in.description.2')} | |||
</div>} | |||
</header> | |||
); | |||
} |
@@ -23,6 +23,7 @@ import { Link } from 'react-router'; | |||
import ProfileLink from '../components/ProfileLink'; | |||
import ProfileDate from '../components/ProfileDate'; | |||
import ProfileActions from '../components/ProfileActions'; | |||
import BuiltInBadge from '../components/BuiltInBadge'; | |||
import { translate } from '../../../helpers/l10n'; | |||
import { getRulesUrl } from '../../../helpers/urls'; | |||
import { isStagnant } from '../utils'; | |||
@@ -50,6 +51,7 @@ export default class ProfilesListRow extends React.PureComponent { | |||
organization={this.props.organization}> | |||
{profile.name} | |||
</ProfileLink> | |||
{profile.isBuiltIn && <BuiltInBadge className="spacer-left" />} | |||
</div> | |||
); | |||
} |
@@ -25,6 +25,7 @@ const { shape, string, number, bool, arrayOf } = PropTypes; | |||
export type Profile = { | |||
key: string, | |||
name: string, | |||
isBuiltIn: boolean, | |||
isDefault: boolean, | |||
isInherited: boolean, | |||
language: string, |
@@ -1,12 +0,0 @@ | |||
.private-badge { | |||
display: inline-block; | |||
vertical-align: middle; | |||
height: 20px; | |||
line-height: 19px; | |||
padding: 0 8px; | |||
border: 1px solid #cdcdcd; | |||
border-radius: 2px; | |||
box-sizing: border-box; | |||
color: #777; | |||
font-size: 12px; | |||
} |
@@ -22,7 +22,6 @@ import React from 'react'; | |||
import classNames from 'classnames'; | |||
import Tooltip from '../controls/Tooltip'; | |||
import { translate } from '../../helpers/l10n'; | |||
import './PrivateBadge.css'; | |||
type Props = { | |||
className?: string, |
@@ -104,3 +104,17 @@ | |||
a&:hover, a&:focus, a&:active { color: #8a6d3b; } | |||
} | |||
.private-badge, | |||
.built-in-badge, { | |||
display: inline-block; | |||
vertical-align: middle; | |||
height: 20px; | |||
line-height: 19px; | |||
padding: 0 8px; | |||
border: 1px solid #cdcdcd; | |||
border-radius: 2px; | |||
box-sizing: border-box; | |||
color: #777; | |||
font-size: 12px; | |||
} |
@@ -1503,6 +1503,9 @@ quality_profiles.not_updated_more_than_year=The following profiles haven't been | |||
quality_profiles.exporters=Exporters | |||
quality_profiles.updated_=Updated: | |||
quality_profiles.used_=Used: | |||
quality_profiles.built_in=Built-in | |||
quality_profiles.built_in.description.1=The minimum set of rules recommended by this analyzer. | |||
quality_profiles.built_in.description.2=This Quality Profile will be automatically updated when its built-in parent is changed by new versions of the analyzer. | |||