From: Stas Vilchik Date: Wed, 30 Sep 2015 09:43:29 +0000 (+0200) Subject: keep period when switching between project dashboards X-Git-Tag: 5.2-RC1~187 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=adcaa85706df94a86e4c0ab7d54c1a490368daca;p=sonarqube.git keep period when switching between project dashboards --- 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); });