import throwGlobalError from '../app/utils/throwGlobalError';
import { getJSON, postJSON, post, RequestData } from '../helpers/request';
import {
+ SourceLine,
Paging,
Visibility,
BranchParameters,
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);
}
coverageStatus?: string;
coveredConditions?: number;
duplicated?: boolean;
+ isNew?: boolean;
line: number;
lineHits?: number;
scmAuthor?: string;
}
};
- 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;
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}
const ZERO_LINE = {
code: '',
duplicated: false,
+ isNew: false,
line: 0
};
displayLocationMarkers?: boolean;
duplications: Duplication[] | undefined;
duplicationsByLine: { [line: number]: number[] };
- filterLine?: (line: SourceLine) => boolean;
hasSourcesAfter: boolean;
hasSourcesBefore: boolean;
highlightedLine: number | undefined;
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);
displayLocationMarkers={this.props.displayLocationMarkers}
duplications={this.getDuplicationsForLine(line)}
duplicationsCount={duplicationsCount}
- filtered={filtered}
highlighted={line.line === this.props.highlightedLine}
highlightedLocationMessage={optimizedLocationMessage}
highlightedSymbols={optimizedHighlightedSymbols}
displayLocationMarkers?: boolean;
duplications: number[];
duplicationsCount: number;
- filtered: boolean | undefined;
highlighted: boolean;
highlightedLocationMessage: { index: number; text: string | undefined } | undefined;
highlightedSymbols: string[] | undefined;
};
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'),