diff options
author | Pascal Mugnier <pascal.mugnier@sonarsource.com> | 2018-04-19 08:29:30 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2018-04-19 20:20:44 +0200 |
commit | 11b6b743c368eb4fc362f1290d4e0d09b32ef484 (patch) | |
tree | 09a1d4763d552f58bf2e64f46d302e00b528204f /server/sonar-web/src | |
parent | d934d49b71a08dbd813be287c18763a67245f65e (diff) | |
download | sonarqube-11b6b743c368eb4fc362f1290d4e0d09b32ef484.tar.gz sonarqube-11b6b743c368eb4fc362f1290d4e0d09b32ef484.zip |
Fix for failing IT should_drilldown_on_tree_view
Diffstat (limited to 'server/sonar-web/src')
-rw-r--r-- | server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.js | 35 |
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" |