From 11b6b743c368eb4fc362f1290d4e0d09b32ef484 Mon Sep 17 00:00:00 2001 From: Pascal Mugnier Date: Thu, 19 Apr 2018 08:29:30 +0200 Subject: [PATCH] Fix for failing IT should_drilldown_on_tree_view --- .../drilldown/ComponentCell.js | 35 ++++++++++++++----- 1 file 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 {
{component.refKey == null ? ( - + onClick={this.handleClick}> {this.renderInner()} - + ) : (