diff options
author | Elliot Smith <elliot.smith@intel.com> | 2016-07-11 14:47:06 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-08-11 00:09:26 +0100 |
commit | dd99cf957da5836dc9b48d200f15a66f0bbce245 (patch) | |
tree | e7b8b8fa6b88520aabd6f17bc41cc8410af66761 /bitbake/lib/toaster/toastergui/static | |
parent | 952ffb3e1f4a00793e0c9c49bc0c8fb8729424c4 (diff) | |
download | poky-dd99cf957da5836dc9b48d200f15a66f0bbce245.tar.gz |
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 <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static')
-rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/mrbsection.js | 50 |
1 files changed, 23 insertions, 27 deletions
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){ | |||
33 | return buildData[build.id] || {}; | 33 | return buildData[build.id] || {}; |
34 | } | 34 | } |
35 | 35 | ||
36 | // returns true if a build's state changed to "Succeeded" or "Failed" | 36 | // returns true if a build's state changed to "Succeeded", "Failed" |
37 | // from some other value | 37 | // or "Cancelled" from some other value |
38 | function buildFinished(build) { | 38 | function buildFinished(build) { |
39 | var cached = getCached(build); | 39 | var cached = getCached(build); |
40 | return cached.state && | 40 | return cached.state && |
@@ -49,12 +49,18 @@ function mrbSectionInit(ctx){ | |||
49 | return (cached.state !== build.state); | 49 | return (cached.state !== build.state); |
50 | } | 50 | } |
51 | 51 | ||
52 | // returns true if the complete_percentage changed | 52 | // returns true if the tasks_complete_percentage changed |
53 | function progressChanged(build) { | 53 | function tasksProgressChanged(build) { |
54 | var cached = getCached(build); | 54 | var cached = getCached(build); |
55 | return (cached.tasks_complete_percentage !== build.tasks_complete_percentage); | 55 | return (cached.tasks_complete_percentage !== build.tasks_complete_percentage); |
56 | } | 56 | } |
57 | 57 | ||
58 | // returns true if the number of recipes parsed/to parse changed | ||
59 | function recipeProgressChanged(build) { | ||
60 | var cached = getCached(build); | ||
61 | return (cached.recipes_parsed_percentage !== build.recipes_parsed_percentage); | ||
62 | } | ||
63 | |||
58 | function refreshMostRecentBuilds(){ | 64 | function refreshMostRecentBuilds(){ |
59 | libtoaster.getMostRecentBuilds( | 65 | libtoaster.getMostRecentBuilds( |
60 | libtoaster.ctx.mostRecentBuildsUrl, | 66 | libtoaster.ctx.mostRecentBuildsUrl, |
@@ -68,10 +74,6 @@ function mrbSectionInit(ctx){ | |||
68 | var colourClass; | 74 | var colourClass; |
69 | var elements; | 75 | var elements; |
70 | 76 | ||
71 | // classes on the parent which signify the build state and affect | ||
72 | // the colour of the container for the build | ||
73 | var buildStateClasses = 'alert-info alert-success alert-danger'; | ||
74 | |||
75 | for (var i = 0; i < data.length; i++) { | 77 | for (var i = 0; i < data.length; i++) { |
76 | build = data[i]; | 78 | build = data[i]; |
77 | 79 | ||
@@ -91,31 +93,25 @@ function mrbSectionInit(ctx){ | |||
91 | container = $(selector); | 93 | container = $(selector); |
92 | 94 | ||
93 | container.html(html); | 95 | container.html(html); |
94 | |||
95 | // style the outermost container for this build to reflect | ||
96 | // the new build state (red, green, blue); | ||
97 | // NB class set here should be in buildStateClasses | ||
98 | colourClass = 'alert-info'; | ||
99 | if (build.state == 'Succeeded') { | ||
100 | colourClass = 'alert-success'; | ||
101 | } | ||
102 | else if (build.state == 'Failed') { | ||
103 | colourClass = 'alert-danger'; | ||
104 | } | ||
105 | |||
106 | elements = $('[data-latest-build-result="' + build.id + '"]'); | ||
107 | elements.removeClass(buildStateClasses); | ||
108 | elements.addClass(colourClass); | ||
109 | } | 96 | } |
110 | else if (progressChanged(build)) { | 97 | else if (tasksProgressChanged(build)) { |
111 | // update the progress text | 98 | // update the task progress text |
112 | selector = '#build-pc-done-' + build.id; | 99 | selector = '#build-pc-done-' + build.id; |
113 | $(selector).html(build.tasks_complete_percentage); | 100 | $(selector).html(build.tasks_complete_percentage); |
114 | 101 | ||
115 | // update the progress bar | 102 | // update the task progress bar |
116 | selector = '#build-pc-done-bar-' + build.id; | 103 | selector = '#build-pc-done-bar-' + build.id; |
117 | $(selector).width(build.tasks_complete_percentage + '%'); | 104 | $(selector).width(build.tasks_complete_percentage + '%'); |
118 | } | 105 | } |
106 | else if (recipeProgressChanged(build)) { | ||
107 | // update the recipe progress text | ||
108 | selector = '#recipes-parsed-percentage-' + build.id; | ||
109 | $(selector).html(build.recipes_parsed_percentage); | ||
110 | |||
111 | // update the recipe progress bar | ||
112 | selector = '#recipes-parsed-percentage-bar-' + build.id; | ||
113 | $(selector).width(build.recipes_parsed_percentage + '%'); | ||
114 | } | ||
119 | 115 | ||
120 | buildData[build.id] = build; | 116 | buildData[build.id] = build; |
121 | } | 117 | } |
@@ -128,6 +124,6 @@ function mrbSectionInit(ctx){ | |||
128 | ); | 124 | ); |
129 | } | 125 | } |
130 | 126 | ||
131 | window.setInterval(refreshMostRecentBuilds, 1000); | 127 | window.setInterval(refreshMostRecentBuilds, 1500); |
132 | refreshMostRecentBuilds(); | 128 | refreshMostRecentBuilds(); |
133 | } | 129 | } |