[bitbake-devel] [PATCH 04/22] bitbake: toastergui: importlayer Add format type to JSON calls

Ed Bartosh ed.bartosh at linux.intel.com
Fri Jul 31 12:09:05 UTC 2015


From: Michael Wood <michael.g.wood at intel.com>

After API was changed we now need to pass the parameter "format=json" as
a get parameter when requesting a json payload. Otherwise we get the
html version of the page instead of the data we need.

Signed-off-by: Michael Wood <michael.g.wood at intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
---
 lib/toaster/toastergui/static/js/importlayer.js | 28 ++++++++++++++-----------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/lib/toaster/toastergui/static/js/importlayer.js b/lib/toaster/toastergui/static/js/importlayer.js
index e9d7ae8..df48e84 100644
--- a/lib/toaster/toastergui/static/js/importlayer.js
+++ b/lib/toaster/toastergui/static/js/importlayer.js
@@ -28,9 +28,11 @@ function importLayerPageInit (ctx) {
   /* We automatically add "openembedded-core" layer for convenience as a
    * dependency as pretty much all layers depend on this one
    */
-  $.getJSON(libtoaster.ctx.projectLayersUrl, { include_added: "true" , search: "openembedded-core" }, function(layer) {
-    if (layer.list.length == 1) {
-      currentLayerDepSelection = layer.list[0];
+  $.getJSON(libtoaster.ctx.projectLayersUrl,
+    { include_added: "true" , search: "openembedded-core", format: "json" },
+    function(layer) {
+    if (layer.rows.length > 0) {
+      currentLayerDepSelection = layer.rows[0];
       layerDepBtn.click();
     }
   });
@@ -211,16 +213,18 @@ function importLayerPageInit (ctx) {
       var name = $(this).val();
 
       /* Check if the layer name exists */
-      $.getJSON(libtoaster.ctx.projectLayersUrl, { include_added: "true" , search: name }, function(layer) {
-      if (layer.list.length > 0) {
-        for (var i in layer.list){
-          if (layer.list[i].name == name) {
-            console.log(layer.list[i])
-            layerExistsError(layer.list[i]);
+      $.getJSON(libtoaster.ctx.projectLayersUrl,
+        { include_added: "true" , search: name, format: "json" },
+        function(layer) {
+          if (layer.list.length > 0) {
+            for (var i in layer.list){
+              if (layer.list[i].name == name) {
+                console.log(layer.list[i])
+                layerExistsError(layer.list[i]);
+              }
+            }
           }
-        }
-      }
-    });
+      });
   });
 
   vcsURLInput.on('input', function() {
-- 
2.1.4




More information about the bitbake-devel mailing list