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,
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 = [
);
}
- 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;
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>
);
}
</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>