]> source.dussan.org Git - sonarqube.git/commitdiff
do not display overview pages for developers
authorStas Vilchik <vilchiks@gmail.com>
Wed, 2 Dec 2015 14:23:33 +0000 (15:23 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Wed, 2 Dec 2015 14:25:48 +0000 (15:25 +0100)
server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js
server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb

index 0966f4c940d2e5892a70e8186862ae06a4e04f61..e563055b66b96932740ee2e20662ff3c4b28716e 100644 (file)
@@ -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 (
         <ul className="nav navbar-nav nav-tabs">
-          {this.renderFixedDashboards()}
+          {!this.isDeveloper() && this.renderFixedDashboards()}
+          {this.renderCustomDashboards()}
           {this.renderComponentsLink()}
           {this.renderComponentIssuesLink()}
-          {this.renderCustomDashboards()}
           {this.renderTools()}
           {this.renderAdministration()}
         </ul>
index 87f15af4a01a32287a45700521fe68838b608080..613c4b7ad794c2992ace2ee790f060ccd5ff367a 100644 (file)
@@ -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