mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 01:19:52 +00:00
bitbake: toastergui: Switch to using the new toaster typeahead widget
Switch the existing typeahead inputs to use the new typeahead widget. This means we have a defined mechanism and end point for typeaheads which meets the design specification. (Bitbake rev: 31a8ae7909347f7b6edde5bbdf02b86dc1b32ed0) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
73367c2ca8
commit
aff29d2cd8
@@ -89,8 +89,8 @@ function basePageInit(ctx) {
|
||||
}
|
||||
|
||||
/* If we have a project setup the typeahead */
|
||||
if (selectedProject.projectTargetsUrl){
|
||||
libtoaster.makeTypeahead(newBuildTargetInput, selectedProject.projectTargetsUrl, { format: "json" }, function (item) {
|
||||
if (selectedProject.recipesTypeAheadUrl){
|
||||
libtoaster.makeTypeahead(newBuildTargetInput, selectedProject.recipesTypeAheadUrl, { format: "json" }, function (item) {
|
||||
selectedTarget = item;
|
||||
newBuildTargetBuildBtn.removeAttr("disabled");
|
||||
});
|
||||
@@ -156,7 +156,7 @@ function basePageInit(ctx) {
|
||||
$('#project .icon-pencil').hide();
|
||||
}
|
||||
|
||||
libtoaster.makeTypeahead(newBuildProjectInput, selectedProject.projectsUrl, { format : "json" }, function (item) {
|
||||
libtoaster.makeTypeahead(newBuildProjectInput, selectedProject.projectsTypeAheadUrl, { format : "json" }, function (item) {
|
||||
/* successfully selected a project */
|
||||
newBuildProjectSaveBtn.removeAttr("disabled");
|
||||
selectedProject = item;
|
||||
@@ -180,13 +180,21 @@ function basePageInit(ctx) {
|
||||
|
||||
newBuildTargetInput.removeAttr("disabled");
|
||||
|
||||
/* Update the typeahead to use the new selectedProject */
|
||||
libtoaster.makeTypeahead(newBuildTargetInput, selectedProject.projectTargetsUrl, { format: "json" }, function (item) {
|
||||
/* successfully selected a target */
|
||||
selectedTarget = item;
|
||||
newBuildTargetBuildBtn.removeAttr("disabled");
|
||||
});
|
||||
/* We've got a new project so now we need to update the
|
||||
* target urls. We can get this from the new project's info
|
||||
*/
|
||||
$.getJSON(selectedProject.projectPageUrl, { format: "json" },
|
||||
function(projectInfo){
|
||||
/* Update the typeahead to use the new selectedProject */
|
||||
selectedProject = projectInfo;
|
||||
|
||||
libtoaster.makeTypeahead(newBuildTargetInput, selectedProject.recipesTypeAheadUrl, { format: "json" }, function (item) {
|
||||
/* successfully selected a target */
|
||||
selectedTarget = item;
|
||||
newBuildTargetBuildBtn.removeAttr("disabled");
|
||||
});
|
||||
|
||||
});
|
||||
newBuildTargetInput.val("");
|
||||
|
||||
/* set up new form aspect */
|
||||
|
||||
@@ -16,7 +16,7 @@ function importLayerPageInit (ctx) {
|
||||
var currentLayerDepSelection;
|
||||
var validLayerName = /^(\w|-)+$/;
|
||||
|
||||
libtoaster.makeTypeahead(layerDepInput, libtoaster.ctx.projectLayersUrl, { include_added: "true" }, function(item){
|
||||
libtoaster.makeTypeahead(layerDepInput, libtoaster.ctx.layersTypeAheadUrl, { include_added: "true" }, function(item){
|
||||
currentLayerDepSelection = item;
|
||||
|
||||
layerDepBtn.removeAttr("disabled");
|
||||
@@ -26,11 +26,11 @@ function importLayerPageInit (ctx) {
|
||||
/* We automatically add "openembedded-core" layer for convenience as a
|
||||
* dependency as pretty much all layers depend on this one
|
||||
*/
|
||||
$.getJSON(libtoaster.ctx.projectLayersUrl,
|
||||
{ include_added: "true" , search: "openembedded-core", format: "json" },
|
||||
$.getJSON(libtoaster.ctx.layersTypeAheadUrl,
|
||||
{ include_added: "true" , search: "openembedded-core" },
|
||||
function(layer) {
|
||||
if (layer.rows.length > 0) {
|
||||
currentLayerDepSelection = layer.rows[0];
|
||||
if (layer.results.length > 0) {
|
||||
currentLayerDepSelection = layer.results[0];
|
||||
layerDepBtn.click();
|
||||
}
|
||||
});
|
||||
@@ -211,7 +211,7 @@ function importLayerPageInit (ctx) {
|
||||
var name = $(this).val();
|
||||
|
||||
/* Check if the layer name exists */
|
||||
$.getJSON(libtoaster.ctx.projectLayersUrl,
|
||||
$.getJSON(libtoaster.ctx.layersTypeAheadUrl,
|
||||
{ include_added: "true" , search: name, format: "json" },
|
||||
function(layer) {
|
||||
if (layer.rows.length > 0) {
|
||||
|
||||
@@ -9,7 +9,7 @@ function layerDetailsPageInit (ctx) {
|
||||
var addRmLayerBtn = $("#add-remove-layer-btn");
|
||||
|
||||
/* setup the dependencies typeahead */
|
||||
libtoaster.makeTypeahead(layerDepInput, libtoaster.ctx.projectLayersUrl, { include_added: "true" }, function(item){
|
||||
libtoaster.makeTypeahead(layerDepInput, libtoaster.ctx.layersTypeAheadUrl, { include_added: "true" }, function(item){
|
||||
currentLayerDepSelection = item;
|
||||
|
||||
layerDepBtn.removeAttr("disabled");
|
||||
|
||||
@@ -19,14 +19,13 @@ var libtoaster = (function (){
|
||||
jQElement.typeahead({
|
||||
source: function(query, process){
|
||||
xhrParams.search = query;
|
||||
xhrParams.format = "json";
|
||||
$.getJSON(xhrUrl, this.options.xhrParams, function(data){
|
||||
if (data.error !== "ok") {
|
||||
console.log("Error getting data from server "+data.error);
|
||||
return;
|
||||
}
|
||||
|
||||
return process (data.rows);
|
||||
return process(data.results);
|
||||
});
|
||||
},
|
||||
updater: function(item) {
|
||||
@@ -40,7 +39,7 @@ var libtoaster = (function (){
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ~item.name.toLowerCase().indexOf(this.query.toLowerCase());
|
||||
return 1;
|
||||
},
|
||||
highlighter: function (item) {
|
||||
if (item.hasOwnProperty('detail'))
|
||||
|
||||
@@ -98,7 +98,7 @@ function projectPageInit(ctx) {
|
||||
|
||||
/* Add/Rm layer functionality */
|
||||
|
||||
libtoaster.makeTypeahead(layerAddInput, libtoaster.ctx.projectLayersUrl, { include_added: "false" }, function(item){
|
||||
libtoaster.makeTypeahead(layerAddInput, libtoaster.ctx.layersTypeAheadUrl, { include_added: "false" }, function(item){
|
||||
currentLayerAddSelection = item;
|
||||
layerAddBtn.removeAttr("disabled");
|
||||
});
|
||||
@@ -251,7 +251,7 @@ function projectPageInit(ctx) {
|
||||
machineNameTitle.text(machineName);
|
||||
}
|
||||
|
||||
libtoaster.makeTypeahead(machineChangeInput, libtoaster.ctx.projectMachinesUrl, { }, function(item){
|
||||
libtoaster.makeTypeahead(machineChangeInput, libtoaster.ctx.machinesTypeAheadUrl, { }, function(item){
|
||||
currentMachineAddSelection = item;
|
||||
machineChangeBtn.removeAttr("disabled");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user