import { withScrollTo } from '../../../components/hoc/withScrollTo';
import { WorkspaceContext } from '../../../components/workspace/context';
import { BranchLike } from '../../../types/branch-like';
+import { ComponentQualifier } from '../../../types/component';
+import { MetricType } from '../../../types/metrics';
import ComponentMeasure from './ComponentMeasure';
import ComponentName from './ComponentName';
import ComponentPin from './ComponentPin';
selected = false
} = this.props;
- const isFile = component.qualifier === 'FIL' || component.qualifier === 'UTS';
+ const isFile =
+ component.qualifier === ComponentQualifier.File ||
+ component.qualifier === ComponentQualifier.TestFile;
return (
<tr className={classNames({ selected })}>
</td>
)}
<td className="code-name-cell">
- {hasBaseComponent && <div className="code-child-component-icon" />}
- <ComponentName
- branchLike={branchLike}
- canBrowse={canBrowse}
- component={component}
- previous={previous}
- rootComponent={rootComponent}
- />
+ <div className="display-flex-center">
+ {hasBaseComponent && <div className="code-child-component-icon" />}
+ <ComponentName
+ branchLike={branchLike}
+ canBrowse={canBrowse}
+ component={component}
+ previous={previous}
+ rootComponent={rootComponent}
+ />
+ </div>
</td>
{metrics.map(metric => (
<td
className={classNames('thin', {
- 'text-center': metric.type === 'RATING',
- 'nowrap text-right': metric.type !== 'RATING'
+ 'text-center': metric.type === MetricType.Rating,
+ 'nowrap text-right': metric.type !== MetricType.Rating
})}
key={metric.key}>
<div
className={classNames({
- 'code-components-rating-cell': metric.type === 'RATING',
- 'code-components-cell': metric.type !== 'RATING'
+ 'code-components-rating-cell': metric.type === MetricType.Rating,
+ 'code-components-cell': metric.type !== MetricType.Rating
})}>
<ComponentMeasure component={component} metric={metric} />
</div>
<td
className="code-name-cell"
>
- <ComponentName
- canBrowse={false}
- component={
- Object {
- "key": "bar",
- "measures": Array [
- Object {
- "metric": "bugs",
- "value": "12",
- },
- Object {
- "metric": "vulnerabilities",
- "value": "1",
- },
- ],
- "name": "Bar",
- "qualifier": "TRK",
+ <div
+ className="display-flex-center"
+ >
+ <ComponentName
+ canBrowse={false}
+ component={
+ Object {
+ "key": "bar",
+ "measures": Array [
+ Object {
+ "metric": "bugs",
+ "value": "12",
+ },
+ Object {
+ "metric": "vulnerabilities",
+ "value": "1",
+ },
+ ],
+ "name": "Bar",
+ "qualifier": "TRK",
+ }
}
- }
- rootComponent={
- Object {
- "key": "foo",
- "measures": Array [
- Object {
- "bestValue": false,
- "metric": "bugs",
- "value": "12",
- },
- ],
- "name": "Foo",
- "qualifier": "TRK",
+ rootComponent={
+ Object {
+ "key": "foo",
+ "measures": Array [
+ Object {
+ "bestValue": false,
+ "metric": "bugs",
+ "value": "12",
+ },
+ ],
+ "name": "Foo",
+ "qualifier": "TRK",
+ }
}
- }
- />
+ />
+ </div>
</td>
<td
className="thin nowrap text-right"
<td
className="code-name-cell"
>
- <ComponentName
- canBrowse={false}
- component={
- Object {
- "key": "foo:src/index.tsx",
- "measures": Array [
- Object {
- "bestValue": false,
- "metric": "bugs",
- "value": "1",
- },
- ],
- "name": "index.tsx",
- "path": "src/index.tsx",
- "qualifier": "FIL",
+ <div
+ className="display-flex-center"
+ >
+ <ComponentName
+ canBrowse={false}
+ component={
+ Object {
+ "key": "foo:src/index.tsx",
+ "measures": Array [
+ Object {
+ "bestValue": false,
+ "metric": "bugs",
+ "value": "1",
+ },
+ ],
+ "name": "index.tsx",
+ "path": "src/index.tsx",
+ "qualifier": "FIL",
+ }
}
- }
- rootComponent={
- Object {
- "key": "foo",
- "measures": Array [
- Object {
- "bestValue": false,
- "metric": "bugs",
- "value": "12",
- },
- ],
- "name": "Foo",
- "qualifier": "TRK",
+ rootComponent={
+ Object {
+ "key": "foo",
+ "measures": Array [
+ Object {
+ "bestValue": false,
+ "metric": "bugs",
+ "value": "12",
+ },
+ ],
+ "name": "Foo",
+ "qualifier": "TRK",
+ }
}
- }
- />
+ />
+ </div>
</td>
<td
className="thin nowrap text-right"
className="code-name-cell"
>
<div
- className="code-child-component-icon"
- />
- <ComponentName
- canBrowse={false}
- component={
- Object {
- "key": "bar",
- "measures": Array [
- Object {
- "metric": "bugs",
- "value": "12",
- },
- Object {
- "metric": "vulnerabilities",
- "value": "1",
- },
- ],
- "name": "Bar",
- "qualifier": "TRK",
+ className="display-flex-center"
+ >
+ <div
+ className="code-child-component-icon"
+ />
+ <ComponentName
+ canBrowse={false}
+ component={
+ Object {
+ "key": "bar",
+ "measures": Array [
+ Object {
+ "metric": "bugs",
+ "value": "12",
+ },
+ Object {
+ "metric": "vulnerabilities",
+ "value": "1",
+ },
+ ],
+ "name": "Bar",
+ "qualifier": "TRK",
+ }
}
- }
- rootComponent={
- Object {
- "key": "foo",
- "measures": Array [
- Object {
- "bestValue": false,
- "metric": "bugs",
- "value": "12",
- },
- ],
- "name": "Foo",
- "qualifier": "TRK",
+ rootComponent={
+ Object {
+ "key": "foo",
+ "measures": Array [
+ Object {
+ "bestValue": false,
+ "metric": "bugs",
+ "value": "12",
+ },
+ ],
+ "name": "Foo",
+ "qualifier": "TRK",
+ }
}
- }
- />
+ />
+ </div>
</td>
<td
className="thin nowrap text-right"
wont_fix_issues = 'wont_fix_issues'
}
+export enum MetricType {
+ Rating = 'RATING',
+ Percent = 'PERCENT',
+ Integer = 'INT',
+ Level = 'LEVEL',
+ ShortInteger = 'SHORT_INT',
+ ShortWorkDuration = 'SHORT_WORK_DUR',
+ Data = 'DATA'
+}
+
export function isMetricKey(key: string): key is MetricKey {
return (Object.values(MetricKey) as string[]).includes(key);
}