From: Stas Vilchik Date: Wed, 2 Dec 2015 14:23:33 +0000 (+0100) Subject: do not display overview pages for developers X-Git-Tag: 5.3-RC1~102 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=334f0603c306a73bea460e1f04bf8a2b013428ab;p=sonarqube.git do not display overview pages for developers --- 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 0966f4c940d..e563055b66b 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 @@ -20,8 +20,6 @@ const FIXED_DASHBOARDS = [ { link: '/size', name: 'overview.domain.size' } ]; -const CUSTOM_DASHBOARDS_LIMIT = 1; - const SETTINGS_URLS = [ '/project/settings', '/project/profile', '/project/qualitygate', '/manual_measures/index', '/action_plans/index', '/project/links', '/project_roles/index', '/project/history', '/project/key', @@ -32,6 +30,11 @@ const SETTINGS_URLS = [ export default React.createClass({ mixins: [LinksMixin], + isDeveloper() { + const qualifier = _.last(this.props.component.breadcrumbs).qualifier; + return qualifier === 'DEV'; + }, + periodParameter() { let params = qs.parse(window.location.search.substr(1)); return params.period ? `&period=${params.period}` : ''; @@ -55,7 +58,14 @@ export default React.createClass({ isCustomDashboardsActive () { let dashboards = this.props.component.dashboards; - return _.any(dashboards, this.isCustomDashboardActive) || this.isDashboardManagementActive(); + return _.any(dashboards, this.isCustomDashboardActive) || + this.isDashboardManagementActive() || + this.isDefaultDeveloperDashboardActive(); + }, + + isDefaultDeveloperDashboardActive() { + let path = window.location.pathname; + return this.isDeveloper() && path.indexOf(`${window.baseUrl}/dashboard`) === 0; }, isDashboardManagementActive () { @@ -279,10 +289,10 @@ export default React.createClass({ render() { return ( diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb index 87f15af4a01..613c4b7ad79 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb @@ -37,7 +37,7 @@ class DashboardController < ApplicationController end # redirect to the project overview - if params[:id] && !params[:did] && !params[:name] + if params[:id] && !params[:did] && !params[:name] && @resource.qualifier != 'DEV' return redirect_to(url_for({:controller => 'overview'}) + '?id=' + url_encode(params[:id])) end