summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/static
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static')
-rw-r--r--bitbake/lib/toaster/toastergui/static/css/default.css1
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/importlayer.js29
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/tests/test.js2
3 files changed, 24 insertions, 8 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/css/default.css b/bitbake/lib/toaster/toastergui/static/css/default.css
index ff24e8c1ab..5cd7e211a0 100644
--- a/bitbake/lib/toaster/toastergui/static/css/default.css
+++ b/bitbake/lib/toaster/toastergui/static/css/default.css
@@ -210,7 +210,6 @@ fieldset.fields-apart-from-layer-name { margin-top: 20px; }
210#import-layer-name, 210#import-layer-name,
211#layer-subdir { width: 20%; } 211#layer-subdir { width: 20%; }
212#layer-git-repo-url { width: 40%; } 212#layer-git-repo-url { width: 40%; }
213#layer-git-ref { width: 32%; }
214#local-dir-path { width: 45%; } 213#local-dir-path { width: 45%; }
215#layer-dependency { width: 16em; } 214#layer-dependency { width: 16em; }
216#layer-deps-list { margin-top: 0; } 215#layer-deps-list { margin-top: 0; }
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() {
diff --git a/bitbake/lib/toaster/toastergui/static/js/tests/test.js b/bitbake/lib/toaster/toastergui/static/js/tests/test.js
index d7953de447..f3bf8d7733 100644
--- a/bitbake/lib/toaster/toastergui/static/js/tests/test.js
+++ b/bitbake/lib/toaster/toastergui/static/js/tests/test.js
@@ -144,7 +144,7 @@ QUnit.test("Make typeaheads", function(assert){
144/* Page init functions */ 144/* Page init functions */
145 145
146QUnit.test("Import layer page init", function(assert){ 146QUnit.test("Import layer page init", function(assert){
147 assert.throws(importLayerPageInit()); 147 assert.throws(importLayerPageInit({ xhrGitRevTypeAheadUrl: "url" }));
148}); 148});
149 149
150QUnit.test("Project page init", function(assert){ 150QUnit.test("Project page init", function(assert){