From: Pascal Mugnier Date: Thu, 19 Apr 2018 06:29:30 +0000 (+0200) Subject: Fix for failing IT should_drilldown_on_tree_view X-Git-Tag: 7.5~1336 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=11b6b743c368eb4fc362f1290d4e0d09b32ef484;p=sonarqube.git Fix for failing IT should_drilldown_on_tree_view --- 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()} - + ) : (