From e7ca47f6e3f0348b50ca2d6797199c4940ef27e0 Mon Sep 17 00:00:00 2001 From: guillaume-peoch-sonarsource <91735163+guillaume-peoch-sonarsource@users.noreply.github.com> Date: Fri, 15 Oct 2021 11:38:29 +0200 Subject: SONAR-15471 Fix long file name on code page --- .../src/main/js/apps/code/components/Component.tsx | 32 ++-- .../__snapshots__/Component-test.tsx.snap | 204 +++++++++++---------- server/sonar-web/src/main/js/types/metrics.ts | 10 + 3 files changed, 137 insertions(+), 109 deletions(-) (limited to 'server/sonar-web/src/main') diff --git a/server/sonar-web/src/main/js/apps/code/components/Component.tsx b/server/sonar-web/src/main/js/apps/code/components/Component.tsx index eb96e015ee8..de6abf0e4ff 100644 --- a/server/sonar-web/src/main/js/apps/code/components/Component.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/Component.tsx @@ -22,6 +22,8 @@ import * as React from 'react'; 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'; @@ -52,7 +54,9 @@ export class Component extends React.PureComponent { selected = false } = this.props; - const isFile = component.qualifier === 'FIL' || component.qualifier === 'UTS'; + const isFile = + component.qualifier === ComponentQualifier.File || + component.qualifier === ComponentQualifier.TestFile; return ( @@ -75,27 +79,29 @@ export class Component extends React.PureComponent { )} - {hasBaseComponent &&
} - +
+ {hasBaseComponent &&
} + +
{metrics.map(metric => (
diff --git a/server/sonar-web/src/main/js/apps/code/components/__tests__/__snapshots__/Component-test.tsx.snap b/server/sonar-web/src/main/js/apps/code/components/__tests__/__snapshots__/Component-test.tsx.snap index 176787f33f6..2d8e79a5529 100644 --- a/server/sonar-web/src/main/js/apps/code/components/__tests__/__snapshots__/Component-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/code/components/__tests__/__snapshots__/Component-test.tsx.snap @@ -13,40 +13,44 @@ exports[`should render correctly 1`] = ` - + + /> +
- + + /> +
- +
+ + /> +