From: Jean-Baptiste Lievremont Date: Fri, 31 Jan 2014 15:43:09 +0000 (+0100) Subject: SONAR-4919 Stay on issues tab after bulk change X-Git-Tag: 4.2~328 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2308a20e7fe5252ee3e4b4086b451f15b65a9417;p=sonarqube.git SONAR-4919 Stay on issues tab after bulk change --- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb index 25153f95711..57fedba78a2 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb @@ -21,7 +21,7 @@ // refresh page after issues bulk change function onBulkIssues(){ - window.location.reload(); + resourceViewerOnBulkIssues(); } diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb index 29513590ee8..14063a4d4c2 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb @@ -11,6 +11,7 @@ // refresh page after issues bulk change function onBulkIssues(){ - window.location.reload(); + resourceViewerOnBulkIssues(); } + diff --git a/sonar-server/src/main/webapp/javascripts/application.js b/sonar-server/src/main/webapp/javascripts/application.js index 9943ee25222..ae00c85ab4c 100644 --- a/sonar-server/src/main/webapp/javascripts/application.js +++ b/sonar-server/src/main/webapp/javascripts/application.js @@ -63,6 +63,27 @@ function autocompleteResources() { }); } +function resourceViewerOnBulkIssues() { + var issuesTab = 'tab=issues'; + if (window.location.search.indexOf('tab=') >= 0) { + // If a tab is already selected + if (window.location.search.indexOf(issuesTab) >= 0) { + // If tab is issues, keep it and reload page + window.location.reload(); + } else { + // Else, switch to issues tab + window.location.search = window.location.search.replace(/tab=\w+/, issuesTab); + } + } else { + // No tab selected, see how to add tab parameter + if (window.location.search.startsWith('?')) { + window.location.search += ('&' + issuesTab); + } else { + window.location.search += ('?' + issuesTab); + } + } +} + var SelectBox = { cache: new Object(), init: function (id) {