diff --git a/ui/js/controllers/jobs.js b/ui/js/controllers/jobs.js index c2b511a73..dc686e768 100644 --- a/ui/js/controllers/jobs.js +++ b/ui/js/controllers/jobs.js @@ -20,10 +20,10 @@ treeherder.controller('JobsCtrl', } // the primary data model - thResultSetModel.init(600000, $scope.repoName); + //thResultSetModel.init(600000, $scope.repoName); //thResultSetModel.init(60000, $scope.repoName); //thResultSetModel.init(10000, $scope.repoName); - //thResultSetModel.init(5000, $scope.repoName); + thResultSetModel.init(5000, $scope.repoName); $scope.isLoadingRsBatch = thResultSetModel.loadingStatus; $scope.result_sets = thResultSetModel.getResultSetsArray(); diff --git a/ui/js/directives.js b/ui/js/directives.js index ba00906e1..ca3800d3b 100755 --- a/ui/js/directives.js +++ b/ui/js/directives.js @@ -3,7 +3,8 @@ /* Directives */ treeherder.directive('thCloneJobs', function( $rootScope, $http, $log, thUrl, thCloneHtml, thServiceDomain, - thResultStatusInfo, thEvents, thAggregateIds, thJobFilters){ + thResultStatusInfo, thEvents, thAggregateIds, thJobFilters, + thResultSetModel){ var lastJobElSelected = {}; @@ -84,7 +85,9 @@ treeherder.directive('thCloneJobs', function( }); }; - var addJobBtnEls = function(jgObj, jobBtnInterpolator, jobTdEl, resultStatusFilters){ + var addJobBtnEls = function( + jgObj, jobBtnInterpolator, jobTdEl, resultStatusFilters, + statusCounts){ var hText, key, resultState, job, jobStatus, jobBtn, l; @@ -113,6 +116,14 @@ treeherder.directive('thCloneJobs', function( resultState = job.state; } + resultState = resultState || 'unknown'; + + if (!statusCounts[ resultState ]){ + statusCounts[ resultState ] = 0; + } + + statusCounts[ resultState ] += 1; + jobStatus = thResultStatusInfo(resultState); jobStatus['key'] = key; @@ -296,6 +307,8 @@ treeherder.directive('thCloneJobs', function( //Empty the job column before populating it jobTdEl.empty(); + var statusCounts = {}; + //If at least one job is visible we need to display the platform //otherwise hide it var jobsShownTotal = 0; @@ -315,7 +328,8 @@ treeherder.directive('thCloneJobs', function( // Add the job btn spans jobsShown = addJobBtnEls( - jgObj, jobBtnInterpolator, jobTdEl, resultStatusFilters + jgObj, jobBtnInterpolator, jobTdEl, resultStatusFilters, + statusCounts ); if(jobsShown > 0){ @@ -323,6 +337,7 @@ treeherder.directive('thCloneJobs', function( jobTdEl.append( $( thCloneHtml.get('jobGroupEndClone').text ) ); + }else { // No jobs were displayed in the group, hide // the group symbol @@ -334,8 +349,10 @@ treeherder.directive('thCloneJobs', function( // Add the job btn spans jobsShown = addJobBtnEls( - jgObj, jobBtnInterpolator, jobTdEl, resultStatusFilters + jgObj, jobBtnInterpolator, jobTdEl, resultStatusFilters, + statusCounts ); + } //Keep track of all of the jobs shown in a row jobsShownTotal += jobsShown; @@ -348,6 +365,7 @@ treeherder.directive('thCloneJobs', function( } row.append(jobTdEl); +console.log(statusCounts); }; var filterJobs = function(element, resultStatusFilters){ @@ -424,6 +442,23 @@ treeherder.directive('thCloneJobs', function( } }; + var resetCounts = function( + resultsetId, platformName, counts, rsMap, resultset + ){ + + var rsMap = thResultSetModel.getResultsetMap(); + rsMap[ resultSetId ].platforms[ platformName ].pl_obj.job_counts = counts; + + // Iterate through the platforms and reset the resultset counts + var i; + for(i=0; i'); - platformId = thAggregateIds.getPlatformRowId( $rootScope.repoName, scope.resultset.id, scope.resultset.platforms[j].name, scope.resultset.platforms[j].option ); +//console.log(rsMap[ scope.resultset.id ].platforms[ scope.resultset.platforms[j].name ].pl_obj.job_counts); row.prop('id', platformId); diff --git a/ui/js/services/models/resultsets.js b/ui/js/services/models/resultsets.js index ebaa360f3..420ec0877 100644 --- a/ui/js/services/models/resultsets.js +++ b/ui/js/services/models/resultsets.js @@ -642,6 +642,10 @@ treeherder.factory('thResultSetModel', return resultSets; }, + getResultsetMap: function() { + return rsMap; + }, + // this is a "watchable" for jobs getJobMap: function() { return jobMap;