summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/importlayer.js30
1 files changed, 5 insertions, 25 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/importlayer.js b/bitbake/lib/toaster/toastergui/static/js/importlayer.js
index 570ca3369b..30dc28280e 100644
--- a/bitbake/lib/toaster/toastergui/static/js/importlayer.js
+++ b/bitbake/lib/toaster/toastergui/static/js/importlayer.js
@@ -21,21 +21,11 @@ function importLayerPageInit (ctx) {
21 libtoaster.ctx.layersTypeAheadUrl, 21 libtoaster.ctx.layersTypeAheadUrl,
22 { include_added: "true" }, function(item){ 22 { include_added: "true" }, function(item){
23 currentLayerDepSelection = item; 23 currentLayerDepSelection = item;
24 layerDepBtn.removeAttr("disabled");
24 }); 25 });
25 26
26 // choices available in the typeahead 27 layerDepInput.on("typeahead:select", function(event, data){
27 var layerDepsChoices = {}; 28 currentLayerDepSelection = data;
28
29 // when the typeahead choices change, store an array of the available layer
30 // choices locally, to use for enabling/disabling the "Add layer" button
31 layerDepInput.on("typeahead-choices-change", function (event, data) {
32 layerDepsChoices = {};
33
34 if (data.choices) {
35 data.choices.forEach(function (item) {
36 layerDepsChoices[item.name] = item;
37 });
38 }
39 }); 29 });
40 30
41 // Disable local dir repo when page is loaded. 31 // Disable local dir repo when page is loaded.
@@ -43,18 +33,8 @@ function importLayerPageInit (ctx) {
43 33
44 // disable the "Add layer" button when the layer input typeahead is empty 34 // disable the "Add layer" button when the layer input typeahead is empty
45 // or not in the typeahead choices 35 // or not in the typeahead choices
46 layerDepInput.on("input change", function () { 36 layerDepInput.on("input change", function(){
47 // get the choices from the typeahead 37 layerDepBtn.attr("disabled","disabled");
48 var choice = layerDepsChoices[$(this).val()];
49
50 if (choice) {
51 layerDepBtn.removeAttr("disabled");
52 currentLayerDepSelection = choice;
53 }
54 else {
55 layerDepBtn.attr("disabled","disabled");
56 currentLayerDepSelection = undefined;
57 }
58 }); 38 });
59 39
60 /* We automatically add "openembedded-core" layer for convenience as a 40 /* We automatically add "openembedded-core" layer for convenience as a