diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-03-09 18:39:18 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-03-16 17:44:06 +0000 |
commit | 50c5ca5254395c7bd092993304c314d86422eb99 (patch) | |
tree | 6582a4c18e499a0b735bbef63f0054b0a72a709c /bitbake | |
parent | e5590bc381e5f09a768bdcb367d21785864b4d2b (diff) | |
download | ast2050-yocto-poky-50c5ca5254395c7bd092993304c314d86422eb99.zip ast2050-yocto-poky-50c5ca5254395c7bd092993304c314d86422eb99.tar.gz |
bitbake: toastergui: improve data suggestion
We improve the data suggestions in the project page.
The machines suggestions now contain the layer name.
The targets and machine do not show the layer branch.
For targets, the layer name is searchable.
For machines, the description field is searchable.
[YOCTO #7153]
[YOCTO #7154]
(Bitbake rev: 02a4997807ee995817d741985eea13d38e548007)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/toaster/toastergui/templates/project.html | 2 | ||||
-rwxr-xr-x | bitbake/lib/toaster/toastergui/views.py | 14 |
2 files changed, 9 insertions, 7 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/project.html b/bitbake/lib/toaster/toastergui/templates/project.html index 06fc6a5..f4a3a75 100644 --- a/bitbake/lib/toaster/toastergui/templates/project.html +++ b/bitbake/lib/toaster/toastergui/templates/project.html @@ -355,7 +355,7 @@ vim: expandtab tabstop=2 You cannot really compare the builds for the new machine with the previous ones. </div> <form ng-submit="editProjectSettings('#select-machine')" class="input-append"> - <input type="text" id="machine" autocomplete="off" ng-model="machineName" typeahead="m.name for m in getAutocompleteSuggestions('machines', $viewValue)"/> + <input type="text" id="machine" autocomplete="off" ng-model="machineName" typeahead="m.name for m in getAutocompleteSuggestions('machines', $viewValue)" typeahead-template-url="suggestion_details" /> <input type="submit" id="apply-change-machine" class="btn" type="button" ng-disabled="machineName == machine.name || machineName.length == 0" value="Save"></input> <input type="reset" id="cancel-machine" class="btn btn-link" ng-click="toggle('#select-machine')" value="Cancel"></input> {% csrf_token %} diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 9f0bb99..9f1fbca 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py @@ -2353,7 +2353,8 @@ if toastermain.settings.MANAGED: # returns targets provided by current project layers if request.GET['type'] == "targets": - queryset_all = Recipe.objects.filter(name__icontains=request.GET.get('value','')) + search_token = request.GET.get('value','') + queryset_all = Recipe.objects.filter(Q(name__icontains=search_token) | Q(layer_version__layer__name__icontains=search_token) ) layer_equivalent_set = [] for i in prj.projectlayer_set.all(): layer_equivalent_set += i.layercommit.get_equivalents_wpriority(prj) @@ -2361,11 +2362,11 @@ if toastermain.settings.MANAGED: # if we have more than one hit here (for distinct name and version), max the id it out queryset_all_maxids = queryset_all.values('name').distinct().annotate(max_id=Max('id')).values_list('max_id') - queryset_all = queryset_all.filter(id__in = queryset_all_maxids).order_by("name") + queryset_all = queryset_all.filter(id__in = queryset_all_maxids).order_by("name").select_related("layer_version__layer") return HttpResponse(jsonfilter({ "error":"ok", - "list" : map ( lambda x: {"id": x.pk, "name": x.name, "detail":"[" + x.layer_version.layer.name + (" | " + x.layer_version.up_branch.name + "]" if x.layer_version.up_branch is not None else "]")}, + "list" : map ( lambda x: {"id": x.pk, "name": x.name, "detail":"[" + x.layer_version.layer.name +"]"}, queryset_all[:8]), }), content_type = "application/json") @@ -2376,10 +2377,11 @@ if toastermain.settings.MANAGED: if 'project_id' in request.session: queryset_all = queryset_all.filter(layer_version__in = prj.projectlayer_equivalent_set()).order_by("name") - return HttpResponse(jsonfilter({ "error":"ok", - "list" : map ( lambda x: {"id": x.pk, "name": x.name, "detail":"[" + x.layer_version.layer.name+ (" | " + x.layer_version.up_branch.name + "]" if x.layer_version.up_branch is not None else "]")}, - queryset_all.filter(name__icontains=request.GET.get('value',''))[:8]), + search_token = request.GET.get('value','') + querysetall = queryset_all.filter(Q(name__icontains=search_token) | Q(description__icontains=search_token)) + return HttpResponse(jsonfilter({ "error":"ok", + "list" : map ( lambda x: {"id": x.pk, "name": x.name, "detail":"[" + x.layer_version.layer.name+ "]"}, queryset_all[:8]) }), content_type = "application/json") # returns all projects |