aboutsummaryrefslogtreecommitdiffstats
path: root/lib/toaster/toastergui/static
diff options
context:
space:
mode:
authorElliot Smith <elliot.smith@intel.com>2016-07-11 14:47:06 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-11 00:08:17 +0100
commitf33d51d46d70e73e04e325807c1bc4eb68462f7b (patch)
tree9c7788bd1153eac1d4c7bc924d5291171916835f /lib/toaster/toastergui/static
parentc868ea036aa34b387a72ec5116a66b2cd863995b (diff)
downloadbitbake-contrib-f33d51d46d70e73e04e325807c1bc4eb68462f7b.tar.gz
toaster: show progress of recipe parsing in recent builds area
Modify buildinfohelper and toasterui so that they record the recipe parse progress (from ParseProgress events in bitbake) on the Build object. Note that because the Build object is now created at the point when ParseStarted occurs, it is necessary to set the build name to the empty string initially (hence the migration). The build name can be set when the build properly starts, i.e. at the BuildStarted event. Then use this additional data to determine whether a Build is in a "Parsing" state, and report this in the JSON API. This enables the most recent builds area to show the recipe parse progress. Add additional logic to update the progress bar if the progress for a build object changes. [YOCTO #9631] Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Diffstat (limited to 'lib/toaster/toastergui/static')
-rw-r--r--lib/toaster/toastergui/static/js/mrbsection.js50
1 files changed, 23 insertions, 27 deletions
diff --git a/lib/toaster/toastergui/static/js/mrbsection.js b/lib/toaster/toastergui/static/js/mrbsection.js
index d8c3bf775..e7fbf0173 100644
--- a/lib/toaster/toastergui/static/js/mrbsection.js
+++ b/lib/toaster/toastergui/static/js/mrbsection.js
@@ -33,8 +33,8 @@ function mrbSectionInit(ctx){
return buildData[build.id] || {};
}
- // returns true if a build's state changed to "Succeeded" or "Failed"
- // from some other value
+ // returns true if a build's state changed to "Succeeded", "Failed"
+ // or "Cancelled" from some other value
function buildFinished(build) {
var cached = getCached(build);
return cached.state &&
@@ -49,12 +49,18 @@ function mrbSectionInit(ctx){
return (cached.state !== build.state);
}
- // returns true if the complete_percentage changed
- function progressChanged(build) {
+ // returns true if the tasks_complete_percentage changed
+ function tasksProgressChanged(build) {
var cached = getCached(build);
return (cached.tasks_complete_percentage !== build.tasks_complete_percentage);
}
+ // returns true if the number of recipes parsed/to parse changed
+ function recipeProgressChanged(build) {
+ var cached = getCached(build);
+ return (cached.recipes_parsed_percentage !== build.recipes_parsed_percentage);
+ }
+
function refreshMostRecentBuilds(){
libtoaster.getMostRecentBuilds(
libtoaster.ctx.mostRecentBuildsUrl,
@@ -68,10 +74,6 @@ function mrbSectionInit(ctx){
var colourClass;
var elements;
- // classes on the parent which signify the build state and affect
- // the colour of the container for the build
- var buildStateClasses = 'alert-info alert-success alert-danger';
-
for (var i = 0; i < data.length; i++) {
build = data[i];
@@ -91,31 +93,25 @@ function mrbSectionInit(ctx){
container = $(selector);
container.html(html);
-
- // style the outermost container for this build to reflect
- // the new build state (red, green, blue);
- // NB class set here should be in buildStateClasses
- colourClass = 'alert-info';
- if (build.state == 'Succeeded') {
- colourClass = 'alert-success';
- }
- else if (build.state == 'Failed') {
- colourClass = 'alert-danger';
- }
-
- elements = $('[data-latest-build-result="' + build.id + '"]');
- elements.removeClass(buildStateClasses);
- elements.addClass(colourClass);
}
- else if (progressChanged(build)) {
- // update the progress text
+ else if (tasksProgressChanged(build)) {
+ // update the task progress text
selector = '#build-pc-done-' + build.id;
$(selector).html(build.tasks_complete_percentage);
- // update the progress bar
+ // update the task progress bar
selector = '#build-pc-done-bar-' + build.id;
$(selector).width(build.tasks_complete_percentage + '%');
}
+ else if (recipeProgressChanged(build)) {
+ // update the recipe progress text
+ selector = '#recipes-parsed-percentage-' + build.id;
+ $(selector).html(build.recipes_parsed_percentage);
+
+ // update the recipe progress bar
+ selector = '#recipes-parsed-percentage-bar-' + build.id;
+ $(selector).width(build.recipes_parsed_percentage + '%');
+ }
buildData[build.id] = build;
}
@@ -128,6 +124,6 @@ function mrbSectionInit(ctx){
);
}
- window.setInterval(refreshMostRecentBuilds, 1000);
+ window.setInterval(refreshMostRecentBuilds, 1500);
refreshMostRecentBuilds();
}