aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2018-02-14 16:44:53 +0100
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>2018-02-15 13:28:33 +0100
commitc7721b9130b5b877ac6301859a2b597a91c86d92 (patch)
treef9e3b65feae816979152bced4177337fa4f1e311 /server/sonar-web/src/main
parente07a32e9b7c8760b64008d8cb897cfd43543aa9e (diff)
downloadsonarqube-c7721b9130b5b877ac6301859a2b597a91c86d92.tar.gz
sonarqube-c7721b9130b5b877ac6301859a2b597a91c86d92.zip
SONAR-10404 Add Tooltip on issues count in rules page
Diffstat (limited to 'server/sonar-web/src/main')
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsIssues.tsx32
1 files changed, 25 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<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>
);
};