Skip to contentSkip to conversation

bitbake: toaster: BuildButton target input allow building targets with tasks

PATCH In review Michael Wood 3 participants 5 messages Mar 27, 2015 – Apr 16, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 bitbake: toaster: BuildButton target input allow building targets with tasks

Allow the input for targets to contain tasks in the form target:task

[YOCTO #7501]

---
 bitbake/lib/toaster/toastergui/static/js/base.js | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
bitbake/lib/toaster/toastergui/static/js/base.js +2 -3
index 777ab43..f57e4d9 100644
@@ -88,10 +88,9 @@ function basePageInit (ctx) {
       if (!newBuildTargetInput.val())
         return;
 
-      if (!selectedTarget)
-        selectedTarget = { name: newBuildTargetInput.val() };
+      var selectedTargetName = newBuildTargetInput.val();
       /* fire and forget */
-      libtoaster.startABuild(ctx.projectBuildUrl, ctx.projectId, selectedTarget.name, null, null);
+      libtoaster.startABuild(ctx.projectBuildUrl, ctx.projectId, selectedTargetName, null, null);
       window.location.replace(ctx.projectPageUrl+ctx.projectId);
     });
 
Signature · 1 line
2.1.0
#1 lore raw

PATCH 2/2 bitbake: toaster: base.js minor jshint fixes

Fixing errors identified by jshint, some missing semicolons and preference for === operator. Also pass the urldata in libtoaster as an object rather than constructing a query string.

---
 bitbake/lib/toaster/toastergui/static/js/base.js      | 19 +++++++++----------
 .../lib/toaster/toastergui/static/js/libtoaster.js    |  9 ++++-----
 2 files changed, 13 insertions(+), 15 deletions(-)
bitbake/lib/toaster/toastergui/static/js/base.js +9 -10
index f57e4d9..667c5df 100644
@@ -6,7 +6,7 @@ function basePageInit (ctx) {
   /* Hide the button if we're on the project,newproject or importlyaer page
    * or if there are no projects yet defined
    */
-  if (ctx.numProjects == 0 || ctx.currentUrl.search('newproject|project/\\d/$|importlayer/$') > 0){
+  if (ctx.numProjects === 0 || ctx.currentUrl.search('newproject|project/\\d/$|importlayer/$') > 0){
       newBuildButton.hide();
       return;
   }
@@ -18,17 +18,17 @@ function basePageInit (ctx) {
 
   newBuildButton.show().removeAttr("disabled");
 
-  _checkProjectBuildable()
+  _checkProjectBuildable();
   _setupNewBuildButton();
 
 
   function _checkProjectBuildable(){
-    if (ctx.projectId == undefined)
+    if (ctx.projectId === undefined)
       return;
 
     libtoaster.getProjectInfo(ctx.projectInfoUrl, ctx.projectId,
       function(data){
-        if (data.machine.name == undefined || data.layers.length == 0) {
+        if (data.machine.name === undefined || data.layers.length === 0) {
           /* we can't build anything with out a machine and some layers */
           $("#new-build-button #targets-form").hide();
           $("#new-build-button .alert").show();
@@ -51,7 +51,7 @@ function basePageInit (ctx) {
     /* If we don't have a current project then present the set project
      * form.
      */
-    if (ctx.projectId == undefined) {
+    if (ctx.projectId === undefined) {
       $('#change-project-form').show();
       $('#project .icon-pencil').hide();
     }
@@ -72,13 +72,13 @@ function basePageInit (ctx) {
      * the value that has been set by selecting a suggestion from the typeahead
      */
     newBuildProjectInput.on('input', function(event) {
-        if (event.keyCode == 13)
+        if (event.keyCode === 13)
           return;
         newBuildProjectSaveBtn.attr("disabled", "disabled");
     });
 
     newBuildTargetInput.on('input', function() {
-      if ($(this).val().length == 0)
+      if ($(this).val().length === 0)
         newBuildTargetBuildBtn.attr("disabled", "disabled");
       else
         newBuildTargetBuildBtn.removeAttr("disabled");
@@ -95,7 +95,7 @@ function basePageInit (ctx) {
     });
 
     newBuildProjectSaveBtn.click(function() {
-      ctx.projectId = selectedProject.id
+      ctx.projectId = selectedProject.id;
       /* Update the typeahead project_id paramater */
       _checkProjectBuildable();
       newBuildTargetInput.data('typeahead').options.xhrParams.project_id = ctx.projectId;
@@ -130,6 +130,5 @@ function basePageInit (ctx) {
     $(".new-build").click (function(event) {
       event.stopPropagation();
     });
-  };
-
+  }
 }
bitbake/lib/toaster/toastergui/static/js/libtoaster.js +4 -5
index fcf82ac..ae9e455 100644
@@ -67,12 +67,11 @@ var libtoaster = (function (){
   /*
    * url - the url of the xhr build */
   function _startABuild (url, project_id, targets, onsuccess, onfail) {
-    var data;
 
-    if (project_id)
-      data = 'project_id='+project_id+'&targets='+targets;
-    else
-      data = 'targets='+targets;
+    var data = {
+      project_id : project_id,
+      targets : targets,
+    }
 
     $.ajax( {
         type: "POST",
Signature · 1 line
2.1.0
#2 lore raw

Re: [review-request][PATCH 2/2] bitbake: toaster: base.js minor jshint fixes

Taken for submission,

Thank you,
Alex

Quoted 125 lines · Michael Wood

Fixing errors identified by jshint, some missing semicolons and preference for === operator. Also pass the urldata in libtoaster as an object rather than constructing a query string.

---
 bitbake/lib/toaster/toastergui/static/js/base.js      | 19
+++++++++----------
 .../lib/toaster/toastergui/static/js/libtoaster.js    |  9 ++++-----
 2 files changed, 13 insertions(+), 15 deletions(-)
bitbake/lib/toaster/toastergui/static/js/base.js +0 -0
index f57e4d9..667c5df 100644
@@ -6,7 +6,7 @@ function basePageInit (ctx) {
   /* Hide the button if we're on the project,newproject or importlyaer

page
* or if there are no projects yet defined
*/
- if (ctx.numProjects == 0 || ctx.currentUrl.search('newproject|project/\\d/$|importlayer/$') > 0){
+ if (ctx.numProjects === 0 ||

ctx.currentUrl.search('newproject|project/\\d/$|importlayer/$') > 0){
       newBuildButton.hide();
       return;

}

bitbake/lib/toaster/toastergui/static/js/base.js +3 -3
@@ -18,17 +18,17 @@ function basePageInit (ctx) {
 
   newBuildButton.show().removeAttr("disabled");
 
-  _checkProjectBuildable()
+  _checkProjectBuildable();
   _setupNewBuildButton();
 
 
   function _checkProjectBuildable(){
-    if (ctx.projectId == undefined)
+    if (ctx.projectId === undefined)
       return;
 
     libtoaster.getProjectInfo(ctx.projectInfoUrl, ctx.projectId,
       function(data){
-        if (data.machine.name == undefined || data.layers.length == 0) {
+        if (data.machine.name === undefined || data.layers.length === 0)
 {
           /* we can't build anything with out a machine and some layers */
           $("#new-build-button #targets-form").hide();
           $("#new-build-button .alert").show();
bitbake/lib/toaster/toastergui/static/js/base.js +1 -1
@@ -51,7 +51,7 @@ function basePageInit (ctx) {
     /* If we don't have a current project then present the set project
      * form.
      */
-    if (ctx.projectId == undefined) {
+    if (ctx.projectId === undefined) {
       $('#change-project-form').show();
       $('#project .icon-pencil').hide();
     }
@@ -72,13 +72,13 @@ function basePageInit (ctx) {
      * the value that has been set by selecting a suggestion from the

typeahead

      */
     newBuildProjectInput.on('input', function(event) {
bitbake/lib/toaster/toastergui/static/js/base.js +3 -3
-        if (event.keyCode == 13)
+        if (event.keyCode === 13)
           return;
         newBuildProjectSaveBtn.attr("disabled", "disabled");
     });
 
     newBuildTargetInput.on('input', function() {
-      if ($(this).val().length == 0)
+      if ($(this).val().length === 0)
         newBuildTargetBuildBtn.attr("disabled", "disabled");
       else
         newBuildTargetBuildBtn.removeAttr("disabled");
@@ -95,7 +95,7 @@ function basePageInit (ctx) {
     });
 
     newBuildProjectSaveBtn.click(function() {
-      ctx.projectId = selectedProject.id
+      ctx.projectId = selectedProject.id;
       /* Update the typeahead project_id paramater */
       _checkProjectBuildable();
       newBuildTargetInput.data('typeahead').options.xhrParams.project_id

= ctx.projectId;

bitbake/lib/toaster/toastergui/static/js/base.js +1 -2
@@ -130,6 +130,5 @@ function basePageInit (ctx) {
     $(".new-build").click (function(event) {
       event.stopPropagation();
     });
-  };
-
+  }
 }
bitbake/lib/toaster/toastergui/static/js/libtoaster.js +4 -6
index fcf82ac..ae9e455 100644
@@ -67,12 +67,11 @@ var libtoaster = (function (){
   /*
    * url - the url of the xhr build */
   function _startABuild (url, project_id, targets, onsuccess, onfail) {
-    var data;
 
-    if (project_id)
-      data = 'project_id='+project_id+'&targets='+targets;
-    else
-      data = 'targets='+targets;
+    var data = {
+      project_id : project_id,
+      targets : targets,
+    }
 
     $.ajax( {
         type: "POST",
--

2.1.0

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

Signature · 3 lines
Alex Damian
Yocto Project
SSG / OTC
#3 lore raw
In reply to Michael Wood
Quoted 3 lines · Michael Wood

Allow the input for targets to contain tasks in the form target:task

[YOCTO #7501]

This works great.

Thanks!

Belén

Quoted 34 lines

---
bitbake/lib/toaster/toastergui/static/js/base.js | 5 ++---

1 file changed, 2 insertions(+), 3 deletions(-)
bitbake/lib/toaster/toastergui/static/js/base.js +2 -3
index 777ab43..f57e4d9 100644
@@ -88,10 +88,9 @@ function basePageInit (ctx) {
      if (!newBuildTargetInput.val())
        return;
 
-      if (!selectedTarget)
-        selectedTarget = { name: newBuildTargetInput.val() };
+      var selectedTargetName = newBuildTargetInput.val();
      /* fire and forget */
-      libtoaster.startABuild(ctx.projectBuildUrl, ctx.projectId,
 selectedTarget.name, null, null);
+      libtoaster.startABuild(ctx.projectBuildUrl, ctx.projectId,
 selectedTargetName, null, null);
      window.location.replace(ctx.projectPageUrl+ctx.projectId);
    });
Signature · 7 lines
2.1.0

-- 
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster
#4 lore raw

Taken for submission,

Thank you,
Alex

Quoted 54 lines · Belen
Quoted 3 lines · Michael Wood

Allow the input for targets to contain tasks in the form target:task

[YOCTO #7501]

This works great.

Thanks!

Belén

Quoted 26 lines

---
bitbake/lib/toaster/toastergui/static/js/base.js | 5 ++---

1 file changed, 2 insertions(+), 3 deletions(-)
bitbake/lib/toaster/toastergui/static/js/base.js +2 -3
index 777ab43..f57e4d9 100644
@@ -88,10 +88,9 @@ function basePageInit (ctx) {
      if (!newBuildTargetInput.val())
        return;
 
-      if (!selectedTarget)
-        selectedTarget = { name: newBuildTargetInput.val() };
+      var selectedTargetName = newBuildTargetInput.val();
      /* fire and forget */
-      libtoaster.startABuild(ctx.projectBuildUrl, ctx.projectId,
 selectedTarget.name, null, null);
+      libtoaster.startABuild(ctx.projectBuildUrl, ctx.projectId,
 selectedTargetName, null, null);
      window.location.replace(ctx.projectPageUrl+ctx.projectId);
    });
Quoted 8 lines

--
2.1.0

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

Signature · 3 lines
Alex Damian
Yocto Project
SSG / OTC