]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10404 Add Tooltip on issues count in rules page
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Wed, 14 Feb 2018 15:44:53 +0000 (16:44 +0100)
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>
Thu, 15 Feb 2018 12:28:33 +0000 (13:28 +0100)
server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 6f953ba6bb713977f0b8fc3c2d8bd92807e7e24e..60ccb04f82cb4eb0ed0db7c31b9dd41d8409917c 100644 (file)
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import * as React from 'react';
+import * as PropTypes from 'prop-types';
 import { Link } from 'react-router';
-import { getFacet } from '../../../api/issues';
 import DeferredSpinner from '../../../components/common/DeferredSpinner';
-import { translate } from '../../../helpers/l10n';
-import { formatMeasure } from '../../../helpers/measures';
+import Tooltip from '../../../components/controls/Tooltip';
+import { getFacet } from '../../../api/issues';
 import { getIssuesUrl } from '../../../helpers/urls';
+import { formatMeasure } from '../../../helpers/measures';
+import { translate } from '../../../helpers/l10n';
 
 interface Props {
   organization: string | undefined;
@@ -45,6 +47,11 @@ interface State {
 
 export default class RuleDetailsIssues extends React.PureComponent<Props, State> {
   mounted = false;
+
+  static contextTypes = {
+    branchesEnabled: PropTypes.bool
+  };
+
   state: State = { loading: true };
 
   componentDidMount() {
@@ -103,12 +110,23 @@ export default class RuleDetailsIssues extends React.PureComponent<Props, State>
       { resolved: 'false', rules: this.props.ruleKey },
       this.props.organization
     );
-    return (
-      <>
-        {' ('}
+
+    const totalItem = (
+      <span className="little-spacer-left">
+        {'('}
         <Link to={path}>{total}</Link>
         {')'}
-      </>
+      </span>
+    );
+
+    if (!this.context.branchesEnabled) {
+      return totalItem;
+    }
+
+    return (
+      <Tooltip overlay={translate('coding_rules.issues.only_main_branches')} placement="right">
+        {totalItem}
+      </Tooltip>
     );
   };
 
index 98abe3da3d8d51ce11436d6a8e484dfbef0fc578..5471f9e08e74604d21747d74cabdc32714015a3f 100644 (file)
@@ -1225,6 +1225,7 @@ coding_rules.deactivate.confirm=Are you sure you want to deactivate this rule in
 coding_rules.deactivate_in_all_quality_profiles=Deactivate In All {0} Profiles
 coding_rules.inherits="{0}" inherits from "{1}"
 coding_rules.issues=Issues
+coding_rules.issues.only_main_branches=Only issues from the main project branches are included.
 coding_rules.most_violating_projects=Most Violating Projects
 coding_rules.no_results=No Coding Rules
 coding_rules.no_tags=No tags