In a move to standardise the JSON layer object across API calls we've
renamed a few of the property names/fields. This updates the importlayer
duplicate layer check to use these fields.

Signed-off-by: Michael Wood <[email protected]>
---
 bitbake/lib/toaster/toastergui/static/js/importlayer.js | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/bitbake/lib/toaster/toastergui/static/js/importlayer.js 
b/bitbake/lib/toaster/toastergui/static/js/importlayer.js
index 2fadbc0..8e3031f 100644
--- a/bitbake/lib/toaster/toastergui/static/js/importlayer.js
+++ b/bitbake/lib/toaster/toastergui/static/js/importlayer.js
@@ -195,8 +195,8 @@ function importLayerPageInit (ctx) {
     var dupLayerInfo = $("#duplicate-layer-info");
     dupLayerInfo.find(".dup-layer-name").text(layer.name);
     dupLayerInfo.find(".dup-layer-link").attr("href", layer.layerdetailurl);
-    dupLayerInfo.find("#dup-layer-vcs-url").text(layer.layer__vcs_url);
-    dupLayerInfo.find("#dup-layer-revision").text(layer.revision.commit);
+    dupLayerInfo.find("#dup-layer-vcs-url").text(layer.vcs_url);
+    dupLayerInfo.find("#dup-layer-revision").text(layer.vcs_reference);
 
     $(".fields-apart-from-layer-name").fadeOut(function(){
 
@@ -212,13 +212,12 @@ function importLayerPageInit (ctx) {
 
       /* Check if the layer name exists */
       $.getJSON(libtoaster.ctx.layersTypeAheadUrl,
-        { include_added: "true" , search: name, format: "json" },
+        { include_added: "true" , search: name },
         function(layer) {
-          if (layer.rows.length > 0) {
-            for (var i in layer.rows){
-              if (layer.rows[i].name == name) {
-                console.log(layer.rows[i])
-                layerExistsError(layer.rows[i]);
+          if (layer.results && layer.results.length > 0) {
+            for (var i in layer.results){
+              if (layer.results[i].name == name) {
+                layerExistsError(layer.results[i]);
               }
             }
           }
-- 
2.1.4

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

Reply via email to