diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-12-01 17:36:03 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-12-01 17:36:10 +0100 |
commit | 6d7a38d5a0c33e2fe816f6cf085871b194616fa7 (patch) | |
tree | 70573b56d999f68be5f2c1533629744a1b5d82a0 /server/sonar-web/src/main/js | |
parent | a70899910e2448abda0ec8c76aff2000318dce49 (diff) | |
download | sonarqube-6d7a38d5a0c33e2fe816f6cf085871b194616fa7.tar.gz sonarqube-6d7a38d5a0c33e2fe816f6cf085871b194616fa7.zip |
SONAR-7059 improve project navigation
Diffstat (limited to 'server/sonar-web/src/main/js')
-rw-r--r-- | server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js b/server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js index 6c8b143ba69..0966f4c940d 100644 --- a/server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js +++ b/server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js @@ -53,9 +53,9 @@ export default React.createClass({ return path.indexOf(`${window.baseUrl}/dashboard`) === 0 && params['did'] === `${customDashboard.key}`; }, - isMoreCustomDashboardsActive () { - let dashboards = _.rest(this.props.component.dashboards, CUSTOM_DASHBOARDS_LIMIT); - return _.any(dashboards, this.isCustomDashboardActive); + isCustomDashboardsActive () { + let dashboards = this.props.component.dashboards; + return _.any(dashboards, this.isCustomDashboardActive) || this.isDashboardManagementActive(); }, isDashboardManagementActive () { @@ -75,11 +75,6 @@ export default React.createClass({ }); }, - renderCustomDashboards() { - let dashboards = _.first(this.props.component.dashboards, CUSTOM_DASHBOARDS_LIMIT); - return dashboards.map(this.renderCustomDashboard); - }, - renderCustomDashboard(customDashboard) { let key = 'custom-dashboard-' + customDashboard.key; let url = getComponentDashboardUrl(this.props.component.key, customDashboard.key, this.getPeriod()); @@ -90,19 +85,20 @@ export default React.createClass({ </li>; }, - renderMoreCustomDashboards() { - if (this.props.component.dashboards.length <= CUSTOM_DASHBOARDS_LIMIT) { - return null; - } - let dashboards = _.rest(this.props.component.dashboards, CUSTOM_DASHBOARDS_LIMIT) - .map(this.renderCustomDashboard); - let className = classNames('dropdown', { active: this.isMoreCustomDashboardsActive() }); + renderCustomDashboards() { + let dashboards = this.props.component.dashboards.map(this.renderCustomDashboard); + let className = classNames('dropdown', { active: this.isCustomDashboardsActive() }); + const managementLink = this.renderDashboardsManagementLink(); return <li className={className}> <a className="dropdown-toggle" data-toggle="dropdown" href="#"> - More + {window.t('layout.dashboards')} <i className="icon-dropdown"/> </a> - <ul className="dropdown-menu">{dashboards}</ul> + <ul className="dropdown-menu"> + {dashboards} + {managementLink && <li className="divider"/>} + {managementLink} + </ul> </li>; }, @@ -286,10 +282,9 @@ export default React.createClass({ {this.renderFixedDashboards()} {this.renderComponentsLink()} {this.renderComponentIssuesLink()} - {this.renderAdministration()} - {this.renderTools()} {this.renderCustomDashboards()} - {this.renderMoreCustomDashboards()} + {this.renderTools()} + {this.renderAdministration()} </ul> ); } |