]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-12134 New security reports layout including security review rating
authorJeremy Davis <jeremy.davis@sonarsource.com>
Tue, 4 Jun 2019 08:00:16 +0000 (10:00 +0200)
committerSonarTech <sonartech@sonarsource.com>
Fri, 14 Jun 2019 18:21:11 +0000 (20:21 +0200)
server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx
server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMenu-test.tsx.snap

index 624f83a29bd565052b208ae335d9f676bb11be2f..10ab55ba62175912ecc21430b5212387e3600049 100644 (file)
@@ -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>
     );
   }
 
index 5a1ee9c85582da32c5136e19290789a3bff047af..5cb4dadb6b475f09c05b2225b4a460df9ce73916 100644 (file)
@@ -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>