interface Props {
branchLike?: T.BranchLike;
+ canBePinned?: boolean;
canBrowse?: boolean;
component: T.ComponentMeasure;
metrics: T.Metric[];
render() {
const {
branchLike,
+ canBePinned = true,
canBrowse = false,
component,
metrics,
return (
<tr className={classNames({ selected })}>
<td className="blank" />
- <td className="thin nowrap">
- <span className="spacer-right">
+ {canBePinned && (
+ <td className="thin nowrap">
{isFile && (
- <WorkspaceContext.Consumer>
- {({ openComponent }) => (
- <ComponentPin
- branchLike={branchLike}
- component={component}
- openComponent={openComponent}
- />
- )}
- </WorkspaceContext.Consumer>
+ <span className="spacer-right">
+ <WorkspaceContext.Consumer>
+ {({ openComponent }) => (
+ <ComponentPin
+ branchLike={branchLike}
+ component={component}
+ openComponent={openComponent}
+ />
+ )}
+ </WorkspaceContext.Consumer>
+ </span>
)}
- </span>
- </td>
+ </td>
+ )}
<td className="code-name-cell">
<ComponentName
branchLike={branchLike}
);
const metrics = metricKeys.map(metric => this.props.metrics[metric]);
const colSpan = metrics.length + 4;
+ const canBePinned = baseComponent && !['APP', 'VW', 'SVW'].includes(baseComponent.qualifier);
+
return (
<table className="data boxed-padding zebra">
{baseComponent && (
<ComponentsHeader
baseComponent={baseComponent}
+ canBePinned={canBePinned}
metrics={metricKeys}
rootComponent={rootComponent}
/>
<tbody>
<Component
branchLike={branchLike}
+ canBePinned={canBePinned}
component={baseComponent}
key={baseComponent.key}
metrics={metrics}
components.map((component, index, list) => (
<Component
branchLike={branchLike}
+ canBePinned={canBePinned}
canBrowse={true}
component={component}
key={component.key}
/>
))
) : (
- <ComponentsEmpty />
+ <ComponentsEmpty canBePinned={canBePinned} />
)}
<tr className="blank">
import * as React from 'react';
import { translate } from '../../../helpers/l10n';
-export default function ComponentsEmpty() {
+interface Props {
+ canBePinned?: boolean;
+}
+
+export default function ComponentsEmpty({ canBePinned = true }: Props) {
return (
<tr>
- <td />
+ {canBePinned && <td />}
<td className="note" colSpan={2}>
{translate('no_results')}
</td>
interface Props {
baseComponent?: T.ComponentMeasure;
+ canBePinned?: boolean;
metrics: string[];
rootComponent: T.ComponentMeasure;
}
'new_duplicated_lines_density'
];
-export default function ComponentsHeader({ baseComponent, metrics, rootComponent }: Props) {
+export default function ComponentsHeader({
+ baseComponent,
+ canBePinned = true,
+ metrics,
+ rootComponent
+}: Props) {
const isPortfolio = ['VW', 'SVW'].includes(rootComponent.qualifier);
let columns: string[] = [];
if (isPortfolio) {
return (
<thead>
<tr className="code-components-header">
- <th className="thin nowrap" colSpan={2} />
+ <th className="thin nowrap" colSpan={canBePinned ? 2 : 1} />
<th />
{baseComponent &&
columns.map((column, index) => (
/>
<td
className="thin nowrap"
- >
- <span
- className="spacer-right"
- />
- </td>
+ />
<td
className="code-name-cell"
>
"qualifier": "TRK",
}
}
+ canBePinned={true}
metrics={
Array [
"coverage",
/>
<tbody>
<withScrollTo(Component)
+ canBePinned={true}
component={
Object {
"key": "foo",
</tbody>
<tbody>
<withScrollTo(Component)
+ canBePinned={true}
canBrowse={true}
component={
Object {
"qualifier": "TRK",
}
}
+ canBePinned={true}
metrics={Array []}
rootComponent={
Object {
"type": "SHORT",
}
}
+ canBePinned={true}
component={
Object {
"key": "foo",
"type": "SHORT",
}
}
+ canBePinned={true}
canBrowse={true}
component={
Object {