diff options
11 files changed, 30 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/apps/issues/components/ListItem.js b/server/sonar-web/src/main/js/apps/issues/components/ListItem.js index 94da47a46ab..7350b468759 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/ListItem.js +++ b/server/sonar-web/src/main/js/apps/issues/components/ListItem.js @@ -106,6 +106,7 @@ export default class ListItem extends React.PureComponent { </div> )} <Issue + branch={branch} checked={this.props.checked} displayLocationsLink={false} issue={issue} diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.js b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.js index 08311dfc7b3..afda1bbd764 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.js +++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.js @@ -599,6 +599,7 @@ export default class SourceViewerBase extends React.PureComponent { const hasSourcesBefore = sources.length > 0 && sources[0].line > 1; return ( <SourceViewerCode + branch={this.props.branch} displayAllIssues={this.props.displayAllIssues} displayIssueLocationsCount={this.props.displayIssueLocationsCount} displayIssueLocationsLink={this.props.displayIssueLocationsLink} diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.js b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.js index 779b7a685a9..0c1af3244b9 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.js +++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.js @@ -37,6 +37,7 @@ const ZERO_LINE = { export default class SourceViewerCode extends React.PureComponent { /*:: props: {| + branch?: string, displayAllIssues: boolean, displayIssueLocationsCount?: boolean; displayIssueLocationsLink?: boolean; @@ -148,6 +149,7 @@ export default class SourceViewerCode extends React.PureComponent { return ( <Line + branch={this.props.branch} displayAllIssues={this.props.displayAllIssues} displayCoverage={displayCoverage} displayDuplications={displayDuplications} diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/Line.js b/server/sonar-web/src/main/js/components/SourceViewer/components/Line.js index 216f6ef65c1..a5441d1e814 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/Line.js +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/Line.js @@ -34,6 +34,7 @@ import LineCode from './LineCode'; /*:: type Props = {| + branch?: string, displayAllIssues: boolean, displayCoverage: boolean, displayDuplications: boolean, @@ -144,6 +145,7 @@ export default class Line extends React.PureComponent { )} <LineCode + branch={this.props.branch} displayIssueLocationsCount={this.props.displayIssueLocationsCount} displayIssueLocationsLink={this.props.displayIssueLocationsLink} highlightedLocationMessage={this.props.highlightedLocationMessage} diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.js b/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.js index 3635c3c315f..ad71197cf9c 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.js +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineCode.js @@ -31,6 +31,7 @@ import { splitByTokens, highlightSymbol, highlightIssueLocations } from '../help /*:: type Props = {| + branch?: string, displayIssueLocationsCount?: boolean, displayIssueLocationsLink?: boolean, highlightedLocationMessage?: { index: number, text: string }, @@ -217,6 +218,7 @@ export default class LineCode extends React.PureComponent { {showIssues && issues.length > 0 && ( <LineIssuesList + branch={this.props.branch} displayIssueLocationsCount={this.props.displayIssueLocationsCount} displayIssueLocationsLink={this.props.displayIssueLocationsLink} issues={issues} diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesList.js b/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesList.js index d4c186a83e5..573dbeba809 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesList.js +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesList.js @@ -24,6 +24,7 @@ import Issue from '../../issue/Issue'; /*:: type Props = { + branch?: string, displayIssueLocationsCount?: boolean; displayIssueLocationsLink?: boolean; issues: Array<IssueType>, @@ -39,12 +40,13 @@ export default class LineIssuesList extends React.PureComponent { /*:: props: Props; */ render() { - const { issues, onIssueClick, openPopup, selectedIssue } = this.props; + const { branch, issues, onIssueClick, openPopup, selectedIssue } = this.props; return ( <div className="issue-list"> {issues.map(issue => ( <Issue + branch={branch} displayLocationsCount={this.props.displayIssueLocationsCount} displayLocationsLink={this.props.displayIssueLocationsLink} issue={issue} diff --git a/server/sonar-web/src/main/js/components/issue/Issue.js b/server/sonar-web/src/main/js/components/issue/Issue.js index a67e04c3faf..47889911316 100644 --- a/server/sonar-web/src/main/js/components/issue/Issue.js +++ b/server/sonar-web/src/main/js/components/issue/Issue.js @@ -29,6 +29,7 @@ import { updateIssue } from './actions'; /*:: type Props = {| + branch?: string, checked?: boolean, displayLocationsCount?: boolean; displayLocationsLink?: boolean; @@ -146,6 +147,7 @@ export default class Issue extends React.PureComponent { render() { return ( <IssueView + branch={this.props.branch} checked={this.props.checked} currentPopup={this.props.openPopup} displayLocationsCount={this.props.displayLocationsCount} diff --git a/server/sonar-web/src/main/js/components/issue/IssueView.js b/server/sonar-web/src/main/js/components/issue/IssueView.js index fd6b8f2aa6d..5141e4d8032 100644 --- a/server/sonar-web/src/main/js/components/issue/IssueView.js +++ b/server/sonar-web/src/main/js/components/issue/IssueView.js @@ -29,6 +29,7 @@ import { deleteIssueComment, editIssueComment } from '../../api/issues'; /*:: type Props = {| + branch?: string, checked?: boolean, currentPopup: ?string, displayLocationsCount?: boolean; @@ -89,6 +90,7 @@ export default class IssueView extends React.PureComponent { role="listitem" tabIndex={0}> <IssueTitleBar + branch={this.props.branch} currentPopup={this.props.currentPopup} displayLocationsCount={this.props.displayLocationsCount} displayLocationsLink={this.props.displayLocationsLink} diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.js b/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.js index bd4acefaa84..a445f5c1523 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.js +++ b/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.js @@ -33,6 +33,7 @@ import { translate, translateWithParameters } from '../../../helpers/l10n'; /*:: type Props = {| + branch?: string, currentPopup: ?string, displayLocationsCount?: boolean; displayLocationsLink?: boolean; @@ -66,7 +67,11 @@ export default function IssueTitleBar(props /*: Props */) { const displayLocations = props.displayLocationsCount && locationsCount > 0; - const issueUrl = getComponentIssuesUrl(issue.project, { issues: issue.key, open: issue.key }); + const issueUrl = getComponentIssuesUrl(issue.project, { + branch: props.branch, + issues: issue.key, + open: issue.key + }); return ( <table className="issue-table"> diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.js b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.js index bf2980f0c2d..f77de286ed3 100644 --- a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.js +++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.js @@ -47,7 +47,13 @@ const issueWithLocations = { it('should render the titlebar correctly', () => { const element = shallow( - <IssueTitleBar issue={issue} currentPopup={null} onFail={jest.fn()} togglePopup={jest.fn()} /> + <IssueTitleBar + branch="feature-1.0" + issue={issue} + currentPopup={null} + onFail={jest.fn()} + togglePopup={jest.fn()} + /> ); expect(element).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTitleBar-test.js.snap b/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTitleBar-test.js.snap index 1302c5f2ac0..18d585695f7 100644 --- a/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTitleBar-test.js.snap +++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTitleBar-test.js.snap @@ -80,6 +80,7 @@ exports[`should render the titlebar correctly 1`] = ` Object { "pathname": "/project/issues", "query": Object { + "branch": "feature-1.0", "id": "myproject", "issues": "AVsae-CQS-9G3txfbFN2", "open": "AVsae-CQS-9G3txfbFN2", @@ -169,6 +170,7 @@ exports[`should render the titlebar with the filter 1`] = ` Object { "pathname": "/project/issues", "query": Object { + "branch": undefined, "id": "myproject", "issues": "AVsae-CQS-9G3txfbFN2", "open": "AVsae-CQS-9G3txfbFN2", |