diff options
author | Jeremy Davis <jeremy.davis@sonarsource.com> | 2019-06-04 10:00:16 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2019-06-14 20:21:11 +0200 |
commit | a2cb47b8ae2d297d33bd6c151ddad83c45973105 (patch) | |
tree | 3f4b692a40c14226a0d5c4831f3ba2592ee940b5 | |
parent | 7fe27c2a8ada66ad0755ce09c335b9b11099c545 (diff) | |
download | sonarqube-a2cb47b8ae2d297d33bd6c151ddad83c45973105.tar.gz sonarqube-a2cb47b8ae2d297d33bd6c151ddad83c45973105.zip |
SONAR-12134 New security reports layout including security review rating
2 files changed, 13 insertions, 119 deletions
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx index 624f83a29bd..10ab55ba621 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx @@ -21,6 +21,8 @@ import * as React from 'react'; import { Link } from 'react-router'; import * as classNames from 'classnames'; import Dropdown from '../../../../components/controls/Dropdown'; +import { withAppState } from '../../../../components/hoc/withAppState'; +import DropdownIcon from '../../../../components/icons-components/DropdownIcon'; import NavBarTabs from '../../../../components/nav/NavBarTabs'; import { isShortLivingBranch, @@ -29,8 +31,6 @@ import { getBranchLikeQuery } from '../../../../helpers/branches'; import { translate } from '../../../../helpers/l10n'; -import DropdownIcon from '../../../../components/icons-components/DropdownIcon'; -import { withAppState } from '../../../../components/hoc/withAppState'; import { isSonarCloud } from '../../../../helpers/system'; const SETTINGS_URLS = [ @@ -154,43 +154,6 @@ export class ComponentNavMenu extends React.PureComponent<Props> { ); } - renderSecurityReportsLink() { - return ( - <ul className="menu"> - <li> - <Link - activeClassName="active" - to={{ - pathname: '/project/extension/securityreport/sonarsource_security', - query: this.getQuery() - }}> - {translate('securityreport.sonarsourceSecurity.page')} - </Link> - </li> - <li> - <Link - activeClassName="active" - to={{ - pathname: '/project/extension/securityreport/owasp_top_10', - query: this.getQuery() - }}> - {translate('securityreport.owaspTop10.page')} - </Link> - </li> - <li> - <Link - activeClassName="active" - to={{ - pathname: '/project/extension/securityreport/sans_top_25', - query: this.getQuery() - }}> - {translate('securityreport.sansTop25.page')} - </Link> - </li> - </ul> - ); - } - renderSecurityReports() { const { branchLike, component } = this.props; const { extensions = [] } = component; @@ -207,22 +170,17 @@ export class ComponentNavMenu extends React.PureComponent<Props> { return null; } - const { location = { pathname: '' } } = this.props; - const isActive = location.pathname.startsWith('/project/extension/securityreport'); return ( - <Dropdown data-test="security" overlay={this.renderSecurityReportsLink()} tagName="li"> - {({ onToggleClick, open }) => ( - <a - aria-expanded={open} - aria-haspopup="true" - className={classNames('dropdown-toggle', { active: isActive || open })} - href="#" - onClick={onToggleClick}> - {translate('layout.security_reports')} - <DropdownIcon className="little-spacer-left" /> - </a> - )} - </Dropdown> + <li> + <Link + activeClassName="active" + to={{ + pathname: '/project/extension/securityreport/securityreport', + query: this.getQuery() + }}> + {translate('layout.security_reports')} + </Link> + </li> ); } diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMenu-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMenu-test.tsx.snap index 5a1ee9c8558..5cb4dadb6b4 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMenu-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMenu-test.tsx.snap @@ -33,71 +33,7 @@ exports[`should render correctly for security extensions 1`] = ` </Dropdown> `; -exports[`should render correctly for security extensions 2`] = ` -<Dropdown - data-test="security" - overlay={ - <ul - className="menu" - > - <li> - <Link - activeClassName="active" - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/extension/securityreport/sonarsource_security", - "query": Object { - "id": "foo", - }, - } - } - > - securityreport.sonarsourceSecurity.page - </Link> - </li> - <li> - <Link - activeClassName="active" - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/extension/securityreport/owasp_top_10", - "query": Object { - "id": "foo", - }, - } - } - > - securityreport.owaspTop10.page - </Link> - </li> - <li> - <Link - activeClassName="active" - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/extension/securityreport/sans_top_25", - "query": Object { - "id": "foo", - }, - } - } - > - securityreport.sansTop25.page - </Link> - </li> - </ul> - } - tagName="li" -> - <Component /> -</Dropdown> -`; +exports[`should render correctly for security extensions 2`] = `null`; exports[`should work for all qualifiers 1`] = ` <NavBarTabs> |