diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-07-07 13:45:03 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2016-07-07 13:45:20 +0200 |
commit | d788c4781bee2c122649b12b99ab8fc46f821c79 (patch) | |
tree | 7bdecf88ffcb6e855c6e4724079461747b988aa6 /server/sonar-web/src/main/js/apps/quality-profiles | |
parent | b1c0793144ba94bb0678b25ff9a44adc8816d4fd (diff) | |
download | sonarqube-d788c4781bee2c122649b12b99ab8fc46f821c79.tar.gz sonarqube-d788c4781bee2c122649b12b99ab8fc46f821c79.zip |
apply feedback for the quality profiles page
Diffstat (limited to 'server/sonar-web/src/main/js/apps/quality-profiles')
4 files changed, 36 insertions, 11 deletions
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.js b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.js index bbf2913801e..7f2c10f5abb 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.js @@ -19,6 +19,8 @@ */ import React from 'react'; import { Link, IndexLink } from 'react-router'; +import classNames from 'classnames'; +import moment from 'moment'; import ProfileLink from '../components/ProfileLink'; import RenameProfileView from '../views/RenameProfileView'; import CopyProfileView from '../views/CopyProfileView'; @@ -28,6 +30,7 @@ import { ProfileType } from '../propTypes'; import { translate } from '../../../helpers/l10n'; import { setDefaultProfile } from '../../../api/quality-profiles'; import { getRulesUrl } from '../../../helpers/urls'; +import { isStagnant } from '../utils'; export default class ProfileHeader extends React.Component { static propTypes = { @@ -79,6 +82,21 @@ export default class ProfileHeader extends React.Component { }).render(); } + renderUpdateDate () { + const { profile } = this.props; + const warning = isStagnant(profile); + const className = classNames('small spacer-right', { + 'alert-warning': warning + }); + return ( + <li className={className}> + {translate('quality_profiles.updated_')} + {' '} + <ProfileDate date={profile.userUpdatedAt}/> + </li> + ); + } + render () { const { profile, canAdmin } = this.props; @@ -115,11 +133,7 @@ export default class ProfileHeader extends React.Component { <div className="pull-right"> <ul className="list-inline" style={{ lineHeight: '24px' }}> - <li className="small spacer-right"> - {translate('quality_profiles.updated_')} - {' '} - <ProfileDate date={profile.userUpdatedAt}/> - </li> + {this.renderUpdateDate()} <li className="small big-spacer-right"> {translate('quality_profiles.used_')} {' '} diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.js b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.js index cdef6e1e9d0..e7bf236e868 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/EvolutionStagnant.js @@ -22,6 +22,7 @@ import moment from 'moment'; import ProfileLink from '../components/ProfileLink'; import { ProfilesListType } from '../propTypes'; import { translate } from '../../../helpers/l10n'; +import { isStagnant } from '../utils'; export default class EvolutionStagnant extends React.Component { static propTypes = { @@ -31,16 +32,15 @@ export default class EvolutionStagnant extends React.Component { render () { // TODO filter built-in out - const outdated = this.props.profiles.filter(profile => ( - moment().diff(moment(profile.rulesUpdatedAt), 'years') >= 1 - )); + const outdated = this.props.profiles.filter(isStagnant); if (outdated.length === 0) { return null; } return ( - <div className="quality-profile-box quality-profiles-evolution-stagnant"> + <div + className="quality-profile-box quality-profiles-evolution-stagnant"> <div className="spacer-bottom"> <strong>{translate('quality_profiles.stagnant_profiles')}</strong> </div> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.js b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.js index 70276055fe5..cda1762257c 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.js @@ -24,6 +24,7 @@ import ProfileDate from '../components/ProfileDate'; import { ProfileType } from '../propTypes'; import { translate } from '../../../helpers/l10n'; import { getRulesUrl } from '../../../helpers/urls'; +import { isStagnant } from '../utils'; export default class ProfilesListRow extends React.Component { static propTypes = { @@ -82,7 +83,7 @@ export default class ProfilesListRow extends React.Component { <div> {profile.activeDeprecatedRuleCount > 0 && ( <span className="spacer-right"> - <a className="badge badge-warning" + <a className="badge badge-focus" href={deprecatedRulesUrl} title={translate('quality_profiles.deprecated_rules')} data-toggle="tooltip"> @@ -99,7 +100,12 @@ export default class ProfilesListRow extends React.Component { } renderUpdateDate () { - return <ProfileDate date={this.props.profile.userUpdatedAt}/>; + const date = <ProfileDate date={this.props.profile.userUpdatedAt}/>; + if (isStagnant(this.props.profile)) { + return <span className="badge badge-focus">{date}</span>; + } else { + return date; + } } renderUsageDate () { diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/utils.js b/server/sonar-web/src/main/js/apps/quality-profiles/utils.js index cba412ba81a..0bc023fdd43 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/utils.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/utils.js @@ -18,6 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import sortBy from 'lodash/sortBy'; +import moment from 'moment'; export function sortProfiles (profiles) { const result = []; @@ -59,3 +60,7 @@ export function createFakeProfile (overrides) { ...overrides }; } + +export function isStagnant (profile) { + return moment().diff(moment(profile.userUpdatedAt), 'years') >= 1; +} |