diff options
author | Pascal Mugnier <pascal.mugnier@sonarsource.com> | 2018-06-21 11:08:48 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2018-06-29 09:10:16 +0200 |
commit | e5827b3671013c14776ca189e400e3687bfa0983 (patch) | |
tree | 74bbf5d4f5bd10c1c214c7252b349df31137ce52 /server/sonar-web/src/main/js/apps/component-measures/drilldown | |
parent | f94bc6f1b9be3b9180aef88abe1804b4aaaa194a (diff) | |
download | sonarqube-e5827b3671013c14776ca189e400e3687bfa0983.tar.gz sonarqube-e5827b3671013c14776ca189e400e3687bfa0983.zip |
SONAR-10813 Add project branches
Diffstat (limited to 'server/sonar-web/src/main/js/apps/component-measures/drilldown')
-rw-r--r-- | server/sonar-web/src/main/js/apps/component-measures/drilldown/ComponentCell.js | 26 |
1 files changed, 25 insertions, 1 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 9b2ce2e9b6e..fc268fa3425 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 @@ -22,12 +22,15 @@ import React from 'react'; import { Link } from 'react-router'; import LinkIcon from '../../../components/icons-components/LinkIcon'; import QualifierIcon from '../../../components/icons-components/QualifierIcon'; +import LongLivingBranchIcon from '../../../components/icons-components/LongLivingBranchIcon'; import { splitPath } from '../../../helpers/path'; import { getPathUrlAsString, getBranchLikeUrl, + getLongLivingBranchUrl, getComponentDrilldownUrlWithSelection } from '../../../helpers/urls'; +import { translate } from '../../../helpers/l10n'; /*:: import type { Component, ComponentEnhanced } from '../types'; */ /*:: import type { Metric } from '../../../store/metrics/actions'; */ @@ -56,23 +59,44 @@ export default class ComponentCell extends React.PureComponent { const { component } = this.props; let head = ''; let tail = component.name; + let branch = null; if (['DIR', 'FIL', 'UTS'].includes(component.qualifier)) { const parts = splitPath(component.path); ({ head, tail } = parts); } + + if (this.props.rootComponent.qualifier === 'APP') { + branch = ( + <React.Fragment> + {component.branch ? ( + <React.Fragment> + <LongLivingBranchIcon className="spacer-left little-spacer-right" /> + <span className="note">{component.branch}</span> + </React.Fragment> + ) : ( + <span className="spacer-left outline-badge">{translate('branches.main_branch')}</span> + )} + </React.Fragment> + ); + } return ( <span title={component.refKey || component.key}> <QualifierIcon qualifier={component.qualifier} /> {head.length > 0 && <span className="note">{head}/</span>} <span>{tail}</span> + {branch} </span> ); } render() { const { branchLike, component, metric, rootComponent } = this.props; + const to = + this.props.rootComponent.qualifier === 'APP' + ? getLongLivingBranchUrl(component.refKey, component.branch) + : getBranchLikeUrl(component.refKey, branchLike); return ( <td className="measure-details-component-cell"> <div className="text-ellipsis"> @@ -95,7 +119,7 @@ export default class ComponentCell extends React.PureComponent { <Link className="link-no-underline" id={'component-measures-component-link-' + component.key} - to={getBranchLikeUrl(component.refKey, branchLike)}> + to={to}> <span className="big-spacer-right"> <LinkIcon /> </span> |