зеркало из https://github.com/mozilla/treeherder.git
Bug 1223503 - Simplify population of job groups in frontend
This commit is contained in:
Родитель
26946f754c
Коммит
07012fb925
|
@ -270,22 +270,13 @@ treeherder.directive('thCloneJobs', [
|
|||
* display.
|
||||
*/
|
||||
var addGroupJobsAndCounts = function(jgObj, platformGroup) {
|
||||
var ct, job, jobCountBtn, l;
|
||||
var countAdded = false;
|
||||
var jobCountBtnArray = [];
|
||||
var jobBtnArray = [];
|
||||
var stateCounts = {};
|
||||
var lastJobSelected = ThResultSetStore.getSelectedJob($rootScope.repoName);
|
||||
|
||||
var jobList = platformGroup.find(".group-job-list");
|
||||
var countList = platformGroup.find(".group-count-list");
|
||||
var typeSymbolCounts = _.countBy(jgObj.jobs, "job_type_symbol");
|
||||
jobList.empty();
|
||||
countList.empty();
|
||||
|
||||
for (l = 0; l < jgObj.jobs.length; l++) {
|
||||
|
||||
job = jgObj.jobs[l];
|
||||
_.forEach(jgObj.jobs, function(job) {
|
||||
job.searchStr = thJobSearchStr(job) + ' ' + job.ref_data_name + ' ' +
|
||||
job.signature;
|
||||
|
||||
|
@ -303,7 +294,7 @@ treeherder.directive('thCloneJobs', [
|
|||
// We don't add it to group counts, because it should not be counted
|
||||
// when filtered out. Failures don't get included in counts anyway.
|
||||
if (_.contains(failResults, resultStatus) ||
|
||||
typeSymbolCounts[job.job_type_symbol] > 1) {
|
||||
typeSymbolCounts[job.job_type_symbol] > 1) {
|
||||
// render the job itself, not a count
|
||||
addJobBtnToArray(job, lastJobSelected, jobBtnArray);
|
||||
} else {
|
||||
|
@ -317,9 +308,8 @@ treeherder.directive('thCloneJobs', [
|
|||
countInfo.selectedClasses = selectedCountCls + " " + largeBtnCls;
|
||||
}
|
||||
|
||||
ct = _.get(_.get(stateCounts, countInfo.btnClass, countInfo),
|
||||
"count", 0);
|
||||
countInfo.count = ct + 1;
|
||||
countInfo.count = _.get(
|
||||
_.get(stateCounts, countInfo.btnClass, countInfo), "count", 0) + 1;
|
||||
// keep a reference to the job. If there ends up being
|
||||
// only one for this status, then just add the job itself
|
||||
// rather than a count.
|
||||
|
@ -327,7 +317,7 @@ treeherder.directive('thCloneJobs', [
|
|||
stateCounts[countInfo.btnClass] = countInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
_.forEach(stateCounts, function(countInfo) {
|
||||
if (countInfo.count === 1) {
|
||||
|
@ -336,22 +326,18 @@ treeherder.directive('thCloneJobs', [
|
|||
addJobBtnToArray(countInfo.lastJob, lastJobSelected, jobBtnArray);
|
||||
} else {
|
||||
// with more than 1 job for the status, add it as a count
|
||||
countAdded = true;
|
||||
countInfo.value = countInfo.count;
|
||||
countInfo.title = countInfo.count + " " + countInfo.countText + " jobs in group";
|
||||
countInfo.btnClass = countInfo.btnClass + "-count";
|
||||
jobCountBtn = $(jobGroupCountInterpolator(countInfo));
|
||||
var jobCountBtn = $(jobGroupCountInterpolator(countInfo));
|
||||
showHideElement(jobCountBtn, true);
|
||||
jobCountBtnArray.push(jobCountBtn);
|
||||
jobCountBtnArray.push(' ');
|
||||
showHideElement(jobCountBtn, true);
|
||||
}
|
||||
});
|
||||
|
||||
jobList.append(jobBtnArray);
|
||||
|
||||
if (countAdded) {
|
||||
countList.append(jobCountBtnArray);
|
||||
}
|
||||
platformGroup.find(".group-job-list").html(jobBtnArray);
|
||||
platformGroup.find(".group-count-list").html(jobCountBtnArray);
|
||||
};
|
||||
|
||||
var jobMouseDown = function(resultset, ev){
|
||||
|
|
Загрузка…
Ссылка в новой задаче