From dd99cf957da5836dc9b48d200f15a66f0bbce245 Mon Sep 17 00:00:00 2001 From: Elliot Smith Date: Mon, 11 Jul 2016 14:47:06 +0100 Subject: bitbake: 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] (Bitbake rev: f33d51d46d70e73e04e325807c1bc4eb68462f7b) Signed-off-by: Elliot Smith Signed-off-by: Richard Purdie --- .../lib/toaster/toastergui/static/js/mrbsection.js | 50 ++++++++++------------ 1 file changed, 23 insertions(+), 27 deletions(-) (limited to 'bitbake/lib/toaster/toastergui/static') diff --git a/bitbake/lib/toaster/toastergui/static/js/mrbsection.js b/bitbake/lib/toaster/toastergui/static/js/mrbsection.js index d8c3bf7750..e7fbf01731 100644 --- a/bitbake/lib/toaster/toastergui/static/js/mrbsection.js +++ b/bitbake/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(); } -- cgit v1.2.3-54-g00ecf