[Toaster] [PATCH] toaster: enable add dependent layer button

Barros Pena, Belen belen.barros.pena at intel.com
Wed Aug 24 07:37:39 PDT 2016



On 24/08/2016 09:25, "Reyna, David" <david.reyna at windriver.com> wrote:

>Hi all,
> 
>I have posted a patch for 9936 here:
>   
>http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib?h=dreyna%2Flayer_de
>p_button_9936 
><http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib?h=dreyna%2Flayer_d
>ep_button_9936>

>From the UI side, this looks good to me.

Thanks!

Belén

> 
>The patch content is below. Note that I had to do trial and error to find
>the actual arguments sent to the
>"typeahead:render" event handler, because it does not match the
>documentation, and I have included
> a comment in the patch
>to pass that information on. The
>"typeahead:render" event handler also
>often gets intermediate calls
> with no items in its parameter list, so those have to be ignored.
> 
>I did a git send mail, but I have not seen it reflect yet from the
>Toaster email list.
> 
>- David
> 
>==============
>From cc2a697632e6101aff17973cb7899edbbe8e5ad4 Mon Sep 17 00:00:00 2001
>From: David Reyna <David.Reyna at windriver.com>
>Date: Tue, 23 Aug 2016 16:40:58 -0700
>Subject: toaster: enable add dependent layer button
> 
>The "typeahead:select" event is added to enable the add
>dependent layer button when a layer is selected from the
>type ahead list.
> 
>The "typeahead:render" event is added to fill a list with
>the current filtered type ahead list of matching layer
>names, so that the "input change" event knows to enable
>the import layer button if the layer name is in that
>captured list.
> 
>[YOCTO #9936]
> 
>Signed-off-by: David Reyna <david.reyna at windriver.com>
> 
>diff --git a/bitbake/lib/toaster/toastergui/static/js/importlayer.js
>b/bitbake/lib/toaster/toastergui/static/js/importlayer.js
>index 191b30f..08142e8 100644
>--- a/bitbake/lib/toaster/toastergui/static/js/importlayer.js
>+++ b/bitbake/lib/toaster/toastergui/static/js/importlayer.js
>@@ -24,15 +24,23 @@ function importLayerPageInit (ctx) {
>   // choices available in the typeahead
>   var layerDepsChoices = {};
> 
>+  // when a typeahead choice is selected, enabling the "Add layer" button
>+  // since we know for sure this is a valid layer
>+  layerDepInput.on("typeahead:select", function (event, data) {
>+    if (data.name) {
>+      layerDepBtn.removeAttr("disabled");
>+    }
>+  });
>+
>   // when the typeahead choices change, store an array of the available
>layer
>   // choices locally, to use for enabling/disabling the "Add layer"
>button
>-  layerDepInput.on("typeahead-choices-change", function (event, data) {
>-    layerDepsChoices = {};
>-
>-    if (data.choices) {
>-      data.choices.forEach(function (item) {
>-        layerDepsChoices[item.name] = item;
>-      });
>+  //  layerDepInput.on("typeahead:render", function (event,
>[item[,item]*]) {
>+  layerDepInput.on("typeahead:render", function (event, items) {
>+    for (var i = 1, j = arguments.length; i < j; i++){
>+      if (i == 1) {
>+        layerDepsChoices = {};
>+      }
>+      layerDepsChoices[arguments[i].name] = arguments[i];
>     }
>   });
> 
>-- 
>cgit v0.10.2
> 
> 



More information about the toaster mailing list