summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorDavid Reyna <David.Reyna@windriver.com>2019-10-01 16:17:50 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-10-02 14:42:13 +0100
commit1ca006c7b6036a6fbd40d8a2efaa6f41c0658479 (patch)
tree641eaf2827c04cb0c69156cb51823ce7581528d4 /bitbake
parenteb6a52f51fb465ff167bd3353ca540352fbc2c5c (diff)
downloadpoky-1ca006c7b6036a6fbd40d8a2efaa6f41c0658479.tar.gz
bitbake: toaster: issues in import layer when clicking 'add layer'
There were three issues in this one bug. 1) The Add Layer button allows empty layers 2) The internal XHR URL was wrong, which caused a hidden AJAX error and did not correctly complete the action nor disable the button after an add. 3) There was a race condition between typing in the dependent layer select text box (which would normally disable the add button), and the typeahead pull-down selection (which would normally enable the add button). This forced the user to select the typedahead layer twice. [YOCTO #13385] (Bitbake rev: c4ccf3a792ae7e8549b879ba77ff7f7edb0e665a) Signed-off-by: David Reyna <David.Reyna@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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) {