From: Stas Vilchik Date: Tue, 14 Apr 2015 14:36:58 +0000 (+0200) Subject: SONAR-5851 fix profile restoring X-Git-Tag: 5.2-RC1~2273 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5be578dcabfd1ec79b72fcaa6e47a1f0ad1de47f;p=sonarqube.git SONAR-5851 fix profile restoring --- diff --git a/server/sonar-web/src/main/js/quality-profiles/actions-view.js b/server/sonar-web/src/main/js/quality-profiles/actions-view.js index d06e62675af..67f4caceba9 100644 --- a/server/sonar-web/src/main/js/quality-profiles/actions-view.js +++ b/server/sonar-web/src/main/js/quality-profiles/actions-view.js @@ -61,7 +61,9 @@ define([ }, restore: function () { - new RestoreProfileView().render(); + new RestoreProfileView({ + collection: this.collection + }).render(); }, restoreBuiltIn: function () { diff --git a/server/sonar-web/src/main/js/quality-profiles/restore-profile-view.js b/server/sonar-web/src/main/js/quality-profiles/restore-profile-view.js index 8a3f49ea62a..dea4bfeeab0 100644 --- a/server/sonar-web/src/main/js/quality-profiles/restore-profile-view.js +++ b/server/sonar-web/src/main/js/quality-profiles/restore-profile-view.js @@ -32,12 +32,17 @@ define([ var that = this; ModalFormView.prototype.onFormSubmit.apply(this, arguments); uploader({ form: $(e.currentTarget) }).done(function (r) { - if (typeof r === 'object' && _.isArray(r.errors) || _.isArray(r.warning)) { + if (_.isArray(r.errors) || _.isArray(r.warnings)) { that.showErrors(r.errors, r.warnings); - return; + } else { + that.collection.fetch().done(function () { + var profile = that.collection.findWhere({ key: r.profile.key }); + if (profile != null) { + profile.trigger('select', profile); + } + }); + that.close(); } - that.collection.fetch(); - that.close(); }); } });