aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src')
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.js35
1 files changed, 26 insertions, 9 deletions
diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.js b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.js
index 25b6b7b4f10..9b2ce2e9b6e 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.js
+++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.js
@@ -23,7 +23,11 @@ import { Link } from 'react-router';
import LinkIcon from '../../../components/icons-components/LinkIcon';
import QualifierIcon from '../../../components/icons-components/QualifierIcon';
import { splitPath } from '../../../helpers/path';
-import { getBranchLikeUrl, getComponentDrilldownUrlWithSelection } from '../../../helpers/urls';
+import {
+ getPathUrlAsString,
+ getBranchLikeUrl,
+ getComponentDrilldownUrlWithSelection
+} from '../../../helpers/urls';
/*:: import type { Component, ComponentEnhanced } from '../types'; */
/*:: import type { Metric } from '../../../store/metrics/actions'; */
@@ -38,6 +42,16 @@ import { getBranchLikeUrl, getComponentDrilldownUrlWithSelection } from '../../.
export default class ComponentCell extends React.PureComponent {
/*:: props: Props; */
+ handleClick = (e /*: MouseEvent */) => {
+ const isLeftClickEvent = e.button === 0;
+ const isModifiedEvent = !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
+
+ if (isLeftClickEvent && !isModifiedEvent) {
+ e.preventDefault();
+ this.props.onClick(this.props.component.key);
+ }
+ };
+
renderInner() {
const { component } = this.props;
let head = '';
@@ -63,17 +77,20 @@ export default class ComponentCell extends React.PureComponent {
<td className="measure-details-component-cell">
<div className="text-ellipsis">
{component.refKey == null ? (
- <Link
+ <a
className="link-no-underline"
+ href={getPathUrlAsString(
+ getComponentDrilldownUrlWithSelection(
+ rootComponent.key,
+ component.key,
+ metric.key,
+ branchLike
+ )
+ )}
id={'component-measures-component-link-' + component.key}
- to={getComponentDrilldownUrlWithSelection(
- rootComponent.key,
- component.key,
- metric.key,
- branchLike
- )}>
+ onClick={this.handleClick}>
{this.renderInner()}
- </Link>
+ </a>
) : (
<Link
className="link-no-underline"