summaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-09-16 17:44:23 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-09-16 17:44:23 +0200
commitf2e47675ce6516c502a5d531bd0ea3fbd9183747 (patch)
tree72ef26c3f7ac2668c4b17a216bc6ee44cf12f36b /server/sonar-web
parentffd1fc743ca5ffff409b5376b8d68b80114b8ab1 (diff)
downloadsonarqube-f2e47675ce6516c502a5d531bd0ea3fbd9183747.tar.gz
sonarqube-f2e47675ce6516c502a5d531bd0ea3fbd9183747.zip
SONAR-6779 show a functional error in the select list component
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/src/main/js/components/common/select-list.js22
1 files changed, 17 insertions, 5 deletions
diff --git a/server/sonar-web/src/main/js/components/common/select-list.js b/server/sonar-web/src/main/js/components/common/select-list.js
index b14b83b2676..06504e8da06 100644
--- a/server/sonar-web/src/main/js/components/common/select-list.js
+++ b/server/sonar-web/src/main/js/components/common/select-list.js
@@ -128,14 +128,21 @@ define(function () {
$.ajax({
url: url,
type: 'POST',
- data: data
+ data: data,
+ statusCode: {
+ // do not show global error
+ 400: null,
+ 401: null,
+ 403: null,
+ 500: null
+ }
})
.done(function () {
that.model.set('selected', !selected);
})
- .fail(function () {
+ .fail(function (jqXHR) {
that.render();
- showError();
+ showError(jqXHR);
})
.always(function () {
that.$el.removeClass('progress');
@@ -241,10 +248,15 @@ define(function () {
this.listItemViews = [];
- showError = function () {
+ showError = function (jqXHR) {
+ var message = window.t('default_error_message');
+ if (jqXHR != null && jqXHR.responseJSON != null && jqXHR.responseJSON.errors != null) {
+ message = _.pluck(jqXHR.responseJSON.errors, 'msg').join('. ');
+ }
+
that.$el.prevAll('.alert').remove();
$('<div>')
- .addClass('alert alert-danger').text(that.settings.errorMessage)
+ .addClass('alert alert-danger').text(message)
.insertBefore(that.$el);
};