Skip to content

Commit

Permalink
Progressbar when in state RUNNING
Browse files Browse the repository at this point in the history
  • Loading branch information
patbos committed Mar 9, 2014
1 parent 445eae0 commit a31b6d6
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 9 deletions.
10 changes: 8 additions & 2 deletions src/main/java/se/diabol/jenkins/pipeline/PipelineFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,14 @@ protected static Status resolveStatus(AbstractProject project, AbstractBuild bui
}

if (build.isBuilding()) {
return StatusFactory.running((int) round(100.0d * (currentTimeMillis() - build.getTimestamp().getTimeInMillis())
/ build.getEstimatedDuration()), build.getTimeInMillis(), currentTimeMillis() - build.getTimestamp().getTimeInMillis());
//build.getEstimatedDuration()
int progress = (int) round(100.0d * (currentTimeMillis() - build.getTimestamp().getTimeInMillis())
/ build.getEstimatedDuration());
if (progress > 100) {
progress = 99;
}

return StatusFactory.running(progress, build.getTimeInMillis(), currentTimeMillis() - build.getTimestamp().getTimeInMillis());
}

Result result = build.getResult();
Expand Down
33 changes: 32 additions & 1 deletion src/main/webapp/pipe-fullscreen.css
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,38 @@ section.stage div.task {
padding-left: 5px;
}


div.task-progress {
position: relative;
height: 34px;
width: 0;
background-color: #0197fe;
-webkit-animation-name: bluePulse;
-webkit-animation-duration: 2s;
-webkit-animation-iteration-count: infinite;
}

@-webkit-keyframes bluePulse {
from { background-color: #0197fe; -webkit-box-shadow: 0 0 9px #333; }
50% { background-color: #2daebf; -webkit-box-shadow: 0 0 18px #2daebf; }
to { background-color: #0197fe; -webkit-box-shadow: 0 0 9px #333; }
}

div.task-content {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 30px;
margin-left: 2px;
margin-top: 2px;
}


div.taskname {
position: relative;
}

section.stage a {
text-decoration: none;
color: inherit;
Expand Down Expand Up @@ -179,7 +211,6 @@ section.hide {
}

.RUNNING {
background: url("running.gif") no-repeat right;
border-left: 6px solid #0197fe;
color: lightgray;
}
Expand Down
29 changes: 25 additions & 4 deletions src/main/webapp/pipe.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,13 @@ div.changes a:hover {
text-decoration: underline;
}


div.changes h1 {
font-size: 14px;
line-height: 14px;
padding: 0;
margin: 0;
}


div.change {
clear: both;
padding-left: 5px;
Expand Down Expand Up @@ -104,6 +102,30 @@ section.stage div.task {
padding-left: 5px;
}


div.task-progress {
position: relative;
height: 30px;
width: 0;
background-color: lightskyblue;
border-radius: 3px;
}

div.task-content {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 30px;
margin-left: 2px;
margin-top: 2px;
}


div.taskname {
position: relative;
}

section.stage a {
text-decoration: none;
color: inherit;
Expand All @@ -125,7 +147,6 @@ section.stage a:hover {
float: left;
}


.IDLE {
border-left: 6px solid #d3d3d3;
}
Expand Down Expand Up @@ -162,7 +183,6 @@ section.stage a:hover {
}

.RUNNING {
background: url("running.gif") no-repeat right;
border-left: 6px solid #0092ef;
}

Expand Down Expand Up @@ -207,6 +227,7 @@ div.pipeline-row {
display: table-row;
white-space: nowrap;
}

div.pipeline-row-spacer {
white-space: nowrap;
height: 20px;
Expand Down
10 changes: 8 additions & 2 deletions src/main/webapp/pipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,14 @@ function refreshPipelines(data, divNames, errorDiv, view, showAvatars, showChang

tasks.push({id: id, taskId: task.id, buildId: task.buildId});

var progress = 0;

if (task.status.percentage) {
progress = task.status.percentage;
}

html = html + "<div id=\"" + id + "\" class=\"task " + task.status.type +
"\"><div class=\"taskname\"><a href=\"" + task.link + "\">" + task.name + "</a></div>";
"\"><div class=\"task-progress\" style=\"width: " + progress + "%;\"><div class=\"task-content\"><div class=\"taskname\"><a href=\"" + task.link + "\">" + task.name + "</a></div>";

if (timestamp != "") {
html = html + "<span id=\"" + id + ".timestamp\" class='timestamp'>" + timestamp + "</span>"
Expand All @@ -145,7 +151,7 @@ function refreshPipelines(data, divNames, errorDiv, view, showAvatars, showChang
if (task.status.duration >= 0)
html = html + "<span class='duration'>" + formatDuration(task.status.duration) + "</span>";

html = html + "</div>"
html = html + "</div></div></div>"

}
html = html + "</section>";
Expand Down

0 comments on commit a31b6d6

Please sign in to comment.