diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-07-27 16:05:45 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-07-27 16:05:58 +0200 |
commit | 6951178ca6c92d9a2820ac2a5506699af1e3259e (patch) | |
tree | 691e21669cf055e177593ba381728197e990f43b /server/sonar-web/src/main/js | |
parent | b05724db0261c3f607496e47443b2d4b204d10e1 (diff) | |
download | sonarqube-6951178ca6c92d9a2820ac2a5506699af1e3259e.tar.gz sonarqube-6951178ca6c92d9a2820ac2a5506699af1e3259e.zip |
keep period when go to a different dashboard
Diffstat (limited to 'server/sonar-web/src/main/js')
-rw-r--r-- | server/sonar-web/src/main/js/components/common/handlebars-extensions.js | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/components/common/handlebars-extensions.js b/server/sonar-web/src/main/js/components/common/handlebars-extensions.js index 46d0a78b18a..bf4e49be9f2 100644 --- a/server/sonar-web/src/main/js/components/common/handlebars-extensions.js +++ b/server/sonar-web/src/main/js/components/common/handlebars-extensions.js @@ -35,8 +35,24 @@ }); Handlebars.registerHelper('componentDashboardPermalink', function (componentKey, dashboardKey) { - return baseUrl + '/dashboard/index?id=' + encodeURIComponent(componentKey) + - '&did=' + encodeURIComponent(dashboardKey); + var params = [ + { key: 'id', value: componentKey }, + { key: 'did', value: dashboardKey } + ]; + + var matchPeriod = window.location.search.match(/period=(\d+)/); + if (matchPeriod) { + // If we have a match for period, check that it is not project-specific + var period = parseInt(matchPeriod[1], 10); + if (period <= 3) { + params.push({ key: 'period', value: period }); + } + } + + var query = params.map(function (p) { + return p.key + '=' + encodeURIComponent(p.value); + }).join('&'); + return baseUrl + '/dashboard/index?' + query; }); Handlebars.registerHelper('componentBrowsePermalink', function (componentKey) { @@ -471,7 +487,7 @@ changed = true; if (currentLine && prevLine && currentLine.scm && prevLine.scm) { changed = (currentLine.scm.author !== prevLine.scm.author) || - (currentLine.scm.date !== prevLine.scm.date) || (!prevLine.show); + (currentLine.scm.date !== prevLine.scm.date) || (!prevLine.show); } return changed ? options.fn(this) : options.inverse(this); }); |