From 0de67f888cd2cc48e7097caaf1860e4985f751c5 Mon Sep 17 00:00:00 2001 From: Wouter Admiraal Date: Wed, 10 Apr 2019 15:48:31 +0200 Subject: SONAR-11900 Remove location counter from issues in the code viewer and issue list --- .../apps/issues/components/IssuesSourceViewer.tsx | 2 -- .../main/js/apps/issues/components/ListItem.tsx | 1 - .../components/SourceViewer/SourceViewerBase.tsx | 6 ---- .../components/SourceViewer/SourceViewerCode.tsx | 4 --- .../js/components/SourceViewer/components/Line.tsx | 4 --- .../SourceViewer/components/LineCode.tsx | 4 --- .../SourceViewer/components/LineIssuesList.tsx | 4 --- .../__snapshots__/LineIssuesList-test.tsx.snap | 4 --- .../src/main/js/components/issue/Issue.tsx | 6 ---- .../src/main/js/components/issue/IssueView.tsx | 4 --- .../components/issue/components/IssueTitleBar.tsx | 34 +--------------------- .../components/__tests__/IssueTitleBar-test.tsx | 12 -------- .../__snapshots__/IssueTitleBar-test.tsx.snap | 6 ---- 13 files changed, 1 insertion(+), 90 deletions(-) (limited to 'server/sonar-web/src') diff --git a/server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.tsx b/server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.tsx index fbaa4feb644..3e2d6ee44c7 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.tsx @@ -111,8 +111,6 @@ export default class IssuesSourceViewer extends React.PureComponent { branchLike={this.props.branchLike} component={component} displayAllIssues={true} - displayIssueLocationsCount={false} - displayIssueLocationsLink={false} displayLocationMarkers={!allMessagesEmpty} highlightedLocationMessage={highlightedLocationMessage} highlightedLocations={highlightedLocations} diff --git a/server/sonar-web/src/main/js/apps/issues/components/ListItem.tsx b/server/sonar-web/src/main/js/apps/issues/components/ListItem.tsx index 2ac011d118a..91cbcd95e15 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/ListItem.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/ListItem.tsx @@ -114,7 +114,6 @@ export default class ListItem extends React.PureComponent { static defaultProps = { displayAllIssues: false, - displayIssueLocationsCount: true, - displayIssueLocationsLink: true, displayLocationMarkers: true, loadComponent: defaultLoadComponent, loadIssues: defaultLoadIssues, @@ -633,8 +629,6 @@ export default class SourceViewerBase extends React.PureComponent branchLike={this.props.branchLike} componentKey={this.props.component} displayAllIssues={this.props.displayAllIssues} - displayIssueLocationsCount={this.props.displayIssueLocationsCount} - displayIssueLocationsLink={this.props.displayIssueLocationsLink} displayLocationMarkers={this.props.displayLocationMarkers} duplications={this.state.duplications} duplicationsByLine={this.state.duplicationsByLine} diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.tsx b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.tsx index 923f3b6ff9f..cac8ee2dec8 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.tsx @@ -37,8 +37,6 @@ interface Props { branchLike: T.BranchLike | undefined; componentKey: string; displayAllIssues?: boolean; - displayIssueLocationsCount?: boolean; - displayIssueLocationsLink?: boolean; displayLocationMarkers?: boolean; duplications: T.Duplication[] | undefined; duplicationsByLine: { [line: number]: number[] }; @@ -159,8 +157,6 @@ export default class SourceViewerCode extends React.PureComponent { displayAllIssues={this.props.displayAllIssues} displayCoverage={displayCoverage} displayDuplications={displayDuplications} - displayIssueLocationsCount={this.props.displayIssueLocationsCount} - displayIssueLocationsLink={this.props.displayIssueLocationsLink} displayIssues={displayIssues} displayLocationMarkers={this.props.displayLocationMarkers} duplications={this.getDuplicationsForLine(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 27574086a84..5d26fe77b9b 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 @@ -33,8 +33,6 @@ interface Props { displayAllIssues?: boolean; displayCoverage: boolean; displayDuplications: boolean; - displayIssueLocationsCount?: boolean; - displayIssueLocationsLink?: boolean; displayIssues: boolean; displayLocationMarkers?: boolean; duplications: number[]; @@ -151,8 +149,6 @@ export default class Line extends React.PureComponent { { {showIssues && issues.length > 0 && ( void; @@ -40,8 +38,6 @@ export default function LineIssuesList(props: Props) { {props.issues.map(issue => ( void; onCheck?: (issue: string) => void; @@ -41,8 +39,6 @@ interface Props { export default class Issue extends React.PureComponent { static defaultProps = { - displayLocationsCount: true, - displayLocationsLink: true, selected: false }; @@ -134,8 +130,6 @@ export default class Issue extends React.PureComponent { branchLike={this.props.branchLike} checked={this.props.checked} currentPopup={this.props.openPopup} - displayLocationsCount={this.props.displayLocationsCount} - displayLocationsLink={this.props.displayLocationsLink} issue={this.props.issue} onAssign={this.handleAssignement} onChange={this.props.onChange} diff --git a/server/sonar-web/src/main/js/components/issue/IssueView.tsx b/server/sonar-web/src/main/js/components/issue/IssueView.tsx index 21a0eaee419..e1d2371d4a7 100644 --- a/server/sonar-web/src/main/js/components/issue/IssueView.tsx +++ b/server/sonar-web/src/main/js/components/issue/IssueView.tsx @@ -30,8 +30,6 @@ interface Props { branchLike?: T.BranchLike; checked?: boolean; currentPopup?: string; - displayLocationsCount?: boolean; - displayLocationsLink?: boolean; issue: T.Issue; onAssign: (login: string) => void; onChange: (issue: T.Issue) => void; @@ -85,8 +83,6 @@ export default class IssueView extends React.PureComponent { void; togglePopup: (popup: string, show?: boolean) => void; @@ -45,22 +40,6 @@ export default function IssueTitleBar(props: Props) { const { issue } = props; const hasSimilarIssuesFilter = props.onFilter != null; - const locationsCount = - issue.secondaryLocations.length + - issue.flows.reduce((sum, locations) => sum + locations.length, 0); - - const locationsBadge = ( - - {locationsCount} - - ); - - const displayLocations = props.displayLocationsCount && locationsCount > 0; - const issueUrl = getComponentIssuesUrl(issue.project, { ...getBranchLikeQuery(props.branchLike), issues: issue.key, @@ -100,17 +79,6 @@ export default function IssueTitleBar(props: Props) { )} - {displayLocations && ( -
  • - {props.displayLocationsLink ? ( - - {locationsBadge} - - ) : ( - locationsBadge - )} -
  • - )}
  • { const branch: T.ShortLivingBranch = { @@ -45,17 +44,6 @@ it('should render the titlebar with the filter', () => { expect(element).toMatchSnapshot(); }); -it('should count all code locations', () => { - const element = shallow( - - ); - expect(element.find('LocationIndex')).toMatchSnapshot(); -}); - it('should have a correct permalink for security hotspots', () => { const wrapper = shallow( diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTitleBar-test.tsx.snap b/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTitleBar-test.tsx.snap index 3fc0b16bfe3..812027acb3b 100644 --- a/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTitleBar-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTitleBar-test.tsx.snap @@ -1,11 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`should count all code locations 1`] = ` - - 7 - -`; - exports[`should render the titlebar correctly 1`] = `