diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-07-22 17:36:18 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2016-07-25 13:47:25 +0200 |
commit | bf0b1f78b38bdbff570232764135698e9e290e59 (patch) | |
tree | 2e1eaa29a678711b260287d3039d4b7dd16a54f0 /server/sonar-web/src | |
parent | 04a8b0f54078465e416fa82418600a719da2bc59 (diff) | |
download | sonarqube-bf0b1f78b38bdbff570232764135698e9e290e59.tar.gz sonarqube-bf0b1f78b38bdbff570232764135698e9e290e59.zip |
SONAR-7934 Reuse /dashboard url for project overview
Diffstat (limited to 'server/sonar-web/src')
-rw-r--r-- | server/sonar-web/src/main/js/helpers/urls.js | 26 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js | 10 | ||||
-rw-r--r-- | server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb | 3 | ||||
-rw-r--r-- | server/sonar-web/src/main/webapp/WEB-INF/app/controllers/overview_controller.rb | 4 | ||||
-rw-r--r-- | server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/overview.html.erb (renamed from server/sonar-web/src/main/webapp/WEB-INF/app/views/overview/index.html.erb) | 0 |
5 files changed, 8 insertions, 35 deletions
diff --git a/server/sonar-web/src/main/js/helpers/urls.js b/server/sonar-web/src/main/js/helpers/urls.js index 19bd44e6add..561413c59d9 100644 --- a/server/sonar-web/src/main/js/helpers/urls.js +++ b/server/sonar-web/src/main/js/helpers/urls.js @@ -50,32 +50,6 @@ export function getComponentDrilldownUrl (componentKey, metric) { } /** - * Generate URL for a component's dashboard - * @param {string} componentKey - * @param {string} dashboardKey - * @param {string} [period] - * @returns {string} - */ -export function getComponentDashboardUrl (componentKey, dashboardKey, period) { - let url = window.baseUrl + '/dashboard?id=' + encodeURIComponent(componentKey) + - '&did=' + encodeURIComponent(dashboardKey); - if (period) { - url += '&period=' + period; - } - return url; -} - -/** - * Generate URL for a fixed component's dashboard (overview) - * @param {string} componentKey - * @param {string} dashboardKey - * @returns {string} - */ -export function getComponentFixedDashboardUrl (componentKey, dashboardKey) { - return window.baseUrl + '/overview' + dashboardKey + '?id=' + encodeURIComponent(componentKey); -} - -/** * Generate URL for a component's permissions page * @param {string} componentKey * @returns {string} 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 185b5a6ef63..4aaf6ff239e 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 @@ -23,7 +23,7 @@ import classNames from 'classnames'; import React from 'react'; import LinksMixin from '../links-mixin'; import { translate } from '../../../helpers/l10n'; -import { getComponentFixedDashboardUrl } from '../../../helpers/urls'; +import { getComponentUrl } from '../../../helpers/urls'; const SETTINGS_URLS = [ '/project/settings', @@ -63,11 +63,11 @@ export default React.createClass({ isFixedDashboardActive() { const path = window.location.pathname; - return path.indexOf(window.baseUrl + '/overview') === 0 || path.indexOf(window.baseUrl + '/governance') === 0; + return path.indexOf(window.baseUrl + '/dashboard') === 0 || path.indexOf(window.baseUrl + '/governance') === 0; }, - renderOverviewLink() { - const url = getComponentFixedDashboardUrl(this.props.component.key, ''); + renderDashboardLink() { + const url = getComponentUrl(this.props.component.key); const name = <i className="icon-home"/>; const className = classNames({ active: this.isFixedDashboardActive() }); return ( @@ -250,7 +250,7 @@ export default React.createClass({ render() { return ( <ul className="nav navbar-nav nav-tabs"> - {this.renderOverviewLink()} + {this.renderDashboardLink()} {this.renderComponentIssuesLink()} {this.renderComponentMeasuresLink()} {this.renderCodeLink()} 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 8a4f8635fb4..08f98b294f1 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 @@ -50,7 +50,8 @@ class DashboardController < ApplicationController 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])) + @snapshot = @resource.last_snapshot + render :action => 'overview' end end else 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 21428698a00..c6184135692 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,9 +23,7 @@ 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 + redirect_to "#{ApplicationController.root_context}/dashboard/?id=#{url_encode(params[:id])}" end end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/overview/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/overview.html.erb index aecf8510253..aecf8510253 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/overview/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/overview.html.erb |