summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib')
-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
-rw-r--r--bitbake/lib/toaster/toastergui/templates/importlayer.html5
4 files changed, 28 insertions, 9 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){
diff --git a/bitbake/lib/toaster/toastergui/templates/importlayer.html b/bitbake/lib/toaster/toastergui/templates/importlayer.html
index bd507b5677..afbeb94d42 100644
--- a/bitbake/lib/toaster/toastergui/templates/importlayer.html
+++ b/bitbake/lib/toaster/toastergui/templates/importlayer.html
@@ -14,6 +14,7 @@
14 $(document).ready(function (){ 14 $(document).ready(function (){
15 var ctx = { 15 var ctx = {
16 xhrLayerUrl : "{% url 'xhr_layer' project.id %}", 16 xhrLayerUrl : "{% url 'xhr_layer' project.id %}",
17 xhrGitRevTypeAheadUrl : "{% url 'xhr_gitrevtypeahead' %}",
17 }; 18 };
18 19
19 try { 20 try {
@@ -112,8 +113,10 @@
112 Git revision 113 Git revision
113 <span class="glyphicon glyphicon-question-sign get-help" title="You can provide a Git branch, a tag or a commit SHA as the revision"></span> 114 <span class="glyphicon glyphicon-question-sign get-help" title="You can provide a Git branch, a tag or a commit SHA as the revision"></span>
114 </label> 115 </label>
115 <input type="text" class="form-control" id="layer-git-ref" required> 116 <span style="display: block">
117 <input type="text" class="form-control" id="layer-git-ref" autocomplete="off" data-minLength="1" data-autocomplete="off" data-provide="typeahead" required>
116 <span class="help-inline" style="display:none;" id="invalid-layer-revision-hint"></span> 118 <span class="help-inline" style="display:none;" id="invalid-layer-revision-hint"></span>
119 </span>
117 </div> 120 </div>
118 </fieldset> 121 </fieldset>
119 122