diff --git a/ui/js/providers.js b/ui/js/providers.js index 5cb905447..2ef149cd1 100644 --- a/ui/js/providers.js +++ b/ui/js/providers.js @@ -196,3 +196,14 @@ treeherder.provider('thEvents', function() { }; }); +/** + * Create a hash for a job based on the resultset id, platform name, and + * platform option + */ +treeherder.provider('thPlatformHash', function() { + this.$get = function() { + return function(job) { + return job.resultset_id + job.platform + job.platform_opt; + }; + }; +}); diff --git a/ui/js/services/models/resultsets.js b/ui/js/services/models/resultsets.js index 4c4ccd55b..aec2515db 100644 --- a/ui/js/services/models/resultsets.js +++ b/ui/js/services/models/resultsets.js @@ -33,8 +33,8 @@ treeherder.factory('thResultSets', }]); treeherder.factory('thResultSetModel', - ['$log', '$rootScope', 'thResultSets', 'thSocket', 'thJobs', 'thEvents', - function($log, $rootScope, thResultSets, thSocket, thJobs, thEvents) { + ['$log', '$rootScope', 'thResultSets', 'thSocket', 'thJobs', 'thEvents', 'thPlatformHash', + function($log, $rootScope, thResultSets, thSocket, thJobs, thEvents, thPlatformHash) { /****** * Handle updating the resultset datamodel based on a queue of jobs @@ -363,8 +363,19 @@ treeherder.factory('thResultSetModel', */ var updateJobs = function(jobList) { $log.debug("number of jobs returned for add/update: " + jobList.length); - jobList.forEach(updateJob); - $rootScope.$broadcast(thEvents.jobsLoaded, jobList); + + var platformHashes = []; + for (var i = 0; i < jobList.length; i++) { + updateJob(jobList[i]); + var ph = thPlatformHash(jobList[i]); + if (platformHashes.indexof(ph) < 0) { + platformHashes.push(ph); + } + } + + // coalesce the updated jobs into their + + $rootScope.$broadcast(thEvents.jobsLoaded, platformHashes, jobList); }; /****** diff --git a/ui/partials/jobs.html b/ui/partials/jobs.html index 491cf534a..db65dbb95 100755 --- a/ui/partials/jobs.html +++ b/ui/partials/jobs.html @@ -3,7 +3,7 @@
-