Merge branch 'master' into retrigger-jobs

This commit is contained in:
Cameron Dawson 2014-05-22 15:19:22 -07:00
Родитель 6907d78f15 009cc87319
Коммит e9db42f62e
1 изменённых файлов: 49 добавлений и 2 удалений

Просмотреть файл

@ -50,13 +50,46 @@ treeherder.directive('thCloneJobs', [
};
var getHoverText = function(job) {
var jobStatus = thResultStatus(job);
var result = job.job_type_name + " - " + jobStatus;
$log.debug("job timestamps", job, job.end_timestamp, job.submit_timestamp);
if (job.end_timestamp && job.submit_timestamp) {
if( (jobStatus === 'pending') || (jobStatus === 'running') ){
var timestampSeconds = new Date().getTime()/1000;
var typicalMinutes = Math.round(
(parseInt(job.pending_eta) + parseInt(job.running_eta) )/60 );
var remainingMinutes =
Math.round( ( timestampSeconds - (
parseInt(job.submit_timestamp) + parseInt(job.pending_eta) +
parseInt(job.running_eta) ) )/60 );
if(remainingMinutes > 0){
result = result + ', ETA to completed, ' + remainingMinutes + ' mins';
}else if(remainingMinutes < 0){
var minutesOverdue = Math.abs(remainingMinutes);
result = result + ', ' + minutesOverdue + ' mins overdue, typically takes '
+ typicalMinutes + ' mins';
}else {
result = result + ', ETA any minute now, typically takes ' +
typicalMinutes + ' mins';
}
}else {
//The job is complete, compute duration
var duration = Math.round((job.end_timestamp - job.submit_timestamp) / 60);
result = result + " - " + duration + "mins";
result = result + " - " + duration + " mins";
}
return result;
};
@ -241,7 +274,20 @@ treeherder.directive('thCloneJobs', [
return jobsShown;
};
var updateJobTitle = function(ev){
var el = $(ev.target);
var key = el.attr(jobKeyAttr);
//Confirm user selected a job
if(!_.isEmpty(this)){
if(key && !_.isEmpty(this.job_map[key])){
var job = this.job_map[key].job_obj;
var title = getHoverText(job);
el.attr('title', title);
}
}
};
var jobMouseDown = function(ev){
var el = $(ev.target);
@ -916,6 +962,7 @@ treeherder.directive('thCloneJobs', [
//Register events callback
element.on('mousedown', _.bind(jobMouseDown, scope));
element.on('mouseover', _.bind(updateJobTitle, scope));
registerCustomEventCallbacks(scope, element, attrs);