summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/static/js/importlayer.js
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static/js/importlayer.js')
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/importlayer.js29
1 files changed, 23 insertions, 6 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/importlayer.js b/bitbake/lib/toaster/toastergui/static/js/importlayer.js
index 4784c657f5..b3f094e69b 100644
--- a/bitbake/lib/toaster/toastergui/static/js/importlayer.js
+++ b/bitbake/lib/toaster/toastergui/static/js/importlayer.js
@@ -45,7 +45,7 @@ function importLayerPageInit (ctx) {
45 function(layer) { 45 function(layer) {
46 if (layer.results.length > 0) { 46 if (layer.results.length > 0) {
47 currentLayerDepSelection = layer.results[0]; 47 currentLayerDepSelection = layer.results[0];
48 layerDepBtn.click(); 48 layerDepBtn.click();
49 } 49 }
50 }); 50 });
51 51
@@ -333,19 +333,36 @@ function importLayerPageInit (ctx) {
333 check_form(); 333 check_form();
334 }); 334 });
335 335
336 /* Have a guess at the layer name */ 336 /* Setup 'blank' typeahead */
337 libtoaster.makeTypeahead(gitRefInput,
338 ctx.xhrGitRevTypeAheadUrl,
339 { git_url: null }, function(){});
340
341
337 vcsURLInput.focusout(function (){ 342 vcsURLInput.focusout(function (){
343 if (!$(this).val())
344 return;
345
338 /* If we a layer name specified don't overwrite it or if there isn't a 346 /* If we a layer name specified don't overwrite it or if there isn't a
339 * url typed in yet return 347 * url typed in yet return
340 */ 348 */
341 if (layerNameInput.val() || !$(this).val()) 349 if (!layerNameInput.val() && $(this).val().search("/")){
342 return;
343
344 if ($(this).val().search("/")){
345 var urlPts = $(this).val().split("/"); 350 var urlPts = $(this).val().split("/");
351 /* Add a suggestion of the layer name */
346 var suggestion = urlPts[urlPts.length-1].replace(".git",""); 352 var suggestion = urlPts[urlPts.length-1].replace(".git","");
347 layerNameInput.val(suggestion); 353 layerNameInput.val(suggestion);
348 } 354 }
355
356 /* Now actually setup the typeahead properly with the git url entered */
357 gitRefInput._typeahead('destroy');
358
359 libtoaster.makeTypeahead(gitRefInput,
360 ctx.xhrGitRevTypeAheadUrl,
361 { git_url: $(this).val() },
362 function(selected){
363 gitRefInput._typeahead("close");
364 });
365
349 }); 366 });
350 367
351 function radioDisplay() { 368 function radioDisplay() {