]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7811 warn about profiles that were never used
authorStas Vilchik <vilchiks@gmail.com>
Mon, 18 Jul 2016 12:41:58 +0000 (14:41 +0200)
committerStas Vilchik <vilchiks@gmail.com>
Mon, 18 Jul 2016 16:26:58 +0000 (18:26 +0200)
server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileDate.js
server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.js
server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.js

index a538383bd821b1ea28842ddda61f2bcc28f44ede..8abac7aea15b68b4645f3d80a5f91e0e6a97a62c 100644 (file)
@@ -36,7 +36,7 @@ export default class ProfileDate extends React.Component {
 
     if (!date) {
       return (
-          <span className="text-muted">{translate('never')}</span>
+          <span>{translate('never')}</span>
       );
     }
 
index 51db2e4b8acd7e70b54273c0f0a1089e575a0cd9..bef63b8da977e68a19ba5f8f7c18e4d38146d6d3 100644 (file)
@@ -49,6 +49,21 @@ export default class ProfileHeader extends React.Component {
     );
   }
 
+  renderUsageDate () {
+    const { profile } = this.props;
+    const warning = !profile.lastUsed;
+    const className = classNames('small big-spacer-right', {
+      'alert-warning': warning
+    });
+    return (
+        <li className={className}>
+          {translate('quality_profiles.used_')}
+          {' '}
+          <ProfileDate date={profile.lastUsed}/>
+        </li>
+    );
+  }
+
   render () {
     const { profile } = this.props;
 
@@ -77,11 +92,7 @@ export default class ProfileHeader extends React.Component {
           <div className="pull-right">
             <ul className="list-inline" style={{ lineHeight: '24px' }}>
               {this.renderUpdateDate()}
-              <li className="small big-spacer-right">
-                {translate('quality_profiles.used_')}
-                {' '}
-                <ProfileDate date={profile.lastUsed}/>
-              </li>
+              {this.renderUsageDate()}
               <li>
                 <Link
                     to={{ pathname: '/changelog', query: { key: profile.key } }}
index fe65cbcce23afe61588dacdc5f4332b698c8a5ef..eeefc1b2514685295d2bcd19336ff81efd0b1ee8 100644 (file)
@@ -112,7 +112,13 @@ export default class ProfilesListRow extends React.Component {
   }
 
   renderUsageDate () {
-    return <ProfileDate date={this.props.profile.lastUsed}/>;
+    const { lastUsed } = this.props.profile;
+    const date = <ProfileDate date={lastUsed}/>;
+    if (!lastUsed) {
+      return <span className="badge badge-focus">{date}</span>;
+    } else {
+      return date;
+    }
   }
 
   render () {