##// END OF EJS Templates
pull requests: abort pending ajax requests before starting new one...
Mads Kiilerich -
r4556:dbd2f289 default
parent child Browse files
Show More
@@ -362,7 +362,7 b' function asynchtml(url, $target, success'
362 362 }
363 363 $target.html(_TM['Loading ...']).css('opacity','0.3');
364 364
365 $.ajax({url: url, data: args, headers: {'X-PARTIAL-XHR': '1'}, cache: false, dataType: 'html'})
365 return $.ajax({url: url, data: args, headers: {'X-PARTIAL-XHR': '1'}, cache: false, dataType: 'html'})
366 366 .done(function(html) {
367 367 $target.html(html);
368 368 $target.css('opacity','1.0');
@@ -372,6 +372,8 b' function asynchtml(url, $target, success'
372 372 }
373 373 })
374 374 .fail(function(jqXHR, textStatus, errorThrown) {
375 if (textStatus == "abort")
376 return;
375 377 console.log('Ajax failure: ' + textStatus);
376 378 $target.html('<span class="error_red">ERROR: {0}</span>'.format(textStatus));
377 379 $target.css('opacity','1.0');
@@ -146,10 +146,16 b''
146 146
147 147 pyroutes.register('pullrequest_repo_info', "${url('pullrequest_repo_info',repo_name='%(repo_name)s')}", ['repo_name']);
148 148
149 var pendingajax = undefined;
149 150 var otherrepoChanged = function(){
150 151 var repo_name = $('#other_repo').val();
151 ajaxGET(pyroutes.url('pullrequest_repo_info', {"repo_name": repo_name}),
152 if (pendingajax) {
153 pendingajax.abort();
154 pendingajax = undefined;
155 }
156 pendingajax = ajaxGET(pyroutes.url('pullrequest_repo_info', {"repo_name": repo_name}),
152 157 function(o){
158 pendingajax = undefined;
153 159 var data = JSON.parse(o.responseText);
154 160 $('#other_repo_desc').html(data.description);
155 161
@@ -217,7 +223,12 b''
217 223 url = url.replace(k,rev_data[k]);
218 224 }
219 225
220 asynchtml(url, $('#pull_request_overview'), function(o){
226 if (pendingajax) {
227 pendingajax.abort();
228 pendingajax = undefined;
229 }
230 pendingajax = asynchtml(url, $('#pull_request_overview'), function(o){
231 pendingajax = undefined;
221 232 var jsdata = eval('('+YUD.get('jsdata').innerHTML+')'); // TODO: just get json
222 233 var r = new BranchRenderer('graph_canvas', 'graph_content_pr');
223 234 r.render(jsdata,100);
General Comments 0
You need to be logged in to leave comments. Login now