From 8592cedbc5b667e62acc701986e8cc14fe3402ca Mon Sep 17 00:00:00 2001 From: Revanshu Paliwal Date: Wed, 24 May 2023 16:58:24 +0200 Subject: [PATCH] SONAR-19174 Hide location number when flows are not present --- .../ComponentSourceSnippetGroupViewer.tsx | 3 +++ .../SnippetViewer.tsx | 17 +++++++++++++++-- .../components/SourceViewer/components/Line.tsx | 4 +++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx index ad8273fc09a..fe0935791f5 100644 --- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx +++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx @@ -278,6 +278,8 @@ class ComponentSourceSnippetGroupViewer extends React.PureComponent {issueIsClosed && ( @@ -356,6 +358,7 @@ class ComponentSourceSnippetGroupViewer extends React.PureComponent ))} diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/SnippetViewer.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/SnippetViewer.tsx index b428953ca11..f31b4ab4a48 100644 --- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/SnippetViewer.tsx +++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/SnippetViewer.tsx @@ -67,6 +67,7 @@ export interface SnippetViewerProps { snippet: SourceLine[]; className?: string; snippetSourcesMap?: LineMap; + hideLocationIndex?: boolean; } type Props = SnippetViewerProps & ThemeProp; @@ -76,9 +77,20 @@ function SnippetViewer(props: Props) { props.expandBlock(props.index, direction); }; - const { component, displaySCM, locationsByLine, snippet, theme, className } = props; + const { + component, + displaySCM, + locationsByLine, + snippet, + theme, + className, + hideLocationIndex, + displayLineNumberOptions, + duplications, + duplicationsByLine, + snippetSourcesMap, + } = props; - const { displayLineNumberOptions, duplications, duplicationsByLine, snippetSourcesMap } = props; const duplicationsCount = duplications ? duplications.length : 0; const firstLineNumber = snippet?.length ? snippet[0].line : 0; @@ -183,6 +195,7 @@ function SnippetViewer(props: Props) { secondaryIssueLocations={secondaryIssueLocations} onLineMouseEnter={onLineMouseEnter} onLineMouseLeave={onLineMouseLeave} + hideLocationIndex={hideLocationIndex} > {props.renderAdditionalChildInLine?.(line)} diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx index e804c11b9df..bfd4403d196 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/Line.tsx @@ -66,6 +66,7 @@ export interface LineProps { onLineMouseLeave: (line: number) => void; displayCoverageUnderline: boolean; displayNewCodeUnderline: boolean; + hideLocationIndex?: boolean; } export default function Line(props: LineProps) { @@ -93,6 +94,7 @@ export default function Line(props: LineProps) { scrollToUncoveredLine, secondaryIssueLocations, displayCoverageUnderline, + hideLocationIndex, onLineMouseEnter, onLineMouseLeave, } = props; @@ -226,7 +228,7 @@ export default function Line(props: LineProps) { displayCoverageUnderline={displayCoverage && displayCoverageUnderline} displayLocationMarkers={displayLocationMarkers} displayNewCodeUnderlineLabel={displayNewCodeUnderline} - hideLocationIndex={false} + hideLocationIndex={hideLocationIndex} highlightedLocationMessage={highlightedLocationMessage} highlightedSymbols={highlightedSymbols} issueLocations={issueLocations} -- 2.39.5