aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-04-14 15:37:36 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-04-14 15:37:42 +0200
commit9a72c34c0d58ceeaa4a2ce392ecd1fd71e05c8d8 (patch)
tree0f1c96688f12983ae0c96694532941ff39e36ee3 /server/sonar-web/src/main
parentebecba8d290cf98034c9d158c19154bdc227a488 (diff)
downloadsonarqube-9a72c34c0d58ceeaa4a2ce392ecd1fd71e05c8d8.tar.gz
sonarqube-9a72c34c0d58ceeaa4a2ce392ecd1fd71e05c8d8.zip
SONAR-5851 add changelog permalink
Diffstat (limited to 'server/sonar-web/src/main')
-rw-r--r--server/sonar-web/src/main/js/application.js17
-rw-r--r--server/sonar-web/src/main/js/quality-profiles/controller.js22
-rw-r--r--server/sonar-web/src/main/js/quality-profiles/router.js8
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb4
4 files changed, 46 insertions, 5 deletions
diff --git a/server/sonar-web/src/main/js/application.js b/server/sonar-web/src/main/js/application.js
index d71b61294c7..4de2fefb40b 100644
--- a/server/sonar-web/src/main/js/application.js
+++ b/server/sonar-web/src/main/js/application.js
@@ -507,6 +507,23 @@ function closeModalWindow () {
return SEVERITIES_ORDER.indexOf(severity);
};
+
+ /**
+ * Return a hash of GET parameters
+ * @returns {object}
+ */
+ window.getQueryParams = function () {
+ var qs = window.location.search.split('+').join(' '),
+ params = {},
+ re = /[?&]?([^=]+)=([^&]*)/g,
+ tokens = re.exec(qs);
+ while (tokens) {
+ params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]);
+ tokens = re.exec(qs);
+ }
+ return params;
+ };
+
})();
(function () {
diff --git a/server/sonar-web/src/main/js/quality-profiles/controller.js b/server/sonar-web/src/main/js/quality-profiles/controller.js
index eb8222f8cb0..8219fa96e13 100644
--- a/server/sonar-web/src/main/js/quality-profiles/controller.js
+++ b/server/sonar-web/src/main/js/quality-profiles/controller.js
@@ -41,16 +41,30 @@ define([
this.fetchProfiles().done(function () {
var profile = that.options.app.profiles.findWhere({ key: key });
if (profile != null) {
- profile.trigger('select', profile);
+ profile.trigger('select', profile, { trigger: false });
}
});
},
- onProfileSelect: function (profile) {
+ changelog: function (key, since, to) {
+ var that = this;
+ this.fetchProfiles().done(function () {
+ var profile = that.options.app.profiles.findWhere({ key: key });
+ if (profile != null) {
+ profile.trigger('select', profile, { trigger: false });
+ profile.fetchChangelog({ since: since, to: to });
+ }
+ });
+ },
+
+ onProfileSelect: function (profile, options) {
var that = this,
key = profile.get('key'),
- route = 'show?key=' + encodeURIComponent(key);
- this.options.app.router.navigate(route);
+ route = 'show?key=' + encodeURIComponent(key),
+ opts = _.defaults(options || {}, { trigger: true });
+ if (opts.trigger) {
+ this.options.app.router.navigate(route);
+ }
this.options.app.profilesView.highlight(key);
this.fetchProfile(profile).done(function () {
var profileHeaderView = new ProfileHeaderView({ model: profile });
diff --git a/server/sonar-web/src/main/js/quality-profiles/router.js b/server/sonar-web/src/main/js/quality-profiles/router.js
index 521dea6a04a..0076462a9f4 100644
--- a/server/sonar-web/src/main/js/quality-profiles/router.js
+++ b/server/sonar-web/src/main/js/quality-profiles/router.js
@@ -23,7 +23,8 @@ define(function () {
routes: {
'': 'index',
'index': 'index',
- 'show?key=:key': 'show'
+ 'show?key=:key': 'show',
+ 'changelog*': 'changelog'
},
initialize: function (options) {
@@ -36,6 +37,11 @@ define(function () {
show: function (key) {
this.app.controller.show(key);
+ },
+
+ changelog: function () {
+ var params = window.getQueryParams();
+ this.app.controller.changelog(params.key, params.since, params.to);
}
});
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb
index 0c815c44eab..8ab7cdf9c28 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb
@@ -28,6 +28,10 @@ class ProfilesController < ApplicationController
render :action => 'index'
end
+ def changelog
+ render :action => 'index'
+ end
+
# GET /profiles/export?name=<profile name>&language=<language>&format=<exporter key>
def export
language = params[:language]