Skip to content

Commit

Permalink
Bug 1311436 - Cancel existing query before loading in failure summary (
Browse files Browse the repository at this point in the history
  • Loading branch information
wlach committed Oct 19, 2016
1 parent 3a7b5dc commit 968b18d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ui/js/logviewer.js
Expand Up @@ -8,4 +8,7 @@ logViewerApp.config(function($compileProvider, $resourceProvider) {

// Don't strip trailing slashes from calculated URLs
$resourceProvider.defaults.stripTrailingSlashes = false;

// All queries should be cancellable by default (why is this configurable??)
$resourceProvider.defaults.cancellable = true;
});
3 changes: 3 additions & 0 deletions ui/js/treeherder_app.js
Expand Up @@ -12,6 +12,9 @@ treeherderApp.config(function($compileProvider, $routeProvider,
// Don't strip trailing slashes from calculated URLs
$resourceProvider.defaults.stripTrailingSlashes = false;

// All queries should be cancellable by default (why is this configurable??)
$resourceProvider.defaults.cancellable = true;

// enable or disable debug messages using $log.
// comment out the next line to enable them
$logProvider.debugEnabled(false);
Expand Down
11 changes: 9 additions & 2 deletions ui/plugins/failure_summary/controller.js
Expand Up @@ -17,16 +17,23 @@ treeherder.controller('BugsPluginCtrl', [

$scope.filerInAddress = false;

var query;

// update function triggered by the plugins controller
thTabs.tabs.failureSummary.update = function() {
var newValue = thTabs.tabs.failureSummary.contentId;
$scope.suggestions = [];
$scope.bugSuggestionsLoaded = false;

// cancel any existing failure summary queries
if (query) {
query.$cancelRequest();
}

if (angular.isDefined(newValue)) {
thTabs.tabs.failureSummary.is_loading = true;

ThBugSuggestionsModel.query({
query = ThBugSuggestionsModel.query({
project: $rootScope.repoName,
jobId: newValue
}, function(suggestions) {
Expand Down Expand Up @@ -54,7 +61,7 @@ treeherder.controller('BugsPluginCtrl', [
// the log (we can do this asynchronously, it should normally be
// fast)
if (!suggestions.length) {
ThTextLogStepModel.query({
query = ThTextLogStepModel.query({
project: $rootScope.repoName,
jobId: newValue
}, function(textLogSteps) {
Expand Down

0 comments on commit 968b18d

Please sign in to comment.