bitbake: toaster: importlayer Add git revision typeahead to that input field

Add the front end mechanism to load the typeahead for the git revision
field on importing a layer.
Also fix one indentation issue and update the js test.

(Bitbake rev: 28114be42174095b812a93d4b5a0e01e953d74f8)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Michael Wood
2016-12-09 16:52:50 +00:00
committed by Richard Purdie
parent 97ff2c0091
commit 23ad2a8ca0
4 changed files with 28 additions and 9 deletions

View File

@@ -45,7 +45,7 @@ function importLayerPageInit (ctx) {
function(layer) {
if (layer.results.length > 0) {
currentLayerDepSelection = layer.results[0];
layerDepBtn.click();
layerDepBtn.click();
}
});
@@ -333,19 +333,36 @@ function importLayerPageInit (ctx) {
check_form();
});
/* Have a guess at the layer name */
/* Setup 'blank' typeahead */
libtoaster.makeTypeahead(gitRefInput,
ctx.xhrGitRevTypeAheadUrl,
{ git_url: null }, function(){});
vcsURLInput.focusout(function (){
if (!$(this).val())
return;
/* If we a layer name specified don't overwrite it or if there isn't a
* url typed in yet return
*/
if (layerNameInput.val() || !$(this).val())
return;
if ($(this).val().search("/")){
if (!layerNameInput.val() && $(this).val().search("/")){
var urlPts = $(this).val().split("/");
/* Add a suggestion of the layer name */
var suggestion = urlPts[urlPts.length-1].replace(".git","");
layerNameInput.val(suggestion);
}
/* Now actually setup the typeahead properly with the git url entered */
gitRefInput._typeahead('destroy');
libtoaster.makeTypeahead(gitRefInput,
ctx.xhrGitRevTypeAheadUrl,
{ git_url: $(this).val() },
function(selected){
gitRefInput._typeahead("close");
});
});
function radioDisplay() {