@@ -25,6 +25,7 @@ import ComponentLink from './ComponentLink'; | |||
import ComponentPin from './ComponentPin'; | |||
import { Component as IComponent } from '../types'; | |||
import { BranchLike } from '../../../app/types'; | |||
import { isShortLivingBranch, isPullRequest } from '../../../helpers/branches'; | |||
const TOP_OFFSET = 200; | |||
const BOTTOM_OFFSET = 10; | |||
@@ -83,6 +84,7 @@ export default class Component extends React.PureComponent<Props> { | |||
} = this.props; | |||
const isPortfolio = ['VW', 'SVW'].includes(rootComponent.qualifier); | |||
const isApplication = rootComponent.qualifier === 'APP'; | |||
const hideCoverageAndDuplicates = isShortLivingBranch(branchLike) || isPullRequest(branchLike); | |||
let componentAction = null; | |||
@@ -111,8 +113,8 @@ export default class Component extends React.PureComponent<Props> { | |||
{ metric: 'bugs', type: 'SHORT_INT' }, | |||
{ metric: 'vulnerabilities', type: 'SHORT_INT' }, | |||
{ metric: 'code_smells', type: 'SHORT_INT' }, | |||
{ metric: 'coverage', type: 'PERCENT' }, | |||
{ metric: 'duplicated_lines_density', type: 'PERCENT' } | |||
!hideCoverageAndDuplicates && { metric: 'coverage', type: 'PERCENT' }, | |||
!hideCoverageAndDuplicates && { metric: 'duplicated_lines_density', type: 'PERCENT' } | |||
].filter(Boolean) as Array<{ metric: string; type: string }>); | |||
return ( | |||
@@ -123,15 +125,15 @@ export default class Component extends React.PureComponent<Props> { | |||
<td className="code-name-cell"> | |||
<ComponentName | |||
branchLike={branchLike} | |||
canBrowse={canBrowse} | |||
component={component} | |||
rootComponent={rootComponent} | |||
previous={previous} | |||
canBrowse={canBrowse} | |||
rootComponent={rootComponent} | |||
/> | |||
</td> | |||
{columns.map(column => ( | |||
<td key={column.metric} className="thin nowrap text-right"> | |||
<td className="thin nowrap text-right" key={column.metric}> | |||
<div className="code-components-cell"> | |||
<ComponentMeasure | |||
component={component} |
@@ -36,7 +36,11 @@ export default function Components(props: Props) { | |||
const { baseComponent, branchLike, components, rootComponent, selected } = props; | |||
return ( | |||
<table className="data zebra"> | |||
<ComponentsHeader baseComponent={baseComponent} rootComponent={rootComponent} /> | |||
<ComponentsHeader | |||
baseComponent={baseComponent} | |||
branchLike={branchLike} | |||
rootComponent={rootComponent} | |||
/> | |||
{baseComponent && ( | |||
<tbody> | |||
<Component |
@@ -20,15 +20,19 @@ | |||
import * as React from 'react'; | |||
import { translate } from '../../../helpers/l10n'; | |||
import { Component } from '../types'; | |||
import { isShortLivingBranch, isPullRequest } from '../../../helpers/branches'; | |||
import { BranchLike } from '../../../app/types'; | |||
interface Props { | |||
branchLike?: BranchLike; | |||
baseComponent?: Component; | |||
rootComponent: Component; | |||
} | |||
export default function ComponentsHeader({ baseComponent, rootComponent }: Props) { | |||
export default function ComponentsHeader({ baseComponent, branchLike, rootComponent }: Props) { | |||
const isPortfolio = rootComponent.qualifier === 'VW' || rootComponent.qualifier === 'SVW'; | |||
const isApplication = rootComponent.qualifier === 'APP'; | |||
const hideCoverageAndDuplicates = isShortLivingBranch(branchLike) || isPullRequest(branchLike); | |||
const columns = isPortfolio | |||
? [ | |||
@@ -44,8 +48,8 @@ export default function ComponentsHeader({ baseComponent, rootComponent }: Props | |||
translate('metric', 'bugs', 'name'), | |||
translate('metric', 'vulnerabilities', 'name'), | |||
translate('metric', 'code_smells', 'name'), | |||
translate('metric', 'coverage', 'name'), | |||
translate('metric', 'duplicated_lines_density', 'short_name') | |||
!hideCoverageAndDuplicates && translate('metric', 'coverage', 'name'), | |||
!hideCoverageAndDuplicates && translate('metric', 'duplicated_lines_density', 'short_name') | |||
].filter(Boolean) as string[]); | |||
return ( |