summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2015-03-09 18:39:18 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-03-16 17:44:06 +0000
commit50c5ca5254395c7bd092993304c314d86422eb99 (patch)
tree6582a4c18e499a0b735bbef63f0054b0a72a709c
parente5590bc381e5f09a768bdcb367d21785864b4d2b (diff)
downloadpoky-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>
-rw-r--r--bitbake/lib/toaster/toastergui/templates/project.html2
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py14
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 06fc6a5b62..f4a3a75358 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
355 You cannot really compare the builds for the new machine with the previous ones. 355 You cannot really compare the builds for the new machine with the previous ones.
356 </div> 356 </div>
357 <form ng-submit="editProjectSettings('#select-machine')" class="input-append"> 357 <form ng-submit="editProjectSettings('#select-machine')" class="input-append">
358 <input type="text" id="machine" autocomplete="off" ng-model="machineName" typeahead="m.name for m in getAutocompleteSuggestions('machines', $viewValue)"/> 358 <input type="text" id="machine" autocomplete="off" ng-model="machineName" typeahead="m.name for m in getAutocompleteSuggestions('machines', $viewValue)" typeahead-template-url="suggestion_details" />
359 <input type="submit" id="apply-change-machine" class="btn" type="button" ng-disabled="machineName == machine.name || machineName.length == 0" value="Save"></input> 359 <input type="submit" id="apply-change-machine" class="btn" type="button" ng-disabled="machineName == machine.name || machineName.length == 0" value="Save"></input>
360 <input type="reset" id="cancel-machine" class="btn btn-link" ng-click="toggle('#select-machine')" value="Cancel"></input> 360 <input type="reset" id="cancel-machine" class="btn btn-link" ng-click="toggle('#select-machine')" value="Cancel"></input>
361 {% csrf_token %} 361 {% csrf_token %}
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 9f0bb993e6..9f1fbca228 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -2353,7 +2353,8 @@ if toastermain.settings.MANAGED:
2353 2353
2354 # returns targets provided by current project layers 2354 # returns targets provided by current project layers
2355 if request.GET['type'] == "targets": 2355 if request.GET['type'] == "targets":
2356 queryset_all = Recipe.objects.filter(name__icontains=request.GET.get('value','')) 2356 search_token = request.GET.get('value','')
2357 queryset_all = Recipe.objects.filter(Q(name__icontains=search_token) | Q(layer_version__layer__name__icontains=search_token) )
2357 layer_equivalent_set = [] 2358 layer_equivalent_set = []
2358 for i in prj.projectlayer_set.all(): 2359 for i in prj.projectlayer_set.all():
2359 layer_equivalent_set += i.layercommit.get_equivalents_wpriority(prj) 2360 layer_equivalent_set += i.layercommit.get_equivalents_wpriority(prj)
@@ -2361,11 +2362,11 @@ if toastermain.settings.MANAGED:
2361 2362
2362 # if we have more than one hit here (for distinct name and version), max the id it out 2363 # if we have more than one hit here (for distinct name and version), max the id it out
2363 queryset_all_maxids = queryset_all.values('name').distinct().annotate(max_id=Max('id')).values_list('max_id') 2364 queryset_all_maxids = queryset_all.values('name').distinct().annotate(max_id=Max('id')).values_list('max_id')
2364 queryset_all = queryset_all.filter(id__in = queryset_all_maxids).order_by("name") 2365 queryset_all = queryset_all.filter(id__in = queryset_all_maxids).order_by("name").select_related("layer_version__layer")
2365 2366
2366 2367
2367 return HttpResponse(jsonfilter({ "error":"ok", 2368 return HttpResponse(jsonfilter({ "error":"ok",
2368 "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 "]")}, 2369 "list" : map ( lambda x: {"id": x.pk, "name": x.name, "detail":"[" + x.layer_version.layer.name +"]"},
2369 queryset_all[:8]), 2370 queryset_all[:8]),
2370 2371
2371 }), content_type = "application/json") 2372 }), content_type = "application/json")
@@ -2376,10 +2377,11 @@ if toastermain.settings.MANAGED:
2376 if 'project_id' in request.session: 2377 if 'project_id' in request.session:
2377 queryset_all = queryset_all.filter(layer_version__in = prj.projectlayer_equivalent_set()).order_by("name") 2378 queryset_all = queryset_all.filter(layer_version__in = prj.projectlayer_equivalent_set()).order_by("name")
2378 2379
2379 return HttpResponse(jsonfilter({ "error":"ok", 2380 search_token = request.GET.get('value','')
2380 "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 "]")}, 2381 querysetall = queryset_all.filter(Q(name__icontains=search_token) | Q(description__icontains=search_token))
2381 queryset_all.filter(name__icontains=request.GET.get('value',''))[:8]),
2382 2382
2383 return HttpResponse(jsonfilter({ "error":"ok",
2384 "list" : map ( lambda x: {"id": x.pk, "name": x.name, "detail":"[" + x.layer_version.layer.name+ "]"}, queryset_all[:8])
2383 }), content_type = "application/json") 2385 }), content_type = "application/json")
2384 2386
2385 # returns all projects 2387 # returns all projects