Bug 9936 - The "Add layer" button in the import layer page is always disabled
Summary: The "Add layer" button in the import layer page is always disabled
Status: VERIFIED FIXED
Alias: None
Product: Toaster
Classification: Build System, Metadata & Runtime
Component: toaster (show other bugs)
Version: 2.2
Hardware: x86 Multiple
: Medium normal
Target Milestone: 2.2 M4
Assignee: Michael Wood
QA Contact: Libertad
URL:
Whiteboard:
: 10042 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-07-14 12:56 UTC by Belen Barros Pena
Modified: 2016-10-24 22:08 UTC (History)
8 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Belen Barros Pena 2016-07-14 12:56:15 UTC
Steps to reproduce:

1. Create a Toaster project
2. Go to the "Import layer" page
3. Scroll down to the bottom of the page, where the "Layer dependencies" section is, and try to add a layer to the list of dependencies (e.g meta-oe)

Outcome: when you select meta-oe from the typeahead suggestions, the "add layer" button remains disabled, so you can't add any layer dependencies
Comment 1 Belen Barros Pena 2016-07-21 09:42:29 UTC
Comment from Michael Wood: 

"that bug with the layer dependencies in the import layer page is because the typeahead isn't populating layerDepsChoices which is what is checked to see if you've selected a valid choice"
Comment 2 Belen Barros Pena 2016-07-21 09:46:48 UTC
Also from Michael: 

"the event for the new typehead is .on("typeahead:select", ..  instead of "typeahead-choices-change'. if you changed that, and added the button toggle disabled/enabled that might be it"
Comment 3 Belen Barros Pena 2016-07-28 09:21:03 UTC
*** Bug 10042 has been marked as a duplicate of this bug. ***
Comment 4 David Reyna 2016-08-23 06:36:19 UTC
The current "typeahead-choices-change" method does not work, as Michael observed.

If I replace with this function, then selecting a layer from the typeahead list will safely enable the "Add" button, and disable it when the user manually changes the edit box.

  // 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");
    }
  });

What I cannot yet figure out is how to fetch the active list of lookahead layer names from the widget, so that I can test against that list when the layerDepInput.on("input change",...) is invoked - doing what "typeahead-choices-change" was supposed to provide.
Comment 5 Belen Barros Pena 2016-08-24 14:45:24 UTC
Patch submitted for review to the toaster mailing list

https://lists.yoctoproject.org/pipermail/toaster/2016-August/005131.html
Comment 6 Michael Wood 2016-10-06 14:16:42 UTC
http://git.yoctoproject.org/cgit/cgit.cgi/poky/atom/8df56061f63b63b77a0c7a7ddd75812e3b5a88c4
Fix regression introduced by switching typeahead library. Make sure we
enable and disable the add button based on whether the selection event
has fired or not.

[YOCTO #9936]

(Bitbake rev: cfef79e98b023252cd116d6cc4f90d261d47d13f)
Comment 7 David Lopez Barriba 2016-10-24 22:08:35 UTC
Verified on commit : 4b94b498e21aeba945fe7e72a6b7c4bb0314fb83
works ok