From adcaa85706df94a86e4c0ab7d54c1a490368daca Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Wed, 30 Sep 2015 11:43:29 +0200 Subject: [PATCH] keep period when switching between project dashboards --- .../main/js/apps/nav/component/component-nav-menu.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/nav/component/component-nav-menu.jsx b/server/sonar-web/src/main/js/apps/nav/component/component-nav-menu.jsx index 30e8f14619b..ed54a7cf63d 100644 --- a/server/sonar-web/src/main/js/apps/nav/component/component-nav-menu.jsx +++ b/server/sonar-web/src/main/js/apps/nav/component/component-nav-menu.jsx @@ -12,12 +12,17 @@ const SETTINGS_URLS = [ export default React.createClass({ mixins: [DashboardNameMixin, LinksMixin], + periodParameter() { + let params = window.getQueryParams(); + return params.period ? `&period=${params.period}` : ''; + }, + renderOverviewLink() { if (_.size(this.props.component.dashboards) === 0) { return null; } let firstDashboard = _.first(this.props.component.dashboards); - let url = `/dashboard/index?id=${encodeURIComponent(this.props.component.key)}`; + let url = `/dashboard/index?id=${encodeURIComponent(this.props.component.key)}${this.periodParameter()}`; let name = this.getLocalizedDashboardName(firstDashboard.name); return this.renderLink(url, name, () => { /* eslint eqeqeq: 0 */ @@ -190,7 +195,7 @@ export default React.createClass({ renderDashboards() { let dashboards = _.rest(this.props.component.dashboards || []).map(d => { - let url = `/dashboard?id=${encodeURIComponent(this.props.component.key)}&did=${d.key}`; + let url = `/dashboard?id=${encodeURIComponent(this.props.component.key)}&did=${d.key}${this.periodParameter()}`; let name = this.getLocalizedDashboardName(d.name); return this.renderLink(url, name); }); -- 2.39.5