* SONAR-16465 Replace parameter sinceLeakPeriod with inNewCodePeriodtags/9.6.0.59041
@@ -61,7 +61,7 @@ describe('serialize/deserialize', () => { | |||
sansTop25: ['a', 'b'], | |||
scopes: ['a', 'b'], | |||
severities: ['a', 'b'], | |||
sinceLeakPeriod: true, | |||
inNewCodePeriod: true, | |||
sonarsourceSecurity: ['a', 'b'], | |||
statuses: ['a', 'b'], | |||
tags: ['a', 'b'], | |||
@@ -88,7 +88,7 @@ describe('serialize/deserialize', () => { | |||
sansTop25: 'a,b', | |||
scopes: 'a,b', | |||
severities: 'a,b', | |||
sinceLeakPeriod: 'true', | |||
inNewCodePeriod: 'true', | |||
sonarsourceSecurity: 'a,b', | |||
statuses: 'a,b', | |||
tags: 'a,b', |
@@ -119,6 +119,7 @@ exports[`should show warnning when not all projects are accessible 1`] = ` | |||
"cwe": Array [], | |||
"directories": Array [], | |||
"files": Array [], | |||
"inNewCodePeriod": false, | |||
"issues": Array [], | |||
"languages": Array [], | |||
"owaspTop10": Array [], | |||
@@ -130,7 +131,6 @@ exports[`should show warnning when not all projects are accessible 1`] = ` | |||
"sansTop25": Array [], | |||
"scopes": Array [], | |||
"severities": Array [], | |||
"sinceLeakPeriod": false, | |||
"sonarsourceSecurity": Array [], | |||
"sort": "", | |||
"statuses": Array [], |
@@ -49,7 +49,7 @@ interface Props { | |||
onChange: (changes: Partial<Query>) => void; | |||
onToggle: (property: string) => void; | |||
open: boolean; | |||
sinceLeakPeriod: boolean; | |||
inNewCodePeriod: boolean; | |||
stats: Dict<number> | undefined; | |||
} | |||
@@ -65,7 +65,7 @@ export class CreationDateFacet extends React.PureComponent<Props & WrappedCompon | |||
this.props.createdAt.length > 0 || | |||
this.props.createdBefore !== undefined || | |||
this.props.createdInLast.length > 0 || | |||
this.props.sinceLeakPeriod; | |||
this.props.inNewCodePeriod; | |||
handleHeaderClick = () => { | |||
this.props.onToggle(this.property); | |||
@@ -81,7 +81,7 @@ export class CreationDateFacet extends React.PureComponent<Props & WrappedCompon | |||
createdAt: undefined, | |||
createdBefore: undefined, | |||
createdInLast: undefined, | |||
sinceLeakPeriod: undefined, | |||
inNewCodePeriod: undefined, | |||
...changes | |||
}); | |||
}; | |||
@@ -102,7 +102,7 @@ export class CreationDateFacet extends React.PureComponent<Props & WrappedCompon | |||
handlePeriodClick = (period: string) => this.resetTo({ createdInLast: period }); | |||
handleLeakPeriodClick = () => this.resetTo({ sinceLeakPeriod: true }); | |||
handleLeakPeriodClick = () => this.resetTo({ inNewCodePeriod: true }); | |||
getValues() { | |||
const { | |||
@@ -111,7 +111,7 @@ export class CreationDateFacet extends React.PureComponent<Props & WrappedCompon | |||
createdAt, | |||
createdBefore, | |||
createdInLast, | |||
sinceLeakPeriod | |||
inNewCodePeriod | |||
} = this.props; | |||
const { formatDate } = this.props.intl; | |||
const values = []; | |||
@@ -138,7 +138,7 @@ export class CreationDateFacet extends React.PureComponent<Props & WrappedCompon | |||
if (createdInLast === '1y') { | |||
values.push(translate('issues.facet.createdAt.last_year')); | |||
} | |||
if (sinceLeakPeriod) { | |||
if (inNewCodePeriod) { | |||
values.push(translate('issues.new_code')); | |||
} | |||
return values; | |||
@@ -221,7 +221,7 @@ export class CreationDateFacet extends React.PureComponent<Props & WrappedCompon | |||
} | |||
renderPredefinedPeriods() { | |||
const { component, createdInLast, sinceLeakPeriod } = this.props; | |||
const { component, createdInLast, inNewCodePeriod } = this.props; | |||
return ( | |||
<div className="spacer-top issues-predefined-periods"> | |||
<FacetItem | |||
@@ -233,7 +233,7 @@ export class CreationDateFacet extends React.PureComponent<Props & WrappedCompon | |||
/> | |||
{component && !isPortfolioLike(component.qualifier) ? ( | |||
<FacetItem | |||
active={sinceLeakPeriod} | |||
active={inNewCodePeriod} | |||
name={translate('issues.new_code')} | |||
onClick={this.handleLeakPeriodClick} | |||
tooltip={translate('issues.new_code_period')} |
@@ -212,7 +212,7 @@ export class Sidebar extends React.PureComponent<Props> { | |||
onChange={this.props.onFilterChange} | |||
onToggle={this.props.onFacetToggle} | |||
open={!!openFacets.createdAt} | |||
sinceLeakPeriod={query.sinceLeakPeriod} | |||
inNewCodePeriod={query.inNewCodePeriod} | |||
stats={facets.createdAt} | |||
/> | |||
<LanguageFacet |
@@ -64,7 +64,7 @@ function shallowRender(props?: Partial<CreationDateFacet['props']>) { | |||
createdAt="" | |||
createdBefore={undefined} | |||
createdInLast="" | |||
sinceLeakPeriod={false} | |||
inNewCodePeriod={false} | |||
intl={ | |||
{ | |||
formatDate: (date: string) => 'formatted.' + date |
@@ -61,7 +61,7 @@ export interface Query { | |||
sansTop25: string[]; | |||
scopes: string[]; | |||
severities: string[]; | |||
sinceLeakPeriod: boolean; | |||
inNewCodePeriod: boolean; | |||
sonarsourceSecurity: string[]; | |||
sort: string; | |||
statuses: string[]; | |||
@@ -104,7 +104,7 @@ export function parseQuery(query: RawQuery): Query { | |||
sansTop25: parseAsArray(query.sansTop25, parseAsString), | |||
scopes: parseAsArray(query.scopes, parseAsString), | |||
severities: parseAsArray(query.severities, parseAsString), | |||
sinceLeakPeriod: parseAsBoolean(query.sinceLeakPeriod, false), | |||
inNewCodePeriod: parseAsBoolean(query.inNewCodePeriod, false), | |||
sonarsourceSecurity: parseAsArray(query.sonarsourceSecurity, parseAsString), | |||
sort: parseAsSort(query.s), | |||
statuses: parseAsArray(query.statuses, parseAsString), | |||
@@ -148,7 +148,7 @@ export function serializeQuery(query: Query): RawQuery { | |||
sansTop25: serializeStringArray(query.sansTop25), | |||
scopes: serializeStringArray(query.scopes), | |||
severities: serializeStringArray(query.severities), | |||
sinceLeakPeriod: query.sinceLeakPeriod ? 'true' : undefined, | |||
inNewCodePeriod: query.inNewCodePeriod ? 'true' : undefined, | |||
sonarsourceSecurity: serializeStringArray(query.sonarsourceSecurity), | |||
statuses: serializeStringArray(query.statuses), | |||
tags: serializeStringArray(query.tags), |
@@ -54,7 +54,7 @@ export function IssueLabel(props: IssueLabelProps) { | |||
...getBranchLikeQuery(branchLike), | |||
resolved: 'false', | |||
types: type, | |||
sinceLeakPeriod: useDiffMetric ? 'true' : 'false' | |||
inNewCodePeriod: useDiffMetric ? 'true' : 'false' | |||
}; | |||
return ( |
@@ -40,33 +40,33 @@ interface Props { | |||
} | |||
export default class QualityGateCondition extends React.PureComponent<Props> { | |||
getIssuesUrl = (sinceLeakPeriod: boolean, customQuery: Dict<string>) => { | |||
getIssuesUrl = (inNewCodePeriod: boolean, customQuery: Dict<string>) => { | |||
const query: Dict<string | undefined> = { | |||
resolved: 'false', | |||
...getBranchLikeQuery(this.props.branchLike), | |||
...customQuery | |||
}; | |||
if (sinceLeakPeriod) { | |||
Object.assign(query, { sinceLeakPeriod: 'true' }); | |||
if (inNewCodePeriod) { | |||
Object.assign(query, { inNewCodePeriod: 'true' }); | |||
} | |||
return getComponentIssuesUrl(this.props.component.key, query); | |||
}; | |||
getUrlForSecurityHotspot(sinceLeakPeriod: boolean) { | |||
getUrlForSecurityHotspot(inNewCodePeriod: boolean) { | |||
const query: Dict<string | undefined> = { | |||
...getBranchLikeQuery(this.props.branchLike) | |||
}; | |||
if (sinceLeakPeriod) { | |||
Object.assign(query, { sinceLeakPeriod: 'true' }); | |||
if (inNewCodePeriod) { | |||
Object.assign(query, { inNewCodePeriod: 'true' }); | |||
} | |||
return getComponentSecurityHotspotsUrl(this.props.component.key, query); | |||
} | |||
getUrlForCodeSmells(sinceLeakPeriod: boolean) { | |||
return this.getIssuesUrl(sinceLeakPeriod, { types: 'CODE_SMELL' }); | |||
getUrlForCodeSmells(inNewCodePeriod: boolean) { | |||
return this.getIssuesUrl(inNewCodePeriod, { types: 'CODE_SMELL' }); | |||
} | |||
getUrlForBugsOrVulnerabilities(type: string, sinceLeakPeriod: boolean) { | |||
getUrlForBugsOrVulnerabilities(type: string, inNewCodePeriod: boolean) { | |||
const RATING_TO_SEVERITIES_MAPPING = [ | |||
'BLOCKER,CRITICAL,MAJOR,MINOR', | |||
'BLOCKER,CRITICAL,MAJOR', | |||
@@ -77,7 +77,7 @@ export default class QualityGateCondition extends React.PureComponent<Props> { | |||
const { condition } = this.props; | |||
const threshold = condition.level === 'ERROR' ? condition.error : condition.warning; | |||
return this.getIssuesUrl(sinceLeakPeriod, { | |||
return this.getIssuesUrl(inNewCodePeriod, { | |||
types: type, | |||
severities: RATING_TO_SEVERITIES_MAPPING[Number(threshold) - 1] | |||
}); | |||
@@ -118,7 +118,7 @@ export default class QualityGateCondition extends React.PureComponent<Props> { | |||
className={className} | |||
component={component.key} | |||
metric={condition.measure.metric.key} | |||
sinceLeakPeriod={condition.period != null}> | |||
inNewCodePeriod={condition.period != null}> | |||
{children} | |||
</DrilldownLink> | |||
); |
@@ -8,7 +8,7 @@ exports[`should render correctly for bugs 1`] = ` | |||
Object { | |||
"hash": "", | |||
"pathname": "/project/issues", | |||
"search": "?pullRequest=1001&resolved=false&types=BUG&sinceLeakPeriod=false&id=my-project", | |||
"search": "?pullRequest=1001&resolved=false&types=BUG&inNewCodePeriod=false&id=my-project", | |||
} | |||
} | |||
> | |||
@@ -29,7 +29,7 @@ exports[`should render correctly for bugs 2`] = ` | |||
Object { | |||
"hash": "", | |||
"pathname": "/project/issues", | |||
"search": "?pullRequest=1001&resolved=false&types=BUG&sinceLeakPeriod=true&id=my-project", | |||
"search": "?pullRequest=1001&resolved=false&types=BUG&inNewCodePeriod=true&id=my-project", | |||
} | |||
} | |||
> | |||
@@ -50,7 +50,7 @@ exports[`should render correctly for code smells 1`] = ` | |||
Object { | |||
"hash": "", | |||
"pathname": "/project/issues", | |||
"search": "?pullRequest=1001&resolved=false&types=CODE_SMELL&sinceLeakPeriod=false&id=my-project", | |||
"search": "?pullRequest=1001&resolved=false&types=CODE_SMELL&inNewCodePeriod=false&id=my-project", | |||
} | |||
} | |||
> | |||
@@ -71,7 +71,7 @@ exports[`should render correctly for code smells 2`] = ` | |||
Object { | |||
"hash": "", | |||
"pathname": "/project/issues", | |||
"search": "?pullRequest=1001&resolved=false&types=CODE_SMELL&sinceLeakPeriod=true&id=my-project", | |||
"search": "?pullRequest=1001&resolved=false&types=CODE_SMELL&inNewCodePeriod=true&id=my-project", | |||
} | |||
} | |||
> | |||
@@ -92,7 +92,7 @@ exports[`should render correctly for hotspots 1`] = ` | |||
Object { | |||
"hash": "", | |||
"pathname": "/security_hotspots", | |||
"search": "?id=my-project&pullRequest=1001&sinceLeakPeriod=false", | |||
"search": "?id=my-project&pullRequest=1001&inNewCodePeriod=false", | |||
} | |||
} | |||
> | |||
@@ -117,7 +117,7 @@ exports[`should render correctly for hotspots 2`] = ` | |||
Object { | |||
"hash": "", | |||
"pathname": "/security_hotspots", | |||
"search": "?id=my-project&pullRequest=1001&sinceLeakPeriod=true", | |||
"search": "?id=my-project&pullRequest=1001&inNewCodePeriod=true", | |||
} | |||
} | |||
> | |||
@@ -142,7 +142,7 @@ exports[`should render correctly for vulnerabilities 1`] = ` | |||
Object { | |||
"hash": "", | |||
"pathname": "/project/issues", | |||
"search": "?pullRequest=1001&resolved=false&types=VULNERABILITY&sinceLeakPeriod=false&id=my-project", | |||
"search": "?pullRequest=1001&resolved=false&types=VULNERABILITY&inNewCodePeriod=false&id=my-project", | |||
} | |||
} | |||
> | |||
@@ -163,7 +163,7 @@ exports[`should render correctly for vulnerabilities 2`] = ` | |||
Object { | |||
"hash": "", | |||
"pathname": "/project/issues", | |||
"search": "?pullRequest=1001&resolved=false&types=VULNERABILITY&sinceLeakPeriod=true&id=my-project", | |||
"search": "?pullRequest=1001&resolved=false&types=VULNERABILITY&inNewCodePeriod=true&id=my-project", | |||
} | |||
} | |||
> |
@@ -4,8 +4,8 @@ exports[`should render correclty 1`] = ` | |||
<DrilldownLink | |||
className="overview-quality-gate-condition overview-quality-gate-condition-error" | |||
component="abcd-key" | |||
inNewCodePeriod={false} | |||
metric="open_issues" | |||
sinceLeakPeriod={false} | |||
> | |||
<div | |||
className="overview-quality-gate-condition-container display-flex-center" | |||
@@ -187,7 +187,7 @@ exports[`should render correclty 5`] = ` | |||
Object { | |||
"hash": "", | |||
"pathname": "/project/issues", | |||
"search": "?resolved=false&types=BUG&severities=BLOCKER%2CCRITICAL%2CMAJOR%2CMINOR&sinceLeakPeriod=true&id=abcd-key", | |||
"search": "?resolved=false&types=BUG&severities=BLOCKER%2CCRITICAL%2CMAJOR%2CMINOR&inNewCodePeriod=true&id=abcd-key", | |||
} | |||
} | |||
> | |||
@@ -233,7 +233,7 @@ exports[`should render correclty 6`] = ` | |||
Object { | |||
"hash": "", | |||
"pathname": "/project/issues", | |||
"search": "?resolved=false&types=VULNERABILITY&severities=BLOCKER%2CCRITICAL%2CMAJOR%2CMINOR&sinceLeakPeriod=true&id=abcd-key", | |||
"search": "?resolved=false&types=VULNERABILITY&severities=BLOCKER%2CCRITICAL%2CMAJOR%2CMINOR&inNewCodePeriod=true&id=abcd-key", | |||
} | |||
} | |||
> | |||
@@ -279,7 +279,7 @@ exports[`should render correclty 7`] = ` | |||
Object { | |||
"hash": "", | |||
"pathname": "/project/issues", | |||
"search": "?resolved=false&types=CODE_SMELL&sinceLeakPeriod=true&id=abcd-key", | |||
"search": "?resolved=false&types=CODE_SMELL&inNewCodePeriod=true&id=abcd-key", | |||
} | |||
} | |||
> | |||
@@ -371,7 +371,7 @@ exports[`should render correclty 9`] = ` | |||
Object { | |||
"hash": "", | |||
"pathname": "/security_hotspots", | |||
"search": "?id=abcd-key&sinceLeakPeriod=true", | |||
"search": "?id=abcd-key&inNewCodePeriod=true", | |||
} | |||
} | |||
> | |||
@@ -417,7 +417,7 @@ exports[`should work with branch 1`] = ` | |||
Object { | |||
"hash": "", | |||
"pathname": "/project/issues", | |||
"search": "?resolved=false&branch=branch-6.7&types=CODE_SMELL&sinceLeakPeriod=true&id=abcd-key", | |||
"search": "?resolved=false&branch=branch-6.7&types=CODE_SMELL&inNewCodePeriod=true&id=abcd-key", | |||
} | |||
} | |||
> |
@@ -127,7 +127,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> { | |||
!isSameBranchLike(this.props.branchLike, previous.branchLike) || | |||
isLoggedIn(this.props.currentUser) !== isLoggedIn(previous.currentUser) || | |||
this.props.location.query.assignedToMe !== previous.location.query.assignedToMe || | |||
this.props.location.query.sinceLeakPeriod !== previous.location.query.sinceLeakPeriod | |||
this.props.location.query.inNewCodePeriod !== previous.location.query.inNewCodePeriod | |||
) { | |||
this.setState(({ filters }) => ({ | |||
filters: { ...this.constructFiltersFromProps, ...filters } | |||
@@ -228,11 +228,11 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> { | |||
constructFiltersFromProps( | |||
props: Props | |||
): Pick<HotspotFilters, 'assignedToMe' | 'sinceLeakPeriod'> { | |||
): Pick<HotspotFilters, 'assignedToMe' | 'inNewCodePeriod'> { | |||
return { | |||
assignedToMe: props.location.query.assignedToMe === 'true' && isLoggedIn(props.currentUser), | |||
sinceLeakPeriod: | |||
isPullRequest(props.branchLike) || props.location.query.sinceLeakPeriod === 'true' | |||
inNewCodePeriod: | |||
isPullRequest(props.branchLike) || props.location.query.inNewCodePeriod === 'true' | |||
}; | |||
} | |||
@@ -270,7 +270,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> { | |||
const { branchLike, component } = this.props; | |||
const { filters } = this.state; | |||
const reviewedHotspotsMetricKey = filters.sinceLeakPeriod | |||
const reviewedHotspotsMetricKey = filters.inNewCodePeriod | |||
? 'new_security_hotspots_reviewed' | |||
: 'security_hotspots_reviewed'; | |||
@@ -285,7 +285,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> { | |||
return; | |||
} | |||
const measure = measures && measures.length > 0 ? measures[0] : undefined; | |||
const hotspotsReviewedMeasure = filters.sinceLeakPeriod | |||
const hotspotsReviewedMeasure = filters.inNewCodePeriod | |||
? getLeakValue(measure) | |||
: measure?.value; | |||
@@ -345,7 +345,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> { | |||
p: page, | |||
ps: PAGE_SIZE, | |||
status: HotspotStatus.TO_REVIEW, // we're only interested in unresolved hotspots | |||
inNewCodePeriod: filters.sinceLeakPeriod && Boolean(filterByFile), // only add leak period when filtering by file | |||
inNewCodePeriod: filters.inNewCodePeriod && Boolean(filterByFile), // only add leak period when filtering by file | |||
...getBranchLikeQuery(branchLike) | |||
}); | |||
} | |||
@@ -367,7 +367,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> { | |||
status, | |||
resolution, | |||
onlyMine: filters.assignedToMe, | |||
inNewCodePeriod: filters.sinceLeakPeriod, | |||
inNewCodePeriod: filters.inNewCodePeriod, | |||
...getBranchLikeQuery(branchLike) | |||
}); | |||
} | |||
@@ -397,7 +397,7 @@ export class SecurityHotspotsApp extends React.PureComponent<Props, State> { | |||
({ filters }) => ({ filters: { ...filters, ...changes } }), | |||
() => { | |||
this.reloadSecurityHotspotList(); | |||
if (changes.sinceLeakPeriod !== undefined) { | |||
if (changes.inNewCodePeriod !== undefined) { | |||
this.fetchSecurityHotspotsReviewed(); | |||
} | |||
} |
@@ -130,7 +130,7 @@ export default function SecurityHotspotsAppRenderer(props: SecurityHotspotsAppRe | |||
<EmptyHotspotsPage | |||
filtered={ | |||
filters.assignedToMe || | |||
(isBranch(branchLike) && filters.sinceLeakPeriod) || | |||
(isBranch(branchLike) && filters.inNewCodePeriod) || | |||
filters.status !== HotspotStatusFilter.TO_REVIEW | |||
} | |||
filterByFile={Boolean(filterByFile)} |
@@ -201,13 +201,13 @@ it('should load data correctly when hotspot key list is forced', async () => { | |||
}); | |||
it('should set "leakperiod" filter according to context (branchlike & location query)', () => { | |||
expect(shallowRender().state().filters.sinceLeakPeriod).toBe(false); | |||
expect(shallowRender({ branchLike: mockPullRequest() }).state().filters.sinceLeakPeriod).toBe( | |||
expect(shallowRender().state().filters.inNewCodePeriod).toBe(false); | |||
expect(shallowRender({ branchLike: mockPullRequest() }).state().filters.inNewCodePeriod).toBe( | |||
true | |||
); | |||
expect( | |||
shallowRender({ location: mockLocation({ query: { sinceLeakPeriod: 'true' } }) }).state() | |||
.filters.sinceLeakPeriod | |||
shallowRender({ location: mockLocation({ query: { inNewCodePeriod: 'true' } }) }).state() | |||
.filters.inNewCodePeriod | |||
).toBe(true); | |||
}); | |||
@@ -383,7 +383,7 @@ it('should handle leakPeriod filter change', async () => { | |||
expect(getMeasures).toBeCalledTimes(1); | |||
wrapper.instance().handleChangeFilters({ sinceLeakPeriod: true }); | |||
wrapper.instance().handleChangeFilters({ inNewCodePeriod: true }); | |||
expect(getMeasures).toBeCalledTimes(2); | |||
expect(getSecurityHotspots).toBeCalledWith(expect.objectContaining({ inNewCodePeriod: true })); |
@@ -52,7 +52,7 @@ it('should render correctly', () => { | |||
expect(shallowRender()).toMatchSnapshot(); | |||
expect( | |||
shallowRender({ | |||
filters: { assignedToMe: true, sinceLeakPeriod: false, status: HotspotStatusFilter.TO_REVIEW } | |||
filters: { assignedToMe: true, inNewCodePeriod: false, status: HotspotStatusFilter.TO_REVIEW } | |||
}) | |||
).toMatchSnapshot('no hotspots with filters'); | |||
expect(shallowRender({ loading: true })).toMatchSnapshot('loading'); | |||
@@ -139,7 +139,7 @@ function shallowRender(props: Partial<SecurityHotspotsAppRendererProps> = {}) { | |||
component={mockComponent()} | |||
filters={{ | |||
assignedToMe: false, | |||
sinceLeakPeriod: false, | |||
inNewCodePeriod: false, | |||
status: HotspotStatusFilter.TO_REVIEW | |||
}} | |||
hotspots={[]} |
@@ -35,7 +35,7 @@ exports[`should render correctly 1`] = ` | |||
filters={ | |||
Object { | |||
"assignedToMe": false, | |||
"sinceLeakPeriod": false, | |||
"inNewCodePeriod": false, | |||
"status": "TO_REVIEW", | |||
} | |||
} |
@@ -42,7 +42,7 @@ exports[`should render correctly 1`] = ` | |||
filters={ | |||
Object { | |||
"assignedToMe": false, | |||
"sinceLeakPeriod": false, | |||
"inNewCodePeriod": false, | |||
"status": "TO_REVIEW", | |||
} | |||
} | |||
@@ -371,7 +371,7 @@ exports[`should render correctly with hotspots 1`] = ` | |||
filters={ | |||
Object { | |||
"assignedToMe": false, | |||
"sinceLeakPeriod": false, | |||
"inNewCodePeriod": false, | |||
"status": "TO_REVIEW", | |||
} | |||
} | |||
@@ -509,7 +509,7 @@ exports[`should render correctly: loading 1`] = ` | |||
filters={ | |||
Object { | |||
"assignedToMe": false, | |||
"sinceLeakPeriod": false, | |||
"inNewCodePeriod": false, | |||
"status": "TO_REVIEW", | |||
} | |||
} | |||
@@ -575,7 +575,7 @@ exports[`should render correctly: no hotspots with filters 1`] = ` | |||
filters={ | |||
Object { | |||
"assignedToMe": true, | |||
"sinceLeakPeriod": false, | |||
"inNewCodePeriod": false, | |||
"status": "TO_REVIEW", | |||
} | |||
} |
@@ -128,11 +128,11 @@ export function FilterBar(props: FilterBarProps) { | |||
className="input-medium big-spacer-right" | |||
aria-label={translate('hotspot.filters.period')} | |||
onChange={(option: { value: boolean }) => | |||
props.onChangeFilters({ sinceLeakPeriod: option.value }) | |||
props.onChangeFilters({ inNewCodePeriod: option.value }) | |||
} | |||
options={periodOptions} | |||
isSearchable={false} | |||
value={periodOptions.find(period => period.value === filters.sinceLeakPeriod)} | |||
value={periodOptions.find(period => period.value === filters.inNewCodePeriod)} | |||
/> | |||
)} | |||
</div> | |||
@@ -151,7 +151,7 @@ export function FilterBar(props: FilterBarProps) { | |||
<Measure | |||
className="spacer-left huge it__hs-review-percentage" | |||
metricKey={ | |||
onBranch && !filters.sinceLeakPeriod | |||
onBranch && !filters.inNewCodePeriod | |||
? 'security_hotspots_reviewed' | |||
: 'new_security_hotspots_reviewed' | |||
} |
@@ -88,7 +88,7 @@ it('should trigger onChange for leak period', () => { | |||
.props(); | |||
onChange({ value: true }); | |||
expect(onChangeFilters).toBeCalledWith({ sinceLeakPeriod: true }); | |||
expect(onChangeFilters).toBeCalledWith({ inNewCodePeriod: true }); | |||
}); | |||
function shallowRender(props: Partial<FilterBarProps> = {}) { | |||
@@ -98,7 +98,7 @@ function shallowRender(props: Partial<FilterBarProps> = {}) { | |||
currentUser={mockCurrentUser()} | |||
filters={{ | |||
assignedToMe: false, | |||
sinceLeakPeriod: false, | |||
inNewCodePeriod: false, | |||
status: HotspotStatusFilter.TO_REVIEW | |||
}} | |||
isStaticListOfHotspots={false} |
@@ -78,7 +78,7 @@ interface Props { | |||
className?: string; | |||
component: string; | |||
metric: string; | |||
sinceLeakPeriod?: boolean; | |||
inNewCodePeriod?: boolean; | |||
} | |||
export default class DrilldownLink extends React.PureComponent<Props> { | |||
@@ -91,8 +91,8 @@ export default class DrilldownLink extends React.PureComponent<Props> { | |||
...(issueParamsPerMetric[this.props.metric] || { resolved: 'false' }) | |||
}; | |||
if (this.props.sinceLeakPeriod) { | |||
params.sinceLeakPeriod = true; | |||
if (this.props.inNewCodePeriod) { | |||
params.inNewCodePeriod = true; | |||
} | |||
return params; |
@@ -37,10 +37,10 @@ describe('propsToIssueParams', () => { | |||
}); | |||
it(`should render correct params`, () => { | |||
const wrapper = shallowRender({ metric: 'false_positive_issues', sinceLeakPeriod: true }); | |||
const wrapper = shallowRender({ metric: 'false_positive_issues', inNewCodePeriod: true }); | |||
expect(wrapper.instance().propsToIssueParams()).toEqual({ | |||
resolutions: 'FALSE-POSITIVE', | |||
sinceLeakPeriod: true | |||
inNewCodePeriod: true | |||
}); | |||
}); | |||
}); |
@@ -122,7 +122,7 @@ describe('#getComponentSecurityHotspotsUrl', () => { | |||
it('should forward some query parameters', () => { | |||
expect( | |||
getComponentSecurityHotspotsUrl(SIMPLE_COMPONENT_KEY, { | |||
sinceLeakPeriod: 'true', | |||
inNewCodePeriod: 'true', | |||
[SecurityStandard.OWASP_TOP10_2021]: 'a1', | |||
[SecurityStandard.CWE]: 'a1', | |||
[SecurityStandard.OWASP_TOP10]: 'a1', | |||
@@ -135,7 +135,7 @@ describe('#getComponentSecurityHotspotsUrl', () => { | |||
pathname: '/security_hotspots', | |||
search: queryToSearch({ | |||
id: SIMPLE_COMPONENT_KEY, | |||
sinceLeakPeriod: 'true', | |||
inNewCodePeriod: 'true', | |||
[SecurityStandard.OWASP_TOP10_2021]: 'a1', | |||
[SecurityStandard.SONARSOURCE]: 'a1', | |||
[SecurityStandard.OWASP_TOP10]: 'a1', |
@@ -196,14 +196,14 @@ export function getComponentIssuesUrl(componentKey: string, query?: Query): Path | |||
* Generate URL for a component's security hotspot page | |||
*/ | |||
export function getComponentSecurityHotspotsUrl(componentKey: string, query: Query = {}): Path { | |||
const { branch, pullRequest, sinceLeakPeriod, hotspots, assignedToMe, file } = query; | |||
const { branch, pullRequest, inNewCodePeriod, hotspots, assignedToMe, file } = query; | |||
return { | |||
pathname: '/security_hotspots', | |||
search: queryToSearch({ | |||
id: componentKey, | |||
branch, | |||
pullRequest, | |||
sinceLeakPeriod, | |||
inNewCodePeriod, | |||
hotspots, | |||
assignedToMe, | |||
file, |
@@ -54,7 +54,7 @@ export enum HotspotStatusOption { | |||
export interface HotspotFilters { | |||
assignedToMe: boolean; | |||
sinceLeakPeriod: boolean; | |||
inNewCodePeriod: boolean; | |||
status: HotspotStatusFilter; | |||
} | |||
@@ -317,6 +317,7 @@ public class SearchAction implements IssuesWsAction { | |||
action.createParam(PARAM_SINCE_LEAK_PERIOD) | |||
.setDescription("To retrieve issues created since the leak period.<br>" + | |||
"If this parameter is set to a truthy value, createdAfter must not be set and one component uuid or key must be provided.") | |||
.setDeprecatedSince("9.4") | |||
.setBooleanPossibleValues(); | |||
action.createParam(PARAM_IN_NEW_CODE_PERIOD) | |||
.setDescription("To retrieve issues created in the new code period.<br>" + |
@@ -1902,7 +1902,7 @@ | |||
] | |||
}, | |||
{ | |||
"key": "sinceLeakPeriod", | |||
"key": "inNewCodePeriod", | |||
"description": "To retrieve issues created since the leak period.<br>If this parameter is set to a truthy value, createdAfter must not be set and one component id or key must be provided.", | |||
"required": false, | |||
"internal": false, |