From efa02ff805c451c42821ce885469230d68fbe1e7 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Thu, 10 Mar 2016 12:23:05 +0100 Subject: SONAR-7457 Open view governance page when the Governance plugin is installed --- .../sonar-web/src/main/js/main/nav/component/component-nav-menu.js | 2 +- .../main/webapp/WEB-INF/app/controllers/dashboard_controller.rb | 7 ++++++- .../src/main/webapp/WEB-INF/app/controllers/overview_controller.rb | 4 +++- 3 files changed, 10 insertions(+), 3 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 22fb055a93a..cdbb58d0a0b 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 @@ -69,7 +69,7 @@ export default React.createClass({ isFixedDashboardActive() { const path = window.location.pathname; - return path.indexOf(window.baseUrl + '/overview') === 0; + return path.indexOf(window.baseUrl + '/overview') === 0|| path.indexOf(window.baseUrl + '/governance') === 0; }, isCustomDashboardActive(customDashboard) { 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 613c4b7ad79..e3f7403bb75 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 @@ -38,7 +38,12 @@ class DashboardController < ApplicationController # redirect to the project overview if params[:id] && !params[:did] && !params[:name] && @resource.qualifier != 'DEV' - return redirect_to(url_for({:controller => 'overview'}) + '?id=' + url_encode(params[:id])) + # if governance plugin is installed and we are opening a view + if Project.root_qualifiers.include?('VW') && (@resource.qualifier == 'VW' || @resource.qualifier == 'SVW') + return redirect_to(url_for({:controller => 'governance'}) + '?id=' + url_encode(params[:id])) + else + return redirect_to(url_for({:controller => 'overview'}) + '?id=' + url_encode(params[:id])) + end end load_dashboard() diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/overview_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/overview_controller.rb index 746bc651be8..21428698a00 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/overview_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/overview_controller.rb @@ -23,7 +23,9 @@ class OverviewController < ApplicationController SECTION=Navigation::SECTION_RESOURCE def index - + if Project.root_qualifiers.include?('VW') && (@resource.qualifier == 'VW' || @resource.qualifier == 'SVW') + return redirect_to(url_for({:controller => 'governance'}) + '?id=' + url_encode(params[:id])) + end end end -- cgit v1.2.3