summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-12-16 11:36:39 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-10 13:29:20 +0000
commit769017e477caeb87db719d6b2760af36c930e45f (patch)
treebe7babbdc2b61c00786a4761acdb32fb77d6df60
parent971d65c614ea2265951262f7acb7037d090c1c4a (diff)
downloadpoky-contrib-769017e477caeb87db719d6b2760af36c930e45f.tar.gz
poky-contrib-769017e477caeb87db719d6b2760af36c930e45f.tar.bz2
poky-contrib-769017e477caeb87db719d6b2760af36c930e45f.zip
bitbake: toaster: project builds Poll the server to get latest progress for build
Poll the server for the project build progress value. This is something that will need to be re-done once we have a proper API for this on the server side. [YOCTO 8328] (Bitbake rev: ec467e43c39eadf02412b89db10c09ed78a5a9f5) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/toaster/toastergui/templates/mrb_section.html64
1 files changed, 61 insertions, 3 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/mrb_section.html b/bitbake/lib/toaster/toastergui/templates/mrb_section.html
index 2f4820c3e7e..2e5eb5050b1 100644
--- a/bitbake/lib/toaster/toastergui/templates/mrb_section.html
+++ b/bitbake/lib/toaster/toastergui/templates/mrb_section.html
@@ -119,11 +119,11 @@
{%endif%}
{%if build.outcome == build.IN_PROGRESS %}
<div class="span4 offset1">
- <div class="progress" style="margin-top:5px;" data-toggle="tooltip" title="{{build.completeper}}% of tasks complete">
- <div style="width: {{build.completeper}}%;" class="bar"></div>
+ <div class="progress" id="build-pc-done-title-{{build.pk}}" style="margin-top:5px;" data-toggle="tooltip" title="{{build.completeper}}% of tasks complete">
+ <div id="build-pc-done-bar-{{build.pk}}" style="width: {{build.completeper}}%;" class="bar"></div>
</div>
</div>
- <div class="lead pull-right">{{build.completeper}}% of tasks complete</div>
+ <div class="lead pull-right"><span id="build-pc-done-{{build.pk}}">{{build.completeper}}</span>% of tasks complete</div>
{%endif%}
</div>
</div>
@@ -152,6 +152,64 @@ $(document).ready(function(){
btn.parents(".alert").fadeOut();
}, null);
});
+
+ {%if mrb_type == 'project' %}
+ var projectBuilds = true;
+ {% else %}
+ var projectBuilds = false;
+ {% endif %}
+
+ var progressTimer;
+
+ if (projectBuilds === true){
+ progressTimer = window.setInterval(function() {
+ libtoaster.getProjectInfo(libtoaster.ctx.projectPageUrl,
+ function(prjInfo){
+
+ /* These two are needed because a build can be 100% and still
+ * in progress due to the fact that the % done is updated at the
+ * start of a task so it can be doing the last task at 100%
+ */
+ var inProgress = 0;
+ var allPercentDone = 0;
+
+ for (var i in prjInfo.builds){
+ var build = prjInfo.builds[i];
+
+ if (build.status === "In Progress" ||
+ $(".progress .bar").length > 0){
+ /* Update the build progress */
+ var percentDone;
+
+ if (build.status !== "In Progress"){
+ /* We have to ignore the value when it's Succeeded because it
+ * goes back to 0
+ */
+ percentDone = 100;
+ } else {
+ percentDone = build.build[0].completeper;
+ inProgress++;
+ }
+
+ $("#build-pc-done-" + build.id).text(percentDone);
+ $("#build-pc-done-title-" + build.id).attr("title", percentDone);
+ $("#build-pc-done-bar-" + build.id).css("width",
+ String(percentDone) + "%");
+
+ allPercentDone += percentDone;
+ }
+ }
+
+ if (allPercentDone === (100 * prjInfo.builds.length) && !inProgress)
+ window.location.reload();
+
+ /* Our progress bar is not still showing so shutdown the polling. */
+ if ($(".progress .bar").length === 0)
+ window.clearInterval(progressTimer);
+
+ });
+ }, 1500);
+ }
});
</script>