diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2018-06-13 10:34:09 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2018-07-04 09:31:04 +0200 |
commit | b497380a7647d69e6c2cb486faccce34121da08b (patch) | |
tree | da8eb32ecb3d969be7478b9a5007631b9a3eb4e7 /server/sonar-web/src/main | |
parent | 376544a07a2259a0399d7f2d179c3c1c42a443a9 (diff) | |
download | sonarqube-b497380a7647d69e6c2cb486faccce34121da08b.tar.gz sonarqube-b497380a7647d69e6c2cb486faccce34121da08b.zip |
SONAR-10874 New issue transitions for security hotspots
Diffstat (limited to 'server/sonar-web/src/main')
17 files changed, 39 insertions, 11 deletions
diff --git a/server/sonar-web/src/main/js/app/types.ts b/server/sonar-web/src/main/js/app/types.ts index 75ac42d3237..15639fc96c3 100644 --- a/server/sonar-web/src/main/js/app/types.ts +++ b/server/sonar-web/src/main/js/app/types.ts @@ -231,6 +231,7 @@ export interface Issue { fromExternalRule?: boolean; key: string; flows: FlowLocation[][]; + fromHotspot: boolean; line?: number; message: string; organization: string; diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssue-test.tsx b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssue-test.tsx index 639ab681d9b..549928cb0ea 100644 --- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssue-test.tsx +++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/ConciseIssue-test.tsx @@ -40,7 +40,8 @@ const issue = { status: '', type: '', secondaryLocations: [], - flows: [] + flows: [], + fromHotspot: false }; it('should render', () => { diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/__snapshots__/ConciseIssue-test.tsx.snap b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/__snapshots__/ConciseIssue-test.tsx.snap index ee41d9fd306..744a5418ee6 100644 --- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/__snapshots__/ConciseIssue-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/__tests__/__snapshots__/ConciseIssue-test.tsx.snap @@ -14,6 +14,7 @@ exports[`should render 1`] = ` "componentUuid": "", "creationDate": "", "flows": Array [], + "fromHotspot": false, "key": "", "message": "", "organization": "", diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCode-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCode-test.tsx index c9dc513d817..5fd8d5e434a 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCode-test.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineCode-test.tsx @@ -30,6 +30,7 @@ const issueBase: Issue = { creationDate: '', key: '', flows: [], + fromHotspot: false, message: '', organization: '', project: '', diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesIndicator-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesIndicator-test.tsx index b4fd9fc6e70..d63bbf1a2be 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesIndicator-test.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesIndicator-test.tsx @@ -31,6 +31,7 @@ const issueBase: Issue = { creationDate: '', key: '', flows: [], + fromHotspot: false, message: '', organization: '', project: '', diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesList-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesList-test.tsx index 7e9c9ec5bbe..bd621904bb9 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesList-test.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/LineIssuesList-test.tsx @@ -30,6 +30,7 @@ const issueBase: Issue = { creationDate: '', key: '', flows: [], + fromHotspot: false, message: '', organization: '', project: '', diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineCode-test.tsx.snap b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineCode-test.tsx.snap index dc0f5c92200..5546edb6645 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineCode-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineCode-test.tsx.snap @@ -53,6 +53,7 @@ exports[`render code 1`] = ` "componentUuid": "", "creationDate": "", "flows": Array [], + "fromHotspot": false, "key": "issue-1", "message": "", "organization": "", @@ -74,6 +75,7 @@ exports[`render code 1`] = ` "componentUuid": "", "creationDate": "", "flows": Array [], + "fromHotspot": false, "key": "issue-2", "message": "", "organization": "", diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineIssuesList-test.tsx.snap b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineIssuesList-test.tsx.snap index d19a4e96ef0..2fa14dfb1b3 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineIssuesList-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/LineIssuesList-test.tsx.snap @@ -15,6 +15,7 @@ exports[`render issues list 1`] = ` "componentUuid": "", "creationDate": "", "flows": Array [], + "fromHotspot": false, "key": "foo", "message": "", "organization": "", @@ -47,6 +48,7 @@ exports[`render issues list 1`] = ` "componentUuid": "", "creationDate": "", "flows": Array [], + "fromHotspot": false, "key": "bar", "message": "", "organization": "", diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.js b/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.js index f12909c0f9a..10d0d20281b 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.js +++ b/server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.js @@ -89,6 +89,7 @@ export default class IssueActionsBar extends React.PureComponent { const canAssign = issue.actions.includes('assign'); const canComment = issue.actions.includes('comment'); const canSetSeverity = issue.actions.includes('set_severity'); + const canSetType = issue.actions.includes('set_type'); const canSetTags = issue.actions.includes('set_tags'); const hasTransitions = issue.transitions && issue.transitions.length > 0; @@ -97,8 +98,8 @@ export default class IssueActionsBar extends React.PureComponent { <ul className="issue-meta-list"> <li className="issue-meta"> <IssueType - canSetSeverity={canSetSeverity} - isOpen={this.props.currentPopup === 'set-type' && canSetSeverity} + canSetType={canSetType} + isOpen={this.props.currentPopup === 'set-type' && canSetType} issue={issue} setIssueProperty={this.setIssueProperty} togglePopup={this.props.togglePopup} diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueMessage.js b/server/sonar-web/src/main/js/components/issue/components/IssueMessage.js index 5b4e82d413b..6b20d3e9246 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueMessage.js +++ b/server/sonar-web/src/main/js/components/issue/components/IssueMessage.js @@ -27,7 +27,8 @@ import { Button } from '../../ui/buttons'; export default class IssueMessage extends React.PureComponent { /*:: props: { - engine?: string; + engine?: string, + manualVulnerability: boolean, message: string, organization: string, rule: string @@ -63,6 +64,13 @@ export default class IssueMessage extends React.PureComponent { </div> </Tooltip> )} + {this.props.manualVulnerability && ( + <Tooltip overlay={translate('issue.manual_vulnerability.description')}> + <div className="outline-badge badge-tiny-height spacer-left vertical-text-top"> + {translate('issue.manual_vulnerability')} + </div> + </Tooltip> + )} </div> ); } diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.js b/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.js index 1781e6d637d..3e1bea15210 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.js +++ b/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.js @@ -75,6 +75,7 @@ export default function IssueTitleBar(props /*: Props */) { <div className="issue-row"> <IssueMessage engine={issue.externalRuleEngine} + manualVulnerability={issue.fromHotspot && issue.type === 'VULNERABILITY'} message={issue.message} organization={issue.organization} rule={issue.rule} diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueType.js b/server/sonar-web/src/main/js/components/issue/components/IssueType.js index 380e8668a32..909a718cb97 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueType.js +++ b/server/sonar-web/src/main/js/components/issue/components/IssueType.js @@ -30,7 +30,7 @@ import { translate } from '../../../helpers/l10n'; /*:: type Props = { - canSetSeverity: boolean, + canSetType: boolean, isOpen: boolean, issue: Issue, setIssueProperty: (string, string, apiCall: (Object) => Promise<*>, string) => void, @@ -55,12 +55,12 @@ export default class IssueType extends React.PureComponent { render() { const { issue } = this.props; - if (this.props.canSetSeverity) { + if (this.props.canSetType) { return ( <div className="dropdown"> <Toggler onRequestClose={this.handleClose} - open={this.props.isOpen && this.props.canSetSeverity} + open={this.props.isOpen && this.props.canSetType} overlay={<SetTypePopup issue={issue} onSelect={this.setType} />}> <Button className="button-link issue-action issue-action-with-options js-issue-set-type" diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueMessage-test.js b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueMessage-test.js index 785bc2a21f1..0edabcb727f 100644 --- a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueMessage-test.js +++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueMessage-test.js @@ -24,6 +24,7 @@ import IssueMessage from '../IssueMessage'; it('should render with the message and a link to open the rule', () => { const element = shallow( <IssueMessage + manualVulnerability={false} rule="javascript:S1067" message="Reduce the number of conditional operators (4) used in the expression" organization="myorg" diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.js b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.js index 9134a0c1f79..38e804a1cd5 100644 --- a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.js +++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.js @@ -36,7 +36,8 @@ const issue = { rule: 'javascript:S1067', message: 'Reduce the number of conditional operators (4) used in the expression', flows: [], - secondaryLocations: [] + secondaryLocations: [], + fromHotspot: false }; const issueWithLocations = { diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueType-test.js b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueType-test.js index 51132f338ca..78bb502686b 100644 --- a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueType-test.js +++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueType-test.js @@ -29,7 +29,7 @@ const issue = { it('should render without the action when the correct rights are missing', () => { const element = shallow( <IssueType - canSetSeverity={false} + canSetType={false} isOpen={false} issue={issue} setIssueProperty={jest.fn()} @@ -42,7 +42,7 @@ it('should render without the action when the correct rights are missing', () => it('should render with the action', () => { const element = shallow( <IssueType - canSetSeverity={true} + canSetType={true} isOpen={false} issue={issue} setIssueProperty={jest.fn()} @@ -56,7 +56,7 @@ it('should open the popup when the button is clicked', () => { const toggle = jest.fn(); const element = shallow( <IssueType - canSetSeverity={true} + canSetType={true} isOpen={false} issue={issue} setIssueProperty={jest.fn()} diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTitleBar-test.js.snap b/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTitleBar-test.js.snap index ac521d1dfc9..b61379d35ab 100644 --- a/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTitleBar-test.js.snap +++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueTitleBar-test.js.snap @@ -11,6 +11,7 @@ exports[`should render the titlebar correctly 1`] = ` className="issue-row" > <IssueMessage + manualVulnerability={false} message="Reduce the number of conditional operators (4) used in the expression" organization="myorg" rule="javascript:S1067" @@ -31,6 +32,7 @@ exports[`should render the titlebar correctly 1`] = ` Object { "creationDate": "2017-03-01T09:36:01+0100", "flows": Array [], + "fromHotspot": false, "key": "AVsae-CQS-9G3txfbFN2", "line": 25, "message": "Reduce the number of conditional operators (4) used in the expression", @@ -95,6 +97,7 @@ exports[`should render the titlebar with the filter 1`] = ` className="issue-row" > <IssueMessage + manualVulnerability={false} message="Reduce the number of conditional operators (4) used in the expression" organization="myorg" rule="javascript:S1067" @@ -115,6 +118,7 @@ exports[`should render the titlebar with the filter 1`] = ` Object { "creationDate": "2017-03-01T09:36:01+0100", "flows": Array [], + "fromHotspot": false, "key": "AVsae-CQS-9G3txfbFN2", "line": 25, "message": "Reduce the number of conditional operators (4) used in the expression", @@ -177,6 +181,7 @@ exports[`should render the titlebar with the filter 1`] = ` Object { "creationDate": "2017-03-01T09:36:01+0100", "flows": Array [], + "fromHotspot": false, "key": "AVsae-CQS-9G3txfbFN2", "line": 25, "message": "Reduce the number of conditional operators (4) used in the expression", diff --git a/server/sonar-web/src/main/js/components/issue/types.js b/server/sonar-web/src/main/js/components/issue/types.js index 2a5ce7ed3fa..c436d91f1e3 100644 --- a/server/sonar-web/src/main/js/components/issue/types.js +++ b/server/sonar-web/src/main/js/components/issue/types.js @@ -68,6 +68,7 @@ export type Issue = { externalRuleEngine?: string, key: string, flows: Array<Array<FlowLocation>>, + fromHotspot: boolean, line?: number, message: string, organization: string, |