]> source.dussan.org Git - sonarqube.git/commitdiff
New Issues Page: handle errors during actions
authorStas Vilchik <vilchiks@gmail.com>
Thu, 30 Jan 2014 11:38:53 +0000 (17:38 +0600)
committerStas Vilchik <vilchiks@gmail.com>
Thu, 30 Jan 2014 11:38:53 +0000 (17:38 +0600)
sonar-server/src/main/webapp/javascripts/navigator/issues.js

index b45fdaf504bf6f135c3644c79aeac1effd9e398e..fff257b5ed5889869ef46435414501048a77a943 100644 (file)
@@ -496,8 +496,12 @@ jQuery(function() {
         type: 'POST',
         url: url,
         data: data
-      }).done(function() {
+      })
+          .done(function() {
             that.options.detailView.updateAfterAction(true);
+          })
+          .fail(function(r) {
+            alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
           });
     }
   });
@@ -541,8 +545,12 @@ jQuery(function() {
           issue: this.options.issue.get('key'),
           severity: this.ui.select.val()
         }
-      }).done(function() {
+      })
+          .done(function() {
             that.options.detailView.updateAfterAction(true);
+          })
+          .fail(function(r) {
+            alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
           });
     }
   });
@@ -639,8 +647,12 @@ jQuery(function() {
           issue: this.options.issue.get('key'),
           assignee: this.ui.select.val()
         }
-      }).done(function() {
+      })
+          .done(function() {
             that.options.detailView.updateAfterAction(true);
+          })
+          .fail(function(r) {
+            alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
           });
     }
   });
@@ -694,8 +706,12 @@ jQuery(function() {
           issue: this.options.issue.get('key'),
           plan: plan === '#unplan' ? '' : plan
         }
-      }).done(function() {
+      })
+          .done(function() {
             that.options.detailView.updateAfterAction(true);
+          })
+          .fail(function(r) {
+            alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
           });
     },
 
@@ -842,8 +858,12 @@ jQuery(function() {
         jQuery.ajax({
           type: "POST",
           url: baseUrl + "/issue/delete_comment?id=" + commentKey
-        }).done(function() {
+        })
+            .done(function() {
               that.updateAfterAction(true);
+            })
+            .fail(function(r) {
+              alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
             });
       }
     },
@@ -858,8 +878,12 @@ jQuery(function() {
           issue: this.model.get('key'),
           transition: jQuery(e.target).data('transition')
         }
-      }).done(function() {
+      })
+          .done(function() {
             that.resetIssue();
+          })
+          .fail(function(r) {
+            alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
           });
     },
 
@@ -891,8 +915,12 @@ jQuery(function() {
           issue: this.model.get('key'),
           assignee: window.SS.currentUser
         }
-      }).done(function() {
+      })
+          .done(function() {
             that.resetIssue();
+          })
+          .fail(function(r) {
+            alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
           });
     },
 
@@ -928,8 +956,12 @@ jQuery(function() {
           issue: this.model.get('key'),
           actionKey: actionKey
         }
-      }).done(function() {
+      })
+          .done(function() {
             that.resetIssue();
+          })
+          .fail(function(r) {
+            alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
           });
     },