Procházet zdrojové kódy

SONAR-16101 Adding new status for security hotspot

tags/9.4.0.54424
Revanshu Paliwal před 2 roky
rodič
revize
71e21dc3c4

+ 4
- 0
server/sonar-web/src/main/js/apps/security-hotspots/components/FilterBar.tsx Zobrazit soubor

@@ -45,6 +45,10 @@ export interface FilterBarProps {

const statusOptions: Array<{ label: string; value: string }> = [
{ value: HotspotStatusFilter.TO_REVIEW, label: translate('hotspot.filters.status.to_review') },
{
value: HotspotStatusFilter.ACKNOWLEDGED,
label: translate('hotspot.filters.status.acknowledged')
},
{ value: HotspotStatusFilter.FIXED, label: translate('hotspot.filters.status.fixed') },
{ value: HotspotStatusFilter.SAFE, label: translate('hotspot.filters.status.safe') }
];

+ 6
- 17
server/sonar-web/src/main/js/apps/security-hotspots/components/StatusUpdateSuccessModal.tsx Zobrazit soubor

@@ -17,7 +17,6 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import classNames from 'classnames';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import { Button, ButtonLink } from '../../../components/controls/buttons';
@@ -48,26 +47,16 @@ export default function StatusUpdateSuccessModal(props: StatusUpdateSuccessModal

return (
<Modal contentLabel={modalTitle}>
<div className="modal-head">
<h2
className={classNames('huge text-normal', {
'text-success': closingHotspots
})}>
{modalTitle}
</h2>
<div className="modal-head huge text-center text-bold">
<p>{translateWithParameters('hotspots.successful_status_change_to_x', statusLabel)}</p>
</div>

<div className="modal-body">
<div className="modal-body text-center big">
<FormattedMessage
id="hotspots.successfully_changed_to_x"
defaultMessage={translate('hotspots.successfully_changed_to_x')}
defaultMessage={translate('hotspots.find_in_status_filter_x')}
values={{
status_label: statusLabel,
status_change: (
<strong>
{translateWithParameters('hotspots.successful_status_change_to_x', statusLabel)}
</strong>
)
status_label: <strong>{statusLabel}</strong>
}}
/>
{closingHotspots && (
@@ -93,7 +82,7 @@ export default function StatusUpdateSuccessModal(props: StatusUpdateSuccessModal
<ButtonLink onClick={props.onSwitchFilterToStatusOfUpdatedHotspot}>
{translateWithParameters('hotspots.see_x_hotspots', statusLabel)}
</ButtonLink>
<Button className="button-primary padded" onClick={props.onClose}>
<Button className="button padded" onClick={props.onClose}>
{translate('hotspots.continue_to_next_hotspot')}
</Button>
</div>

+ 20
- 0
server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/FilterBar-test.tsx.snap Zobrazit soubor

@@ -59,6 +59,10 @@ exports[`should render correctly: anonymous 1`] = `
"label": "hotspot.filters.status.to_review",
"value": "TO_REVIEW",
},
Object {
"label": "hotspot.filters.status.acknowledged",
"value": "ACKNOWLEDGED",
},
Object {
"label": "hotspot.filters.status.fixed",
"value": "FIXED",
@@ -175,6 +179,10 @@ exports[`should render correctly: logged-in 1`] = `
"label": "hotspot.filters.status.to_review",
"value": "TO_REVIEW",
},
Object {
"label": "hotspot.filters.status.acknowledged",
"value": "ACKNOWLEDGED",
},
Object {
"label": "hotspot.filters.status.fixed",
"value": "FIXED",
@@ -291,6 +299,10 @@ exports[`should render correctly: non-project 1`] = `
"label": "hotspot.filters.status.to_review",
"value": "TO_REVIEW",
},
Object {
"label": "hotspot.filters.status.acknowledged",
"value": "ACKNOWLEDGED",
},
Object {
"label": "hotspot.filters.status.fixed",
"value": "FIXED",
@@ -366,6 +378,10 @@ exports[`should render correctly: on Pull request 1`] = `
"label": "hotspot.filters.status.to_review",
"value": "TO_REVIEW",
},
Object {
"label": "hotspot.filters.status.acknowledged",
"value": "ACKNOWLEDGED",
},
Object {
"label": "hotspot.filters.status.fixed",
"value": "FIXED",
@@ -444,6 +460,10 @@ exports[`should render correctly: with hotspots reviewed measure 1`] = `
"label": "hotspot.filters.status.to_review",
"value": "TO_REVIEW",
},
Object {
"label": "hotspot.filters.status.acknowledged",
"value": "ACKNOWLEDGED",
},
Object {
"label": "hotspot.filters.status.fixed",
"value": "FIXED",

+ 18
- 24
server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/StatusUpdateSuccessModal-test.tsx.snap Zobrazit soubor

@@ -5,26 +5,23 @@ exports[`should render correctly: default 1`] = `
contentLabel="hotspots.congratulations"
>
<div
className="modal-head"
className="modal-head huge text-center text-bold"
>
<h2
className="huge text-normal text-success"
>
hotspots.congratulations
</h2>
<p>
hotspots.successful_status_change_to_x.hotspots.status_option.FIXED
</p>
</div>
<div
className="modal-body"
className="modal-body text-center big"
>
<FormattedMessage
defaultMessage="hotspots.successfully_changed_to_x"
defaultMessage="hotspots.find_in_status_filter_x"
id="hotspots.successfully_changed_to_x"
values={
Object {
"status_change": <strong>
hotspots.successful_status_change_to_x.hotspots.status_option.FIXED
"status_label": <strong>
hotspots.status_option.FIXED
</strong>,
"status_label": "hotspots.status_option.FIXED",
}
}
/>
@@ -53,7 +50,7 @@ exports[`should render correctly: default 1`] = `
hotspots.see_x_hotspots.hotspots.status_option.FIXED
</ButtonLink>
<Button
className="button-primary padded"
className="button padded"
onClick={[MockFunction]}
>
hotspots.continue_to_next_hotspot
@@ -67,26 +64,23 @@ exports[`should render correctly: opening hotspots again 1`] = `
contentLabel="hotspots.update.success"
>
<div
className="modal-head"
className="modal-head huge text-center text-bold"
>
<h2
className="huge text-normal"
>
hotspots.update.success
</h2>
<p>
hotspots.successful_status_change_to_x.hotspots.status_option.TO_REVIEW
</p>
</div>
<div
className="modal-body"
className="modal-body text-center big"
>
<FormattedMessage
defaultMessage="hotspots.successfully_changed_to_x"
defaultMessage="hotspots.find_in_status_filter_x"
id="hotspots.successfully_changed_to_x"
values={
Object {
"status_change": <strong>
hotspots.successful_status_change_to_x.hotspots.status_option.TO_REVIEW
"status_label": <strong>
hotspots.status_option.TO_REVIEW
</strong>,
"status_label": "hotspots.status_option.TO_REVIEW",
}
}
/>
@@ -100,7 +94,7 @@ exports[`should render correctly: opening hotspots again 1`] = `
hotspots.see_x_hotspots.hotspots.status_option.TO_REVIEW
</ButtonLink>
<Button
className="button-primary padded"
className="button padded"
onClick={[MockFunction]}
>
hotspots.continue_to_next_hotspot

+ 1
- 0
server/sonar-web/src/main/js/apps/security-hotspots/components/status/StatusSelectionRenderer.tsx Zobrazit soubor

@@ -57,6 +57,7 @@ export default function StatusSelectionRenderer(props: StatusSelectionRendererPr
<div className="abs-width-400">
<div className="big-padded">
{renderOption(HotspotStatusOption.TO_REVIEW)}
{renderOption(HotspotStatusOption.ACKNOWLEDGED)}
{renderOption(HotspotStatusOption.FIXED)}
{renderOption(HotspotStatusOption.SAFE)}
</div>

+ 20
- 0
server/sonar-web/src/main/js/apps/security-hotspots/components/status/__tests__/__snapshots__/StatusSelectionRenderer-test.tsx.snap Zobrazit soubor

@@ -17,6 +17,16 @@ exports[`should render correctly 1`] = `
statusOption="TO_REVIEW"
/>
</Radio>
<Radio
checked={false}
className="big-spacer-bottom"
onCheck={[MockFunction]}
value="ACKNOWLEDGED"
>
<StatusDescription
statusOption="ACKNOWLEDGED"
/>
</Radio>
<Radio
checked={false}
className="big-spacer-bottom"
@@ -87,6 +97,16 @@ exports[`should render correctly: loading 1`] = `
statusOption="TO_REVIEW"
/>
</Radio>
<Radio
checked={false}
className="big-spacer-bottom"
onCheck={[MockFunction]}
value="ACKNOWLEDGED"
>
<StatusDescription
statusOption="ACKNOWLEDGED"
/>
</Radio>
<Radio
checked={false}
className="big-spacer-bottom"

+ 6
- 0
server/sonar-web/src/main/js/apps/security-hotspots/utils.ts Zobrazit soubor

@@ -157,6 +157,7 @@ export function getHotspotReviewHistory(hotspot: Hotspot): ReviewHistoryElement[
const STATUS_AND_RESOLUTION_TO_STATUS_OPTION = {
[HotspotStatus.TO_REVIEW]: HotspotStatusOption.TO_REVIEW,
[HotspotStatus.REVIEWED]: HotspotStatusOption.FIXED,
[HotspotResolution.ACKNOWLEDGED]: HotspotStatusOption.ACKNOWLEDGED,
[HotspotResolution.FIXED]: HotspotStatusOption.FIXED,
[HotspotResolution.SAFE]: HotspotStatusOption.SAFE
};
@@ -172,6 +173,10 @@ export function getStatusOptionFromStatusAndResolution(

const STATUS_OPTION_TO_STATUS_AND_RESOLUTION_MAP = {
[HotspotStatusOption.TO_REVIEW]: { status: HotspotStatus.TO_REVIEW, resolution: undefined },
[HotspotStatusOption.ACKNOWLEDGED]: {
status: HotspotStatus.REVIEWED,
resolution: HotspotResolution.ACKNOWLEDGED
},
[HotspotStatusOption.FIXED]: {
status: HotspotStatus.REVIEWED,
resolution: HotspotResolution.FIXED
@@ -188,6 +193,7 @@ export function getStatusAndResolutionFromStatusOption(statusOption: HotspotStat

const STATUS_OPTION_TO_STATUS_FILTER = {
[HotspotStatusOption.TO_REVIEW]: HotspotStatusFilter.TO_REVIEW,
[HotspotStatusOption.ACKNOWLEDGED]: HotspotStatusFilter.ACKNOWLEDGED,
[HotspotStatusOption.FIXED]: HotspotStatusFilter.FIXED,
[HotspotStatusOption.SAFE]: HotspotStatusFilter.SAFE
};

+ 6
- 3
server/sonar-web/src/main/js/types/security-hotspots.ts Zobrazit soubor

@@ -40,19 +40,22 @@ export enum HotspotStatus {

export enum HotspotResolution {
FIXED = 'FIXED',
SAFE = 'SAFE'
SAFE = 'SAFE',
ACKNOWLEDGED = 'ACKNOWLEDGED'
}

export enum HotspotStatusFilter {
FIXED = 'FIXED',
SAFE = 'SAFE',
TO_REVIEW = 'TO_REVIEW'
TO_REVIEW = 'TO_REVIEW',
ACKNOWLEDGED = 'ACKNOWLEDGED'
}

export enum HotspotStatusOption {
FIXED = 'FIXED',
SAFE = 'SAFE',
TO_REVIEW = 'TO_REVIEW'
TO_REVIEW = 'TO_REVIEW',
ACKNOWLEDGED = 'ACKNOWLEDGED'
}

export interface HotspotFilters {

+ 13
- 9
sonar-core/src/main/resources/org/sonar/l10n/core.properties Zobrazit soubor

@@ -731,6 +731,7 @@ hotspots.no_hotspots_for_keys.description=They have been closed because the code
hotspots.learn_more=Learn more about Security Hotspots
hotspots.list_title={0} Security Hotspots
hotspots.list_title.TO_REVIEW={0} Security Hotspots to review
hotspots.list_title.ACKNOWLEDGED={0} Security Hotspots reviewed as acknowledged
hotspots.list_title.FIXED={0} Security Hotspots reviewed as fixed
hotspots.list_title.SAFE={0} Security Hotspots reviewed as safe
hotspots.risk_exposure=Review priority
@@ -754,32 +755,35 @@ hotspots.status.select_status=Change status
hotspots.status.add_comment=Add a comment (Optional)
hotspots.status.change_status=Change status
hotspots.status_option.TO_REVIEW=To review
hotspots.status_option.TO_REVIEW.description=This Security Hotspot needs to be reviewed to assess whether the code poses a risk.
hotspots.status_option.TO_REVIEW.description=This security hotspot needs to be reviewed to assess whether the code poses a risk.
hotspots.status_option.ACKNOWLEDGED=Acknowledged
hotspots.status_option.ACKNOWLEDGED.description=The code has been reviewed and does pose a risk. A fix is required.
hotspots.status_option.FIXED=Fixed
hotspots.status_option.FIXED.description=The code has been modified to follow recommended secure coding practices.
hotspots.status_option.FIXED.description=The code has been reviewed and modified to follow the recommended secure coding practices.
hotspots.status_option.SAFE=Safe
hotspots.status_option.SAFE.description=The code is not at risk and doesn't need to be modified.
hotspots.status_option.SAFE.description=The code has been reviewed and does not pose a risk. It does not need to be modified.
hotspots.get_permalink=Get Permalink
hotspots.no_associated_lines=Security Hotspot raised on the following file:
hotspots.congratulations=Congratulations!
hotspots.successfully_changed_to_x=The Security Hotspot was {status_change}. You can find it by changing the top filter to display "{status_label}" Security Hotspots.
hotspots.successful_status_change_to_x=successfully changed to "{0}"
hotspots.find_in_status_filter_x= You can find it again by setting status filter to {status_label}.
hotspots.successful_status_change_to_x=The Security Hotspot was successfully changed to {0}.
hotspots.x_done_keep_going={percentage} of the Security Hotspots have been reviewed, keep going!
hotspots.see_x_hotspots=See "{0}" Security Hotspots
hotspots.continue_to_next_hotspot=Continue reviewing next Security Hotspot
hotspots.continue_to_next_hotspot=Continue Reviewing

hotspot.filters.title=Filters
hotspot.filters.assignee.assigned_to_me=Assigned to me
hotspot.filters.assignee.all=All
hotspot.filters.status.to_review=To review
hotspot.filters.status.fixed=Reviewed as fixed
hotspot.filters.status.acknowledged=Acknowledged
hotspot.filters.status.fixed=Fixed
hotspot.filters.period.since_leak_period=New code
hotspot.filters.period.overall=Overall code
hotspot.filters.status.safe=Reviewed as safe
hotspot.filters.status.safe=Safe
hotspot.filters.show_all=Show all hotspots
hotspot.section.activity=Recent activity:

hotspots.reviewed.tooltip=Percentage of Security Hotspots reviewed (fixed or safe) among all non-closed Security Hotspots.
hotspots.reviewed.tooltip=Percentage of Security Hotspots reviewed (Acknowledged, Fixed or Safe) among all non-closed Security Hotspots.
hotspots.review_hotspot=Review Hotspot

hotspots.assign.success=Security Hotspot was successfully assigned to {0}

Načítá se…
Zrušit
Uložit