Browse Source

SONAR-9302 Display built-in flag on Quality profiles page

tags/6.5-M1
Stas Vilchik 7 years ago
parent
commit
f7e2e9c191

+ 51
- 0
server/sonar-web/src/main/js/apps/quality-profiles/components/BuiltInBadge.js View File

@@ -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
};

+ 9
- 0
server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.js View File

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

+ 2
- 0
server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.js View File

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

+ 1
- 0
server/sonar-web/src/main/js/apps/quality-profiles/propTypes.js View File

@@ -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,

+ 0
- 12
server/sonar-web/src/main/js/components/common/PrivateBadge.css View File

@@ -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;
}

+ 0
- 1
server/sonar-web/src/main/js/components/common/PrivateBadge.js View File

@@ -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,

+ 14
- 0
server/sonar-web/src/main/less/components/badges.less View File

@@ -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;
}

+ 3
- 0
sonar-core/src/main/resources/org/sonar/l10n/core.properties View File

@@ -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.




Loading…
Cancel
Save