diff options
Diffstat (limited to 'server/sonar-web/src/main/js/apps/component-measures/drilldown')
5 files changed, 18 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 d38768555a9..a8f042e7bf0 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 @@ -20,11 +20,13 @@ // @flow import React from 'react'; import QualifierIcon from '../../../components/icons-components/QualifierIcon'; +import { getBranchName } from '../../../helpers/branches'; import { splitPath } from '../../../helpers/path'; import { getComponentUrl } from '../../../helpers/urls'; /*:: import type { ComponentEnhanced } from '../types'; */ /*:: type Props = { + branch: {}, component: ComponentEnhanced, onClick: string => void }; */ @@ -66,22 +68,22 @@ export default class ComponentCell extends React.PureComponent { } render() { - const { component } = this.props; + const { branch, component } = this.props; return ( <td className="measure-details-component-cell"> <div className="text-ellipsis"> - {component.refId == null + {component.refKey == null ? <a id={'component-measures-component-link-' + component.key} className="link-no-underline" - href={getComponentUrl(component.key)} + href={getComponentUrl(component.key, getBranchName(branch))} onClick={this.handleClick}> {this.renderInner()} </a> : <a id={'component-measures-component-link-' + component.key} className="link-no-underline" - href={getComponentUrl(component.refKey || component.key)}> + href={getComponentUrl(component.refKey, getBranchName(branch))}> <span className="big-spacer-right"> <i className="icon-detach" /> </span> diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsList.js b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsList.js index 2d28cb63de7..53175f19e06 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsList.js +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsList.js @@ -27,6 +27,7 @@ import { getLocalizedMetricName } from '../../../helpers/l10n'; /*:: import type { Metric } from '../../../store/metrics/actions'; */ /*:: type Props = {| + branch: {}, components: Array<ComponentEnhanced>, onClick: string => void, metric: Metric, @@ -35,7 +36,7 @@ import { getLocalizedMetricName } from '../../../helpers/l10n'; |}; */ export default function ComponentsList( - { components, onClick, metrics, metric, selectedComponent } /*: Props */ + { branch, components, onClick, metrics, metric, selectedComponent } /*: Props */ ) { if (!components.length) { return <EmptyResult />; @@ -67,6 +68,7 @@ export default function ComponentsList( {components.map(component => <ComponentsListRow key={component.id} + branch={branch} component={component} otherMetrics={otherMetrics} isSelected={component.key === selectedComponent} diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsListRow.js b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsListRow.js index bc38573e3ad..9e2a1e7ed3d 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsListRow.js +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentsListRow.js @@ -26,6 +26,7 @@ import MeasureCell from './MeasureCell'; /*:: import type { Metric } from '../../../store/metrics/actions'; */ /*:: type Props = {| + branch: {}, component: ComponentEnhanced, isSelected: boolean, onClick: string => void, @@ -34,7 +35,7 @@ import MeasureCell from './MeasureCell'; |}; */ export default function ComponentsListRow(props /*: Props */) { - const { component } = props; + const { branch, component } = props; const otherMeasures = props.otherMetrics.map(metric => { const measure = component.measures.find(measure => measure.metric.key === metric.key); return { ...measure, metric }; @@ -44,7 +45,7 @@ export default function ComponentsListRow(props /*: Props */) { }); return ( <tr className={rowClass}> - <ComponentCell component={component} onClick={props.onClick} /> + <ComponentCell branch={branch} component={component} onClick={props.onClick} /> <MeasureCell component={component} metric={props.metric} /> diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.js b/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.js index b1f8aebad51..6fe0bb181b0 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.js +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/FilesView.js @@ -28,6 +28,7 @@ import { scrollToElement } from '../../../helpers/scrolling'; /*:: import type { Metric } from '../../../store/metrics/actions'; */ /*:: type Props = {| + branch: {}, components: Array<ComponentEnhanced>, fetchMore: () => void, handleSelect: string => void, @@ -117,6 +118,7 @@ export default class ListView extends React.PureComponent { return ( <div ref={elem => (this.listContainer = elem)}> <ComponentsList + branch={this.props.branch} components={this.props.components} metrics={this.props.metrics} metric={this.props.metric} diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.js b/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.js index 5bfa9a7873f..9d1b3ff6d1a 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.js +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.js @@ -26,6 +26,7 @@ import ColorGradientLegend from '../../../components/charts/ColorGradientLegend' import EmptyResult from './EmptyResult'; import QualifierIcon from '../../../components/icons-components/QualifierIcon'; import TreeMap from '../../../components/charts/TreeMap'; +import { getBranchName } from '../../../helpers/branches'; import { translate, translateWithParameters, getLocalizedMetricName } from '../../../helpers/l10n'; import { formatMeasure, isDiffMetric } from '../../../helpers/measures'; import { getComponentUrl } from '../../../helpers/urls'; @@ -34,6 +35,7 @@ import { getComponentUrl } from '../../../helpers/urls'; /*:: import type { TreeMapItem } from '../../../components/charts/TreeMap'; */ /*:: type Props = {| + branch: {}, components: Array<ComponentEnhanced>, handleSelect: string => void, metric: Metric @@ -62,7 +64,7 @@ export default class TreeMapView extends React.PureComponent { } } - getTreemapComponents = ({ components, metric } /*: Props */) => { + getTreemapComponents = ({ branch, components, metric } /*: Props */) => { const colorScale = this.getColorScale(metric); return components .map(component => { @@ -93,7 +95,7 @@ export default class TreeMapView extends React.PureComponent { sizeValue ), label: component.name, - link: getComponentUrl(component.refKey || component.key) + link: getComponentUrl(component.refKey || component.key, getBranchName(branch)) }; }) .filter(Boolean); |