]> source.dussan.org Git - sonarqube.git/commitdiff
keep period when switching between project dashboards
authorStas Vilchik <vilchiks@gmail.com>
Wed, 30 Sep 2015 09:43:29 +0000 (11:43 +0200)
committerStas Vilchik <vilchiks@gmail.com>
Wed, 30 Sep 2015 09:43:29 +0000 (11:43 +0200)
server/sonar-web/src/main/js/apps/nav/component/component-nav-menu.jsx

index 30e8f14619be4a3af3fb895112943ac0292c6cd2..ed54a7cf63d7781d5ad90d9e432d2694e48718f7 100644 (file)
@@ -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);
     });