/* * SonarQube * Copyright (C) 2009-2022 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. */ import classNames from 'classnames'; import * as React from 'react'; import { Link } from 'react-router'; import { isMySet } from '../../../../apps/issues/utils'; import Dropdown from '../../../../components/controls/Dropdown'; import DropdownIcon from '../../../../components/icons/DropdownIcon'; import { translate } from '../../../../helpers/l10n'; import { getQualityGatesUrl } from '../../../../helpers/urls'; import { ComponentQualifier } from '../../../../types/component'; import { AppState, CurrentUser, Extension } from '../../../../types/types'; import withAppStateContext from '../../app-state/withAppStateContext'; interface Props { appState: AppState; currentUser: CurrentUser; location: { pathname: string }; } export class GlobalNavMenu extends React.PureComponent { renderProjects() { const active = this.props.location.pathname.startsWith('/projects') && this.props.location.pathname !== '/projects/create'; return (
  • {translate('projects.page')}
  • ); } renderPortfolios() { return (
  • {translate('portfolios.page')}
  • ); } renderIssuesLink() { const active = this.props.location.pathname.startsWith('/issues'); const query = this.props.currentUser.isLoggedIn && isMySet() ? { resolved: 'false', myIssues: 'true' } : { resolved: 'false' }; return (
  • {translate('issues.page')}
  • ); } renderRulesLink() { return (
  • {translate('coding_rules.page')}
  • ); } renderProfilesLink() { return (
  • {translate('quality_profiles.page')}
  • ); } renderQualityGatesLink() { return (
  • {translate('quality_gates.page')}
  • ); } renderAdministrationLink() { if (!this.props.appState.canAdmin) { return null; } return (
  • {translate('layout.settings')}
  • ); } renderGlobalPageLink = ({ key, name }: Extension) => { return (
  • {name}
  • ); }; renderMore() { const { globalPages = [] } = this.props.appState; const withoutPortfolios = globalPages.filter(page => page.key !== 'governance/portfolios'); if (withoutPortfolios.length === 0) { return null; } return ( {withoutPortfolios.map(this.renderGlobalPageLink)}} tagName="li"> {({ onToggleClick, open }) => ( {translate('more')} )} ); } render() { const governanceInstalled = this.props.appState.qualifiers.includes( ComponentQualifier.Portfolio ); return ( ); } } export default withAppStateContext(GlobalNavMenu);