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-769017e477caeb87db719d6b2760af36c930e45f.tar.gz
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 2f4820c3e7..2e5eb5050b 100644
--- a/bitbake/lib/toaster/toastergui/templates/mrb_section.html
+++ b/bitbake/lib/toaster/toastergui/templates/mrb_section.html
@@ -119,11 +119,11 @@
119 {%endif%} 119 {%endif%}
120 {%if build.outcome == build.IN_PROGRESS %} 120 {%if build.outcome == build.IN_PROGRESS %}
121 <div class="span4 offset1"> 121 <div class="span4 offset1">
122 <div class="progress" style="margin-top:5px;" data-toggle="tooltip" title="{{build.completeper}}% of tasks complete"> 122 <div class="progress" id="build-pc-done-title-{{build.pk}}" style="margin-top:5px;" data-toggle="tooltip" title="{{build.completeper}}% of tasks complete">
123 <div style="width: {{build.completeper}}%;" class="bar"></div> 123 <div id="build-pc-done-bar-{{build.pk}}" style="width: {{build.completeper}}%;" class="bar"></div>
124 </div> 124 </div>
125 </div> 125 </div>
126 <div class="lead pull-right">{{build.completeper}}% of tasks complete</div> 126 <div class="lead pull-right"><span id="build-pc-done-{{build.pk}}">{{build.completeper}}</span>% of tasks complete</div>
127 {%endif%} 127 {%endif%}
128 </div> 128 </div>
129 </div> 129 </div>
@@ -152,6 +152,64 @@ $(document).ready(function(){
152 btn.parents(".alert").fadeOut(); 152 btn.parents(".alert").fadeOut();
153 }, null); 153 }, null);
154 }); 154 });
155
156 {%if mrb_type == 'project' %}
157 var projectBuilds = true;
158 {% else %}
159 var projectBuilds = false;
160 {% endif %}
161
162 var progressTimer;
163
164 if (projectBuilds === true){
165 progressTimer = window.setInterval(function() {
166 libtoaster.getProjectInfo(libtoaster.ctx.projectPageUrl,
167 function(prjInfo){
168
169 /* These two are needed because a build can be 100% and still
170 * in progress due to the fact that the % done is updated at the
171 * start of a task so it can be doing the last task at 100%
172 */
173 var inProgress = 0;
174 var allPercentDone = 0;
175
176 for (var i in prjInfo.builds){
177 var build = prjInfo.builds[i];
178
179 if (build.status === "In Progress" ||
180 $(".progress .bar").length > 0){
181 /* Update the build progress */
182 var percentDone;
183
184 if (build.status !== "In Progress"){
185 /* We have to ignore the value when it's Succeeded because it
186 * goes back to 0
187 */
188 percentDone = 100;
189 } else {
190 percentDone = build.build[0].completeper;
191 inProgress++;
192 }
193
194 $("#build-pc-done-" + build.id).text(percentDone);
195 $("#build-pc-done-title-" + build.id).attr("title", percentDone);
196 $("#build-pc-done-bar-" + build.id).css("width",
197 String(percentDone) + "%");
198
199 allPercentDone += percentDone;
200 }
201 }
202
203 if (allPercentDone === (100 * prjInfo.builds.length) && !inProgress)
204 window.location.reload();
205
206 /* Our progress bar is not still showing so shutdown the polling. */
207 if ($(".progress .bar").length === 0)
208 window.clearInterval(progressTimer);
209
210 });
211 }, 1500);
212 }
155}); 213});
156 214
157</script> 215</script>