summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/importlayer.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/importlayer.js b/bitbake/lib/toaster/toastergui/static/js/importlayer.js
index 296483985a..8e2032de26 100644
--- a/bitbake/lib/toaster/toastergui/static/js/importlayer.js
+++ b/bitbake/lib/toaster/toastergui/static/js/importlayer.js
@@ -17,11 +17,15 @@ function importLayerPageInit (ctx) {
17 var currentLayerDepSelection; 17 var currentLayerDepSelection;
18 var validLayerName = /^(\w|-)+$/; 18 var validLayerName = /^(\w|-)+$/;
19 19
20 /* Catch 'disable' race condition between type-ahead started and "input change" */
21 var typeAheadStarted = 0;
22
20 libtoaster.makeTypeahead(layerDepInput, 23 libtoaster.makeTypeahead(layerDepInput,
21 libtoaster.ctx.layersTypeAheadUrl, 24 libtoaster.ctx.layersTypeAheadUrl,
22 { include_added: "true" }, function(item){ 25 { include_added: "true" }, function(item){
23 currentLayerDepSelection = item; 26 currentLayerDepSelection = item;
24 layerDepBtn.removeAttr("disabled"); 27 layerDepBtn.removeAttr("disabled");
28 typeAheadStarted = 1;
25 }); 29 });
26 30
27 layerDepInput.on("typeahead:select", function(event, data){ 31 layerDepInput.on("typeahead:select", function(event, data){
@@ -34,7 +38,10 @@ function importLayerPageInit (ctx) {
34 // disable the "Add layer" button when the layer input typeahead is empty 38 // disable the "Add layer" button when the layer input typeahead is empty
35 // or not in the typeahead choices 39 // or not in the typeahead choices
36 layerDepInput.on("input change", function(){ 40 layerDepInput.on("input change", function(){
37 layerDepBtn.attr("disabled","disabled"); 41 if (0 == typeAheadStarted) {
42 layerDepBtn.attr("disabled","disabled");
43 }
44 typeAheadStarted = 0;
38 }); 45 });
39 46
40 /* We automatically add "openembedded-core" layer for convenience as a 47 /* We automatically add "openembedded-core" layer for convenience as a
@@ -50,6 +57,7 @@ function importLayerPageInit (ctx) {
50 }); 57 });
51 58
52 layerDepBtn.click(function(){ 59 layerDepBtn.click(function(){
60 typeAheadStarted = 0;
53 if (currentLayerDepSelection == undefined) 61 if (currentLayerDepSelection == undefined)
54 return; 62 return;
55 63
@@ -77,7 +85,7 @@ function importLayerPageInit (ctx) {
77 85
78 $("#layer-deps-list").append(newLayerDep); 86 $("#layer-deps-list").append(newLayerDep);
79 87
80 libtoaster.getLayerDepsForProject(currentLayerDepSelection.layerdetailurl, 88 libtoaster.getLayerDepsForProject(currentLayerDepSelection.xhrLayerUrl,
81 function (data){ 89 function (data){
82 /* These are the dependencies of the layer added as a dependency */ 90 /* These are the dependencies of the layer added as a dependency */
83 if (data.list.length > 0) { 91 if (data.list.length > 0) {