From bf0b1f78b38bdbff570232764135698e9e290e59 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Fri, 22 Jul 2016 17:36:18 +0200 Subject: [PATCH] SONAR-7934 Reuse /dashboard url for project overview --- ...project_overview_after_first_analysis.html | 2 +- server/sonar-web/src/main/js/helpers/urls.js | 26 ------------------- .../main/nav/component/component-nav-menu.js | 10 +++---- .../app/controllers/dashboard_controller.rb | 3 ++- .../app/controllers/overview_controller.rb | 4 +-- .../overview.html.erb} | 0 6 files changed, 9 insertions(+), 36 deletions(-) rename server/sonar-web/src/main/webapp/WEB-INF/app/views/{overview/index.html.erb => dashboard/overview.html.erb} (100%) diff --git a/it/it-tests/src/test/resources/measure/ProjectOverviewTest/test_project_overview_after_first_analysis.html b/it/it-tests/src/test/resources/measure/ProjectOverviewTest/test_project_overview_after_first_analysis.html index 071c91eb3bd..5c91afb2ac5 100644 --- a/it/it-tests/src/test/resources/measure/ProjectOverviewTest/test_project_overview_after_first_analysis.html +++ b/it/it-tests/src/test/resources/measure/ProjectOverviewTest/test_project_overview_after_first_analysis.html @@ -16,7 +16,7 @@ open - /overview?id=project-for-overview + /dashboard?id=project-for-overview 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 @@ -49,32 +49,6 @@ export function getComponentDrilldownUrl (componentKey, metric) { return `${window.baseUrl}/component_measures/metric/${metric}?id=${encodeURIComponent(componentKey)}`; } -/** - * 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 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 = ; const className = classNames({ active: this.isFixedDashboardActive() }); return ( @@ -250,7 +250,7 @@ export default React.createClass({ render() { return (