From b381bc38fdf5c082ac0c0f12b45926b10c34ddb1 Mon Sep 17 00:00:00 2001 From: Philippe Perrin Date: Wed, 19 Feb 2020 14:43:27 +0100 Subject: [PATCH] SONAR-12718 Revamp hotspot information layout --- .../src/main/js/app/styles/init/misc.css | 4 + .../components/HotspotList.tsx | 2 +- .../components/HotspotViewer.css | 27 + .../components/HotspotViewerRenderer.tsx | 53 +- .../__snapshots__/HotspotList-test.tsx.snap | 4 + .../HotspotViewerRenderer-test.tsx.snap | 2308 +++++++++-------- .../components/assignee/AssigneeRenderer.tsx | 58 +- .../components/assignee/AssigneeSelection.css | 5 + .../assignee/AssigneeSelectionRenderer.tsx | 5 +- .../AssigneeRenderer-test.tsx.snap | 178 +- .../AssigneeSelectionRenderer-test.tsx.snap | 2 - .../components/status/Status.css | 2 +- .../components/status/Status.tsx | 2 +- .../__snapshots__/Status-test.tsx.snap | 6 +- .../resources/org/sonar/l10n/core.properties | 2 +- 15 files changed, 1408 insertions(+), 1250 deletions(-) create mode 100644 server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewer.css diff --git a/server/sonar-web/src/main/js/app/styles/init/misc.css b/server/sonar-web/src/main/js/app/styles/init/misc.css index 9a8ffd44fd9..d6ec455fff5 100644 --- a/server/sonar-web/src/main/js/app/styles/init/misc.css +++ b/server/sonar-web/src/main/js/app/styles/init/misc.css @@ -440,6 +440,10 @@ th.huge-spacer-right { flex: 1; } +.flex-1-0-auto { + flex: 1 0 auto; +} + .flex-0 { flex: 0 0 auto; } diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotList.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotList.tsx index c2dd2b36d9a..500bb56e0b0 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotList.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotList.tsx @@ -119,7 +119,7 @@ export default class HotspotList extends React.Component { {groupedHotspots.map(riskGroup => (
  • - {translate('hotspots.risk_exposure')} + {translate('hotspots.risk_exposure')}:
    {translate('risk_exposure', riskGroup.risk)}
    diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewer.css b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewer.css new file mode 100644 index 00000000000..737f6afe5bb --- /dev/null +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewer.css @@ -0,0 +1,27 @@ +/* + * SonarQube + * Copyright (C) 2009-2020 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +.hotspot-information { + flex-basis: 320px; +} + +.hotspot-information > div > span { + flex-basis: 100px; +} diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewerRenderer.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewerRenderer.tsx index 9fa56f161e9..0730dd96b48 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewerRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotViewerRenderer.tsx @@ -17,6 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +import * as classNames from 'classnames'; import * as React from 'react'; import { ClipboardButton } from 'sonar-ui-common/components/controls/clipboard'; import LinkIcon from 'sonar-ui-common/components/icons/LinkIcon'; @@ -29,6 +30,7 @@ import { BranchLike } from '../../../types/branch-like'; import { Hotspot } from '../../../types/security-hotspots'; import Assignee from './assignee/Assignee'; import HotspotSnippetContainer from './HotspotSnippetContainer'; +import './HotspotViewer.css'; import HotspotViewerTabs from './HotspotViewerTabs'; import Status from './status/Status'; @@ -56,25 +58,44 @@ export default function HotspotViewerRenderer(props: HotspotViewerRendererProps) {hotspot && (
    -
    -
    - {hotspot.message} - - - {translate('hotspots.get_permalink')} - +
    + {hotspot.message} + + + {translate('hotspots.get_permalink')} + +
    + +
    +
    +
    + {translate('category')} + + {securityCategories[hotspot.rule.securityCategory].title} + +
    +
    + {translate('hotspots.risk_exposure')} +
    + {translate('risk_exposure', hotspot.rule.vulnerabilityProbability)} +
    +
    +
    + {translate('assignee')} +
    + +
    +
    -
    - {translate('category')}: - - {securityCategories[hotspot.rule.securityCategory].title} - +
    +
    -
    - - -
    +
    diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotList-test.tsx.snap b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotList-test.tsx.snap index c7ddd11be7d..897a9ae03e7 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotList-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotList-test.tsx.snap @@ -92,6 +92,7 @@ exports[`should render correctly with hotspots: no pagination 1`] = ` > hotspots.risk_exposure + :
    hotspots.risk_exposure + :
    hotspots.risk_exposure + :
    hotspots.risk_exposure + :
    -
    - - '3' is a magic number. - - - - - hotspots.get_permalink - - -
    -
    + + - category - : - - - SQL injection + hotspots.get_permalink -
    +
    - +
    + + category + + + SQL injection + +
    +
    + + hotspots.risk_exposure + +
    + risk_exposure.HIGH +
    +
    +
    + + assignee + +
    + This a strong message about fixing !

    ", - "key": "squid:S2077", - "name": "That rule", - "riskDescription": "

    This a strong message about risk !

    ", - "securityCategory": "sql-injection", - "vulnerabilityDescription": "

    This a strong message about vulnerability !

    ", - "vulnerabilityProbability": "HIGH", - }, - "status": "REVIEWED", - "textRange": Object { - "endLine": 142, - "endOffset": 83, - "startLine": 142, - "startOffset": 26, - }, - "updateDate": "2013-05-13T17:55:42+0200", - "users": Array [ - Object { + "assignee": "assignee", + "assigneeUser": Object { + "active": true, + "local": true, + "login": "assignee", + "name": "John Doe", + }, + "author": "author", + "authorUser": Object { + "active": true, + "local": true, + "login": "author", + "name": "John Doe", + }, + "canChangeStatus": true, + "changelog": Array [], + "comment": Array [], + "component": Object { + "breadcrumbs": Array [], + "key": "my-project", + "name": "MyProject", + "organization": "foo", + "qualifier": "FIL", + "qualityGate": Object { + "isDefault": true, + "key": "30", + "name": "Sonar way", + }, + "qualityProfiles": Array [ + Object { + "deleted": false, + "key": "my-qp", + "language": "ts", + "name": "Sonar way", + }, + ], + "tags": Array [], + }, + "creationDate": "2013-05-13T17:55:41+0200", + "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", + "line": 142, + "message": "'3' is a magic number.", + "project": Object { + "breadcrumbs": Array [], + "key": "my-project", + "name": "MyProject", + "organization": "foo", + "qualifier": "TRK", + "qualityGate": Object { + "isDefault": true, + "key": "30", + "name": "Sonar way", + }, + "qualityProfiles": Array [ + Object { + "deleted": false, + "key": "my-qp", + "language": "ts", + "name": "Sonar way", + }, + ], + "tags": Array [], + }, + "resolution": "FIXED", + "rule": Object { + "fixRecommendations": "

    This a strong message about fixing !

    ", + "key": "squid:S2077", + "name": "That rule", + "riskDescription": "

    This a strong message about risk !

    ", + "securityCategory": "sql-injection", + "vulnerabilityDescription": "

    This a strong message about vulnerability !

    ", + "vulnerabilityProbability": "HIGH", + }, + "status": "REVIEWED", + "textRange": Object { + "endLine": 142, + "endOffset": 83, + "startLine": 142, + "startOffset": 26, + }, + "updateDate": "2013-05-13T17:55:42+0200", + "users": Array [ + Object { + "active": true, + "local": true, + "login": "assignee", + "name": "John Doe", + }, + Object { + "active": true, + "local": true, + "login": "author", + "name": "John Doe", + }, + ], + } + } + onAssigneeChange={[MockFunction]} + /> +
    +
    +
    +
    + - This a strong message about fixing !

    ", - "key": "squid:S2077", - "name": "That rule", - "riskDescription": "

    This a strong message about risk !

    ", - "securityCategory": "sql-injection", - "vulnerabilityDescription": "

    This a strong message about vulnerability !

    ", - "vulnerabilityProbability": "HIGH", - }, - "status": "REVIEWED", - "textRange": Object { - "endLine": 142, - "endOffset": 83, - "startLine": 142, - "startOffset": 26, - }, - "updateDate": "2013-05-13T17:55:42+0200", - "users": Array [ - Object { - "active": true, - "local": true, - "login": "assignee", - "name": "John Doe", + "qualityProfiles": Array [ + Object { + "deleted": false, + "key": "my-qp", + "language": "ts", + "name": "Sonar way", + }, + ], + "tags": Array [], }, - Object { - "active": true, - "local": true, - "login": "author", - "name": "John Doe", + "resolution": "FIXED", + "rule": Object { + "fixRecommendations": "

    This a strong message about fixing !

    ", + "key": "squid:S2077", + "name": "That rule", + "riskDescription": "

    This a strong message about risk !

    ", + "securityCategory": "sql-injection", + "vulnerabilityDescription": "

    This a strong message about vulnerability !

    ", + "vulnerabilityProbability": "HIGH", }, - ], + "status": "REVIEWED", + "textRange": Object { + "endLine": 142, + "endOffset": 83, + "startLine": 142, + "startOffset": 26, + }, + "updateDate": "2013-05-13T17:55:42+0200", + "users": Array [ + Object { + "active": true, + "local": true, + "login": "assignee", + "name": "John Doe", + }, + Object { + "active": true, + "local": true, + "login": "author", + "name": "John Doe", + }, + ], + } } - } - onStatusChange={[MockFunction]} - /> + onStatusChange={[MockFunction]} + /> +
    -
    - - '3' is a magic number. - - - - - hotspots.get_permalink - - -
    -
    + + - category - : - - - SQL injection + hotspots.get_permalink -
    +
    - +
    + + category + + + SQL injection + +
    +
    + + hotspots.risk_exposure + +
    + risk_exposure.HIGH +
    +
    +
    + + assignee + +
    + This a strong message about fixing !

    ", - "key": "squid:S2077", - "name": "That rule", - "riskDescription": "

    This a strong message about risk !

    ", - "securityCategory": "sql-injection", - "vulnerabilityDescription": "

    This a strong message about vulnerability !

    ", - "vulnerabilityProbability": "HIGH", - }, - "status": "REVIEWED", - "textRange": Object { - "endLine": 142, - "endOffset": 83, - "startLine": 142, - "startOffset": 26, - }, - "updateDate": "2013-05-13T17:55:42+0200", - "users": Array [ - Object { + "assignee": "assignee", + "assigneeUser": Object { + "active": true, + "local": true, + "login": "assignee", + "name": "John Doe", + }, + "author": "author", + "authorUser": Object { + "active": true, + "local": true, + "login": "author", + "name": "John Doe", + }, + "canChangeStatus": true, + "changelog": Array [], + "comment": Array [], + "component": Object { + "breadcrumbs": Array [], + "key": "my-project", + "name": "MyProject", + "organization": "foo", + "qualifier": "FIL", + "qualityGate": Object { + "isDefault": true, + "key": "30", + "name": "Sonar way", + }, + "qualityProfiles": Array [ + Object { + "deleted": false, + "key": "my-qp", + "language": "ts", + "name": "Sonar way", + }, + ], + "tags": Array [], + }, + "creationDate": "2013-05-13T17:55:41+0200", + "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", + "line": 142, + "message": "'3' is a magic number.", + "project": Object { + "breadcrumbs": Array [], + "key": "my-project", + "name": "MyProject", + "organization": "foo", + "qualifier": "TRK", + "qualityGate": Object { + "isDefault": true, + "key": "30", + "name": "Sonar way", + }, + "qualityProfiles": Array [ + Object { + "deleted": false, + "key": "my-qp", + "language": "ts", + "name": "Sonar way", + }, + ], + "tags": Array [], + }, + "resolution": "FIXED", + "rule": Object { + "fixRecommendations": "

    This a strong message about fixing !

    ", + "key": "squid:S2077", + "name": "That rule", + "riskDescription": "

    This a strong message about risk !

    ", + "securityCategory": "sql-injection", + "vulnerabilityDescription": "

    This a strong message about vulnerability !

    ", + "vulnerabilityProbability": "HIGH", + }, + "status": "REVIEWED", + "textRange": Object { + "endLine": 142, + "endOffset": 83, + "startLine": 142, + "startOffset": 26, + }, + "updateDate": "2013-05-13T17:55:42+0200", + "users": Array [ + Object { + "active": true, + "local": true, + "login": "assignee", + "name": "John Doe", + }, + Object { + "active": true, + "local": true, + "login": "author", + "name": "John Doe", + }, + ], + } + } + onAssigneeChange={[MockFunction]} + /> +
    +
    +
    +
    + - This a strong message about fixing !

    ", - "key": "squid:S2077", - "name": "That rule", - "riskDescription": "

    This a strong message about risk !

    ", - "securityCategory": "sql-injection", - "vulnerabilityDescription": "

    This a strong message about vulnerability !

    ", - "vulnerabilityProbability": "HIGH", - }, - "status": "REVIEWED", - "textRange": Object { - "endLine": 142, - "endOffset": 83, - "startLine": 142, - "startOffset": 26, - }, - "updateDate": "2013-05-13T17:55:42+0200", - "users": Array [ - Object { - "active": true, - "local": true, - "login": "assignee", - "name": "John Doe", + "qualityProfiles": Array [ + Object { + "deleted": false, + "key": "my-qp", + "language": "ts", + "name": "Sonar way", + }, + ], + "tags": Array [], }, - Object { - "active": true, - "local": true, - "login": "author", - "name": "John Doe", + "resolution": "FIXED", + "rule": Object { + "fixRecommendations": "

    This a strong message about fixing !

    ", + "key": "squid:S2077", + "name": "That rule", + "riskDescription": "

    This a strong message about risk !

    ", + "securityCategory": "sql-injection", + "vulnerabilityDescription": "

    This a strong message about vulnerability !

    ", + "vulnerabilityProbability": "HIGH", }, - ], + "status": "REVIEWED", + "textRange": Object { + "endLine": 142, + "endOffset": 83, + "startLine": 142, + "startOffset": 26, + }, + "updateDate": "2013-05-13T17:55:42+0200", + "users": Array [ + Object { + "active": true, + "local": true, + "login": "assignee", + "name": "John Doe", + }, + Object { + "active": true, + "local": true, + "login": "author", + "name": "John Doe", + }, + ], + } } - } - onStatusChange={[MockFunction]} - /> + onStatusChange={[MockFunction]} + /> +
    -
    - - '3' is a magic number. - - - - - hotspots.get_permalink - - -
    -
    + + - category - : + hotspots.get_permalink - - SQL injection - -
    +
    - +
    + + category + + + SQL injection + +
    +
    + + hotspots.risk_exposure + +
    + risk_exposure.HIGH +
    +
    +
    + + assignee + +
    + This a strong message about fixing !

    ", - "key": "squid:S2077", - "name": "That rule", - "riskDescription": "

    This a strong message about risk !

    ", - "securityCategory": "sql-injection", - "vulnerabilityDescription": "

    This a strong message about vulnerability !

    ", - "vulnerabilityProbability": "HIGH", - }, - "status": "REVIEWED", - "textRange": Object { - "endLine": 142, - "endOffset": 83, - "startLine": 142, - "startOffset": 26, - }, - "updateDate": "2013-05-13T17:55:42+0200", - "users": Array [ - Object { + "assignee": "assignee", + "assigneeUser": Object { + "active": true, + "local": true, + "login": "assignee_login", + "name": undefined, + }, + "author": "author", + "authorUser": Object { + "active": true, + "local": true, + "login": "author", + "name": "John Doe", + }, + "canChangeStatus": true, + "changelog": Array [], + "comment": Array [], + "component": Object { + "breadcrumbs": Array [], + "key": "my-project", + "name": "MyProject", + "organization": "foo", + "qualifier": "FIL", + "qualityGate": Object { + "isDefault": true, + "key": "30", + "name": "Sonar way", + }, + "qualityProfiles": Array [ + Object { + "deleted": false, + "key": "my-qp", + "language": "ts", + "name": "Sonar way", + }, + ], + "tags": Array [], + }, + "creationDate": "2013-05-13T17:55:41+0200", + "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", + "line": 142, + "message": "'3' is a magic number.", + "project": Object { + "breadcrumbs": Array [], + "key": "my-project", + "name": "MyProject", + "organization": "foo", + "qualifier": "TRK", + "qualityGate": Object { + "isDefault": true, + "key": "30", + "name": "Sonar way", + }, + "qualityProfiles": Array [ + Object { + "deleted": false, + "key": "my-qp", + "language": "ts", + "name": "Sonar way", + }, + ], + "tags": Array [], + }, + "resolution": "FIXED", + "rule": Object { + "fixRecommendations": "

    This a strong message about fixing !

    ", + "key": "squid:S2077", + "name": "That rule", + "riskDescription": "

    This a strong message about risk !

    ", + "securityCategory": "sql-injection", + "vulnerabilityDescription": "

    This a strong message about vulnerability !

    ", + "vulnerabilityProbability": "HIGH", + }, + "status": "REVIEWED", + "textRange": Object { + "endLine": 142, + "endOffset": 83, + "startLine": 142, + "startOffset": 26, + }, + "updateDate": "2013-05-13T17:55:42+0200", + "users": Array [ + Object { + "active": true, + "local": true, + "login": "assignee", + "name": "John Doe", + }, + Object { + "active": true, + "local": true, + "login": "author", + "name": "John Doe", + }, + ], + } + } + onAssigneeChange={[MockFunction]} + /> +
    +
    +
    +
    + - This a strong message about fixing !

    ", - "key": "squid:S2077", - "name": "That rule", - "riskDescription": "

    This a strong message about risk !

    ", - "securityCategory": "sql-injection", - "vulnerabilityDescription": "

    This a strong message about vulnerability !

    ", - "vulnerabilityProbability": "HIGH", - }, - "status": "REVIEWED", - "textRange": Object { - "endLine": 142, - "endOffset": 83, - "startLine": 142, - "startOffset": 26, - }, - "updateDate": "2013-05-13T17:55:42+0200", - "users": Array [ - Object { - "active": true, - "local": true, - "login": "assignee", - "name": "John Doe", + "qualityProfiles": Array [ + Object { + "deleted": false, + "key": "my-qp", + "language": "ts", + "name": "Sonar way", + }, + ], + "tags": Array [], }, - Object { - "active": true, - "local": true, - "login": "author", - "name": "John Doe", + "resolution": "FIXED", + "rule": Object { + "fixRecommendations": "

    This a strong message about fixing !

    ", + "key": "squid:S2077", + "name": "That rule", + "riskDescription": "

    This a strong message about risk !

    ", + "securityCategory": "sql-injection", + "vulnerabilityDescription": "

    This a strong message about vulnerability !

    ", + "vulnerabilityProbability": "HIGH", }, - ], + "status": "REVIEWED", + "textRange": Object { + "endLine": 142, + "endOffset": 83, + "startLine": 142, + "startOffset": 26, + }, + "updateDate": "2013-05-13T17:55:42+0200", + "users": Array [ + Object { + "active": true, + "local": true, + "login": "assignee", + "name": "John Doe", + }, + Object { + "active": true, + "local": true, + "login": "author", + "name": "John Doe", + }, + ], + } } - } - onStatusChange={[MockFunction]} - /> + onStatusChange={[MockFunction]} + /> +
    -
    - - '3' is a magic number. - - - - - hotspots.get_permalink - - -
    -
    + + - category - : - - - SQL injection + hotspots.get_permalink -
    +
    - +
    + + category + + + SQL injection + +
    +
    + + hotspots.risk_exposure + +
    + risk_exposure.HIGH +
    +
    +
    + + assignee + +
    + This a strong message about fixing !

    ", - "key": "squid:S2077", - "name": "That rule", - "riskDescription": "

    This a strong message about risk !

    ", - "securityCategory": "sql-injection", - "vulnerabilityDescription": "

    This a strong message about vulnerability !

    ", - "vulnerabilityProbability": "HIGH", - }, - "status": "REVIEWED", - "textRange": Object { - "endLine": 142, - "endOffset": 83, - "startLine": 142, - "startOffset": 26, - }, - "updateDate": "2013-05-13T17:55:42+0200", - "users": Array [ - Object { - "active": true, + "assignee": "assignee", + "assigneeUser": Object { + "active": false, + "local": true, + "login": "john.doe", + "name": "John Doe", + }, + "author": "author", + "authorUser": Object { + "active": true, + "local": true, + "login": "author", + "name": "John Doe", + }, + "canChangeStatus": true, + "changelog": Array [], + "comment": Array [], + "component": Object { + "breadcrumbs": Array [], + "key": "my-project", + "name": "MyProject", + "organization": "foo", + "qualifier": "FIL", + "qualityGate": Object { + "isDefault": true, + "key": "30", + "name": "Sonar way", + }, + "qualityProfiles": Array [ + Object { + "deleted": false, + "key": "my-qp", + "language": "ts", + "name": "Sonar way", + }, + ], + "tags": Array [], + }, + "creationDate": "2013-05-13T17:55:41+0200", + "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", + "line": 142, + "message": "'3' is a magic number.", + "project": Object { + "breadcrumbs": Array [], + "key": "my-project", + "name": "MyProject", + "organization": "foo", + "qualifier": "TRK", + "qualityGate": Object { + "isDefault": true, + "key": "30", + "name": "Sonar way", + }, + "qualityProfiles": Array [ + Object { + "deleted": false, + "key": "my-qp", + "language": "ts", + "name": "Sonar way", + }, + ], + "tags": Array [], + }, + "resolution": "FIXED", + "rule": Object { + "fixRecommendations": "

    This a strong message about fixing !

    ", + "key": "squid:S2077", + "name": "That rule", + "riskDescription": "

    This a strong message about risk !

    ", + "securityCategory": "sql-injection", + "vulnerabilityDescription": "

    This a strong message about vulnerability !

    ", + "vulnerabilityProbability": "HIGH", + }, + "status": "REVIEWED", + "textRange": Object { + "endLine": 142, + "endOffset": 83, + "startLine": 142, + "startOffset": 26, + }, + "updateDate": "2013-05-13T17:55:42+0200", + "users": Array [ + Object { + "active": true, + "local": true, + "login": "assignee", + "name": "John Doe", + }, + Object { + "active": true, + "local": true, + "login": "author", + "name": "John Doe", + }, + ], + } + } + onAssigneeChange={[MockFunction]} + /> +
    +
    +
    +
    + - This a strong message about fixing !

    ", - "key": "squid:S2077", - "name": "That rule", - "riskDescription": "

    This a strong message about risk !

    ", - "securityCategory": "sql-injection", - "vulnerabilityDescription": "

    This a strong message about vulnerability !

    ", - "vulnerabilityProbability": "HIGH", - }, - "status": "REVIEWED", - "textRange": Object { - "endLine": 142, - "endOffset": 83, - "startLine": 142, - "startOffset": 26, - }, - "updateDate": "2013-05-13T17:55:42+0200", - "users": Array [ - Object { - "active": true, - "local": true, - "login": "assignee", - "name": "John Doe", + "qualityProfiles": Array [ + Object { + "deleted": false, + "key": "my-qp", + "language": "ts", + "name": "Sonar way", + }, + ], + "tags": Array [], }, - Object { - "active": true, - "local": true, - "login": "author", - "name": "John Doe", + "resolution": "FIXED", + "rule": Object { + "fixRecommendations": "

    This a strong message about fixing !

    ", + "key": "squid:S2077", + "name": "That rule", + "riskDescription": "

    This a strong message about risk !

    ", + "securityCategory": "sql-injection", + "vulnerabilityDescription": "

    This a strong message about vulnerability !

    ", + "vulnerabilityProbability": "HIGH", }, - ], + "status": "REVIEWED", + "textRange": Object { + "endLine": 142, + "endOffset": 83, + "startLine": 142, + "startOffset": 26, + }, + "updateDate": "2013-05-13T17:55:42+0200", + "users": Array [ + Object { + "active": true, + "local": true, + "login": "assignee", + "name": "John Doe", + }, + Object { + "active": true, + "local": true, + "login": "author", + "name": "John Doe", + }, + ], + } } - } - onStatusChange={[MockFunction]} - /> + onStatusChange={[MockFunction]} + /> +
    -
    - - '3' is a magic number. - - - - - hotspots.get_permalink - - -
    -
    + + - category - : - - - SQL injection + hotspots.get_permalink -
    +
    - +
    + + category + + + SQL injection + +
    +
    + + hotspots.risk_exposure + +
    + risk_exposure.HIGH +
    +
    +
    + + assignee + +
    + This a strong message about fixing !

    ", - "key": "squid:S2077", - "name": "That rule", - "riskDescription": "

    This a strong message about risk !

    ", - "securityCategory": "sql-injection", - "vulnerabilityDescription": "

    This a strong message about vulnerability !

    ", - "vulnerabilityProbability": "HIGH", - }, - "status": "REVIEWED", - "textRange": Object { - "endLine": 142, - "endOffset": 83, - "startLine": 142, - "startOffset": 26, - }, - "updateDate": "2013-05-13T17:55:42+0200", - "users": Array [ - Object { + "assignee": undefined, + "assigneeUser": Object { + "active": true, + "local": true, + "login": "assignee", + "name": "John Doe", + }, + "author": "author", + "authorUser": Object { + "active": true, + "local": true, + "login": "author", + "name": "John Doe", + }, + "canChangeStatus": true, + "changelog": Array [], + "comment": Array [], + "component": Object { + "breadcrumbs": Array [], + "key": "my-project", + "name": "MyProject", + "organization": "foo", + "qualifier": "FIL", + "qualityGate": Object { + "isDefault": true, + "key": "30", + "name": "Sonar way", + }, + "qualityProfiles": Array [ + Object { + "deleted": false, + "key": "my-qp", + "language": "ts", + "name": "Sonar way", + }, + ], + "tags": Array [], + }, + "creationDate": "2013-05-13T17:55:41+0200", + "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123", + "line": 142, + "message": "'3' is a magic number.", + "project": Object { + "breadcrumbs": Array [], + "key": "my-project", + "name": "MyProject", + "organization": "foo", + "qualifier": "TRK", + "qualityGate": Object { + "isDefault": true, + "key": "30", + "name": "Sonar way", + }, + "qualityProfiles": Array [ + Object { + "deleted": false, + "key": "my-qp", + "language": "ts", + "name": "Sonar way", + }, + ], + "tags": Array [], + }, + "resolution": "FIXED", + "rule": Object { + "fixRecommendations": "

    This a strong message about fixing !

    ", + "key": "squid:S2077", + "name": "That rule", + "riskDescription": "

    This a strong message about risk !

    ", + "securityCategory": "sql-injection", + "vulnerabilityDescription": "

    This a strong message about vulnerability !

    ", + "vulnerabilityProbability": "HIGH", + }, + "status": "REVIEWED", + "textRange": Object { + "endLine": 142, + "endOffset": 83, + "startLine": 142, + "startOffset": 26, + }, + "updateDate": "2013-05-13T17:55:42+0200", + "users": Array [ + Object { + "active": true, + "local": true, + "login": "assignee", + "name": "John Doe", + }, + Object { + "active": true, + "local": true, + "login": "author", + "name": "John Doe", + }, + ], + } + } + onAssigneeChange={[MockFunction]} + /> +
    +
    +
    +
    + - This a strong message about fixing !

    ", - "key": "squid:S2077", - "name": "That rule", - "riskDescription": "

    This a strong message about risk !

    ", - "securityCategory": "sql-injection", - "vulnerabilityDescription": "

    This a strong message about vulnerability !

    ", - "vulnerabilityProbability": "HIGH", - }, - "status": "REVIEWED", - "textRange": Object { - "endLine": 142, - "endOffset": 83, - "startLine": 142, - "startOffset": 26, - }, - "updateDate": "2013-05-13T17:55:42+0200", - "users": Array [ - Object { - "active": true, - "local": true, - "login": "assignee", - "name": "John Doe", + "qualityProfiles": Array [ + Object { + "deleted": false, + "key": "my-qp", + "language": "ts", + "name": "Sonar way", + }, + ], + "tags": Array [], }, - Object { - "active": true, - "local": true, - "login": "author", - "name": "John Doe", + "resolution": "FIXED", + "rule": Object { + "fixRecommendations": "

    This a strong message about fixing !

    ", + "key": "squid:S2077", + "name": "That rule", + "riskDescription": "

    This a strong message about risk !

    ", + "securityCategory": "sql-injection", + "vulnerabilityDescription": "

    This a strong message about vulnerability !

    ", + "vulnerabilityProbability": "HIGH", }, - ], + "status": "REVIEWED", + "textRange": Object { + "endLine": 142, + "endOffset": 83, + "startLine": 142, + "startOffset": 26, + }, + "updateDate": "2013-05-13T17:55:42+0200", + "users": Array [ + Object { + "active": true, + "local": true, + "login": "assignee", + "name": "John Doe", + }, + Object { + "active": true, + "local": true, + "login": "author", + "name": "John Doe", + }, + ], + } } - } - onStatusChange={[MockFunction]} - /> + onStatusChange={[MockFunction]} + /> +
    - {translate('assignee')}: - - - - {!editing && ( -
    - - {assignee && - (assignee.active - ? assignee.name ?? assignee.login - : translateWithParameters('user.x_deleted', assignee.name ?? assignee.login))} - {!assignee && translate('unassigned')} - - {loggedInUser && canEdit && ( - - )} -
    + + {!editing && ( +
    + + {assignee && + (assignee.active + ? assignee.name ?? assignee.login + : translateWithParameters('user.x_deleted', assignee.name ?? assignee.login))} + {!assignee && translate('unassigned')} + + {loggedInUser && canEdit && ( + )} +
    + )} - {loggedInUser && editing && ( - - - - - - )} -
    -
    -
    + {loggedInUser && editing && ( + + + + + + )} + ); } diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/AssigneeSelection.css b/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/AssigneeSelection.css index 7a5c24ebf0e..b24ade81378 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/AssigneeSelection.css +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/AssigneeSelection.css @@ -17,6 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +.hotspot-assignee-search-results { + min-width: 300px; +} + .hotspot-assignee-search-results li { cursor: pointer; } diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/AssigneeSelectionRenderer.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/AssigneeSelectionRenderer.tsx index 23fedd178a9..4d0f0fcf904 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/AssigneeSelectionRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/AssigneeSelectionRenderer.tsx @@ -56,10 +56,7 @@ export default function AssigneeSelectionRenderer(props: HotspotAssigneeSelectRe {!loading && open && (
    - + {suggestedUsers && suggestedUsers.length > 0 ? (
      {suggestedUsers.map(suggestion => ( diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/__snapshots__/AssigneeRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/__snapshots__/AssigneeRenderer-test.tsx.snap index 2b45d1fb5f4..9894738f7cc 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/__snapshots__/AssigneeRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/__snapshots__/AssigneeRenderer-test.tsx.snap @@ -1,135 +1,93 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`should render correctly: editing 1`] = ` -
      - - assignee - : - - - - - - - - - - -
      + + + + `; exports[`should render correctly: not editing 1`] = ` -
      - - assignee - : - - - -
      - - user.x_deleted.Skywalker - - -
      -
      -
      -
      + user.x_deleted.Skywalker + + +
    + `; exports[`should render correctly: with active assignee 1`] = ` -
    - - assignee - : - - - -
    - - John Doe - - -
    -
    -
    -
    + John Doe + + +
    +
    `; exports[`should render correctly: without current assignee 1`] = ` -
    - - assignee - : - - - -
    - - unassigned - - -
    -
    -
    -
    + unassigned + + +
    + `; diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/__snapshots__/AssigneeSelectionRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/__snapshots__/AssigneeSelectionRenderer-test.tsx.snap index 004aedfae6c..310ea10da4a 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/__snapshots__/AssigneeSelectionRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/assignee/__tests__/__snapshots__/AssigneeSelectionRenderer-test.tsx.snap @@ -50,7 +50,6 @@ exports[`should render correctly: open 1`] = ` className="position-relative" > @@ -80,7 +79,6 @@ exports[`should render correctly: open with results 1`] = ` className="position-relative" > diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/status/Status.css b/server/sonar-web/src/main/js/apps/security-hotspots/components/status/Status.css index b48cb0745fc..8e514f4a12b 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/status/Status.css +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/status/Status.css @@ -19,7 +19,7 @@ */ #status-trigger, -.popup { +#status-trigger + .popup { width: 400px; box-sizing: border-box; } diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/status/Status.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/status/Status.tsx index 006b7f58932..097bda68eee 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/status/Status.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/status/Status.tsx @@ -92,7 +92,7 @@ export function Status(props: StatusProps) { ); return ( -
    +
    {readonly ? ( {actionableTrigger} diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/status/__tests__/__snapshots__/Status-test.tsx.snap b/server/sonar-web/src/main/js/apps/security-hotspots/components/status/__tests__/__snapshots__/Status-test.tsx.snap index 36c5ed7da90..7438207a07c 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/status/__tests__/__snapshots__/Status-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/status/__tests__/__snapshots__/Status-test.tsx.snap @@ -2,7 +2,7 @@ exports[`should render correctly: closed 1`] = `