fixed timestamp / label issues on build page

This commit is contained in:
Brad Rydzewski 2015-10-01 13:39:25 -07:00
parent 6bc28bd41c
commit f0cba925f0
2 changed files with 42 additions and 3 deletions

View file

@ -81,8 +81,36 @@ function JobViewModel(repo, build, job, status) {
// update the status for each job in the view // update the status for each job in the view
for (var i=0;i<data.jobs.length;i++) { for (var i=0;i<data.jobs.length;i++) {
var job_ = data.jobs[i]; var job_ = data.jobs[i];
$("[data-job="+job_.number+"]").find(".status") var el = $("[data-job="+job_.number+"]");
el.find(".status")
.attr("class", "status "+job_.status).text(job_.status); .attr("class", "status "+job_.status).text(job_.status);
switch (job_.status) {
case "running":
el.find(".msg-running").find("span").attr("data-livestamp", job_.started_at);
el.find(".msg-pending").hide();
el.find(".msg-running").show();
el.find(".msg-finished").hide();
el.find(".msg-exited").hide();
break;
case "pending":
el.find(".msg-pending").show();
el.find(".msg-running").hide();
el.find(".msg-finished").hide();
el.find(".msg-exited").hide();
break;
default:
el.find(".msg-finished").find("span").attr("data-livestamp", job_.finished_at);
el.find(".msg-exited").find("span").text(job_.exit_code);
el.find(".msg-pending").hide();
el.find(".msg-running").hide();
el.find(".msg-finished").show();
el.find(".msg-exited").show();
break;
}
} }
var after = self.status; var after = self.status;

View file

@ -46,10 +46,21 @@ block content
h3 h3
each $key, $val in $job.Environment each $key, $val in $job.Environment
div.env #{$key}=#{$val} div.env #{$key}=#{$val}
div div[class="msg-pending"]
.hidden ? $job.Status != "pending"
| pending assignment to a worker
div[class="msg-running"]
.hidden ? $job.Status != "running"
| started
span[data-livestamp=$job.Started]
div[class="msg-finished"]
.hidden ? $job.Finished == 0
| finished | finished
span[data-livestamp=$job.Finished] span[data-livestamp=$job.Finished]
div with exit code #{$job.ExitCode} div[class="msg-exited"]
.hidden ? $job.Finished == 0
| with exit code
span #{$job.ExitCode}
div.build-btn-group div.build-btn-group
button.btn.btn-info.hidden#restart restart button.btn.btn-info.hidden#restart restart