Skip to contentSkip to conversation

toaster: fix progress bar in MySQL environment

PATCH In review Elliot Smith 2 participants 3 messages May 13, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 toaster: fix progress bar in MySQL environment

When using MySQL, the project builds info delivered by MySQL differs from that delivered by SQLite: the former returns text values from the enumeration for Build outcomes, while the latter returns the integer value. This causes the progress bar JS to break, as it is expecting outcome strings.

Modify the recent_build() method to include an outcomeText property for each Build object, then use this in the conditionals in the progress bar JS.

[YOCTO #9498]

---
 bitbake/lib/toaster/orm/models.py                      | 1 +
 bitbake/lib/toaster/toastergui/static/js/mrbsection.js | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
bitbake/lib/toaster/orm/models.py +1 -0
index 2669606..88967a2 100644
@@ -416,6 +416,7 @@ class Build(models.Model):
         # to show build progress in mrb_section.html
         for build in recent_builds:
             build.percentDone = build.completeper()
+            build.outcomeText = build.get_outcome_text()
 
         return recent_builds
 
bitbake/lib/toaster/toastergui/static/js/mrbsection.js +2 -2
index 09117e1..9a76ee6 100644
@@ -57,12 +57,12 @@ function mrbSectionInit(ctx){
           for (var i in prjInfo.builds){
             var build = prjInfo.builds[i];
 
-            if (build.outcome === "In Progress" ||
+            if (build.outcomeText === "In Progress" ||
                $(".progress .bar").length > 0){
               /* Update the build progress */
               var percentDone;
 
-              if (build.outcome !== "In Progress"){
+              if (build.outcomeText !== "In Progress"){
                 /* We have to ignore the value when it's Succeeded because it
                 *   goes back to 0
                 */
Signature · 12 lines
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#1 lore raw
Quoted 6 lines · Elliot Smith

When using MySQL, the project builds info delivered by MySQL differs from that delivered by SQLite: the former returns text values from the enumeration for Build outcomes, while the latter returns the integer value. This causes the progress bar JS to break, as it is expecting outcome strings.

This patch also applies to krogoth, so it could be back-ported to that if we wanted to fix krogoth's support for production environments.

Elliot

Quoted 62 lines

Modify the recent_build() method to include an outcomeText property for each Build object, then use this in the conditionals in the progress bar JS.

[YOCTO #9498]

---
 bitbake/lib/toaster/orm/models.py                      | 1 +
 bitbake/lib/toaster/toastergui/static/js/mrbsection.js | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
bitbake/lib/toaster/orm/models.py +1 -0
index 2669606..88967a2 100644
@@ -416,6 +416,7 @@ class Build(models.Model):
         # to show build progress in mrb_section.html
         for build in recent_builds:
             build.percentDone = build.completeper()
+            build.outcomeText = build.get_outcome_text()
 
         return recent_builds
 
bitbake/lib/toaster/toastergui/static/js/mrbsection.js +2 -2
index 09117e1..9a76ee6 100644
@@ -57,12 +57,12 @@ function mrbSectionInit(ctx){
           for (var i in prjInfo.builds){
             var build = prjInfo.builds[i];
 
-            if (build.outcome === "In Progress" ||
+            if (build.outcomeText === "In Progress" ||
                $(".progress .bar").length > 0){
               /* Update the build progress */
               var percentDone;
 
-              if (build.outcome !== "In Progress"){
+              if (build.outcomeText !== "In Progress"){
                 /* We have to ignore the value when it's Succeeded

because it
* goes back to 0
*/
--
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

Signature · 3 lines
Elliot Smith
Software Engineer
Intel Open Source Technology Centre
#2 lore raw
Quoted 10 lines · Elliot

On 13 May 2016 at 11:40, Elliot Smith <[email protected] <mailto:[email protected]>> wrote:

When using MySQL, the project builds info delivered by MySQL differs from that delivered by SQLite: the former returns text values from the enumeration for Build outcomes, while the latter returns the integer value. This causes the progress bar JS to break, as it is expecting outcome strings.

Quoted 2 lines

This patch also applies to krogoth, so it could be back-ported to that if we wanted to fix krogoth's support for production environments.

Thanks I've pushed it to toaster-next and also sent it upstream to bitbake master and 1.30

Quoted 74 lines

Elliot

Modify the recent_build() method to include an outcomeText property for each Build object, then use this in the conditionals in the progress bar JS.

[YOCTO #9498]

<mailto:[email protected]>>
---
bitbake/lib/toaster/orm/models.py | 1 +
bitbake/lib/toaster/toastergui/static/js/mrbsection.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 2669606..88967a2 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -416,6 +416,7 @@ class Build(models.Model):
# to show build progress in mrb_section.html for build in recent_builds:
build.percentDone = build.completeper()
+ build.outcomeText = build.get_outcome_text()

return recent_builds

diff --git a/bitbake/lib/toaster/toastergui/static/js/mrbsection.js b/bitbake/lib/toaster/toastergui/static/js/mrbsection.js index 09117e1..9a76ee6 100644
--- a/bitbake/lib/toaster/toastergui/static/js/mrbsection.js +++ b/bitbake/lib/toaster/toastergui/static/js/mrbsection.js @@ -57,12 +57,12 @@ function mrbSectionInit(ctx){
for (var i in prjInfo.builds){
var build = prjInfo.builds[i];

- if (build.outcome === "In Progress" ||
+ if (build.outcomeText === "In Progress" ||
$(".progress .bar").length > 0){
/* Update the build progress */ var percentDone;

- if (build.outcome !== "In Progress"){
+ if (build.outcomeText !== "In Progress"){
/* We have to ignore the value when it's
Succeeded because it
* goes back to 0
*/
--
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited Registered No. 1134945 (England) Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

Signature · 3 lines
Elliot Smith
Software Engineer
Intel Open Source Technology Centre