@@ -20,6 +20,7 @@ | |||
import throwGlobalError from '../app/utils/throwGlobalError'; | |||
import { getJSON, postJSON, post, RequestData } from '../helpers/request'; | |||
import { | |||
SourceLine, | |||
Paging, | |||
Visibility, | |||
BranchParameters, | |||
@@ -294,7 +295,7 @@ export function getComponentForSourceViewer( | |||
export function getSources( | |||
data: { key: string; from?: number; to?: number } & BranchParameters | |||
): Promise<any> { | |||
): Promise<SourceLine[]> { | |||
return getJSON('/api/sources/lines', data).then(r => r.sources); | |||
} | |||
@@ -628,6 +628,7 @@ export interface SourceLine { | |||
coverageStatus?: string; | |||
coveredConditions?: number; | |||
duplicated?: boolean; | |||
isNew?: boolean; | |||
line: number; | |||
lineHits?: number; | |||
scmAuthor?: string; |
@@ -593,14 +593,6 @@ export default class SourceViewerBase extends React.PureComponent<Props, State> | |||
} | |||
}; | |||
handleFilterLine = (line: SourceLine) => { | |||
const { component } = this.state; | |||
const leakPeriodDate = component && component.leakPeriodDate; | |||
return leakPeriodDate | |||
? line.scmDate !== undefined && parseDate(line.scmDate) > parseDate(leakPeriodDate) | |||
: false; | |||
}; | |||
renderDuplicationPopup = (index: number, line: number) => { | |||
const { component, duplicatedFiles, duplications } = this.state; | |||
@@ -648,7 +640,6 @@ export default class SourceViewerBase extends React.PureComponent<Props, State> | |||
displayLocationMarkers={this.props.displayLocationMarkers} | |||
duplications={this.state.duplications} | |||
duplicationsByLine={this.state.duplicationsByLine} | |||
filterLine={this.handleFilterLine} | |||
hasSourcesAfter={this.state.hasSourcesAfter} | |||
hasSourcesBefore={hasSourcesBefore} | |||
highlightedLine={this.props.highlightedLine} |
@@ -37,6 +37,7 @@ const EMPTY_ARRAY: any[] = []; | |||
const ZERO_LINE = { | |||
code: '', | |||
duplicated: false, | |||
isNew: false, | |||
line: 0 | |||
}; | |||
@@ -49,7 +50,6 @@ interface Props { | |||
displayLocationMarkers?: boolean; | |||
duplications: Duplication[] | undefined; | |||
duplicationsByLine: { [line: number]: number[] }; | |||
filterLine?: (line: SourceLine) => boolean; | |||
hasSourcesAfter: boolean; | |||
hasSourcesBefore: boolean; | |||
highlightedLine: number | undefined; | |||
@@ -126,8 +126,7 @@ export default class SourceViewerCode extends React.PureComponent<Props> { | |||
displayDuplications: boolean; | |||
displayIssues: boolean; | |||
}) => { | |||
const { filterLine, highlightedLocationMessage, selectedIssue, sources } = this.props; | |||
const filtered = filterLine && filterLine(line); | |||
const { highlightedLocationMessage, selectedIssue, sources } = this.props; | |||
const secondaryIssueLocations = this.getSecondaryIssueLocationsForLine(line); | |||
@@ -175,7 +174,6 @@ export default class SourceViewerCode extends React.PureComponent<Props> { | |||
displayLocationMarkers={this.props.displayLocationMarkers} | |||
duplications={this.getDuplicationsForLine(line)} | |||
duplicationsCount={duplicationsCount} | |||
filtered={filtered} | |||
highlighted={line.line === this.props.highlightedLine} | |||
highlightedLocationMessage={optimizedLocationMessage} | |||
highlightedSymbols={optimizedHighlightedSymbols} |
@@ -41,7 +41,6 @@ interface Props { | |||
displayLocationMarkers?: boolean; | |||
duplications: number[]; | |||
duplicationsCount: number; | |||
filtered: boolean | undefined; | |||
highlighted: boolean; | |||
highlightedLocationMessage: { index: number; text: string | undefined } | undefined; | |||
highlightedSymbols: string[] | undefined; | |||
@@ -101,17 +100,10 @@ export default class Line extends React.PureComponent<Props> { | |||
}; | |||
render() { | |||
const { | |||
displayCoverage, | |||
duplications, | |||
duplicationsCount, | |||
filtered, | |||
issuePopup, | |||
line | |||
} = this.props; | |||
const { displayCoverage, duplications, duplicationsCount, issuePopup, line } = this.props; | |||
const className = classNames('source-line', { | |||
'source-line-highlighted': this.props.highlighted, | |||
'source-line-filtered': filtered === true, | |||
'source-line-filtered': line.isNew, | |||
'source-line-filtered-dark': | |||
displayCoverage && | |||
(line.coverageStatus === 'uncovered' || line.coverageStatus === 'partially-covered'), |