]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-12113 Fix line permalink in new exec flow
authorJeremy Davis <jeremy.davis@sonarsource.com>
Fri, 17 May 2019 15:18:01 +0000 (17:18 +0200)
committerSonarTech <sonartech@sonarsource.com>
Thu, 23 May 2019 18:21:10 +0000 (20:21 +0200)
server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetViewer.tsx
server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/CrossComponentSourceViewerWrapper.tsx

index 72f972d71d9bad55b79eb992539c84fe6c9b7f7f..a58e208b87661dc045bba1e064368cb47b985b02 100644 (file)
@@ -235,7 +235,7 @@ export default class ComponentSourceSnippetViewer extends React.PureComponent<Pr
 
     return (
       <Line
-        branchLike={undefined}
+        branchLike={this.props.branchLike}
         displayAllIssues={false}
         displayCoverage={true}
         displayDuplications={displayDuplications}
index 8cdcbbdfd628fac64774ebf66d019ddda95867ea..4b8262b38a0b766d8b221a0596f1cc4e2d0742fa 100644 (file)
@@ -22,6 +22,7 @@ import ComponentSourceSnippetViewer from './ComponentSourceSnippetViewer';
 import { groupLocationsByComponent } from './utils';
 import DeferredSpinner from '../../../components/common/DeferredSpinner';
 import DuplicationPopup from '../../../components/SourceViewer/components/DuplicationPopup';
+import { SourceViewerContext } from '../../../components/SourceViewer/SourceViewerContext';
 import { WorkspaceContext } from '../../../components/workspace/context';
 import { getIssueFlowSnippets } from '../../../api/issues';
 import {
@@ -221,25 +222,28 @@ export default class CrossComponentSourceViewerWrapper extends React.PureCompone
             };
           }
           return (
-            <ComponentSourceSnippetViewer
-              branchLike={this.props.branchLike}
-              highlightedLocationMessage={this.props.highlightedLocationMessage}
-              issue={this.props.issue}
-              issuePopup={this.state.issuePopup}
-              issuesByLine={issuesByComponent[snippetGroup.component.key] || {}}
+            <SourceViewerContext.Provider
               key={`${this.props.issue.key}-${this.props.selectedFlowIndex}-${i}`}
-              last={i === locationsByComponent.length - 1}
-              loadDuplications={this.fetchDuplications}
-              locations={snippetGroup.locations || []}
-              onIssueChange={this.props.onIssueChange}
-              onIssuePopupToggle={this.handleIssuePopupToggle}
-              onLinePopupToggle={this.handleLinePopupToggle}
-              onLocationSelect={this.props.onLocationSelect}
-              renderDuplicationPopup={this.renderDuplicationPopup}
-              scroll={this.props.scroll}
-              snippetGroup={snippetGroup}
-              {...componentProps}
-            />
+              value={{ branchLike: this.props.branchLike, file: snippetGroup.component }}>
+              <ComponentSourceSnippetViewer
+                branchLike={this.props.branchLike}
+                highlightedLocationMessage={this.props.highlightedLocationMessage}
+                issue={this.props.issue}
+                issuePopup={this.state.issuePopup}
+                issuesByLine={issuesByComponent[snippetGroup.component.key] || {}}
+                last={i === locationsByComponent.length - 1}
+                loadDuplications={this.fetchDuplications}
+                locations={snippetGroup.locations || []}
+                onIssueChange={this.props.onIssueChange}
+                onIssuePopupToggle={this.handleIssuePopupToggle}
+                onLinePopupToggle={this.handleLinePopupToggle}
+                onLocationSelect={this.props.onLocationSelect}
+                renderDuplicationPopup={this.renderDuplicationPopup}
+                scroll={this.props.scroll}
+                snippetGroup={snippetGroup}
+                {...componentProps}
+              />
+            </SourceViewerContext.Provider>
           );
         })}
       </div>