From c7721b9130b5b877ac6301859a2b597a91c86d92 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gr=C3=A9goire=20Aubert?= Date: Wed, 14 Feb 2018 16:44:53 +0100 Subject: [PATCH] SONAR-10404 Add Tooltip on issues count in rules page --- .../components/RuleDetailsIssues.tsx | 32 +++++++++++++++---- .../resources/org/sonar/l10n/core.properties | 1 + 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx index 6f953ba6bb7..60ccb04f82c 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx @@ -18,12 +18,14 @@ * 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 { mounted = false; + + static contextTypes = { + branchesEnabled: PropTypes.bool + }; + state: State = { loading: true }; componentDidMount() { @@ -103,12 +110,23 @@ export default class RuleDetailsIssues extends React.PureComponent { resolved: 'false', rules: this.props.ruleKey }, this.props.organization ); - return ( - <> - {' ('} + + const totalItem = ( + + {'('} {total} {')'} - + + ); + + if (!this.context.branchesEnabled) { + return totalItem; + } + + return ( + + {totalItem} + ); }; diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index 98abe3da3d8..5471f9e08e7 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -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 -- 2.39.5