*/
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';
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 = {
}).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;
<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_')}
{' '}
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 = {
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>
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 = {
<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">
}
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 () {
* 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 = [];
...overrides
};
}
+
+export function isStagnant (profile) {
+ return moment().diff(moment(profile.userUpdatedAt), 'years') >= 1;
+}
background-color: #fcf8e3;
color: #8a6d3b;
font-weight: 400;
+
+ a&:hover, a&:focus, a&:active { color: #8a6d3b; }
}