From e28097f8a23b324a7de8b58f8d5dc4ca8512e52a Mon Sep 17 00:00:00 2001 From: Michael Wood Date: Tue, 24 Feb 2015 17:20:50 +0000 Subject: bitbake: toaster: layerdetails summary/descriptions to be searchable Allow the descriptions of the machine summary and layer description to be searchable in their respective tables. [YOCTO #7199] (Bitbake rev: 1a1a61f587e05af76299c7e1d3b7ab079fb4b1c1) Signed-off-by: Michael Wood Signed-off-by: Richard Purdie --- .../toaster/toastergui/templates/layerdetails.html | 2 +- bitbake/lib/toaster/toastergui/views.py | 42 +++++++++++++--------- 2 files changed, 26 insertions(+), 18 deletions(-) (limited to 'bitbake/lib/toaster') diff --git a/bitbake/lib/toaster/toastergui/templates/layerdetails.html b/bitbake/lib/toaster/toastergui/templates/layerdetails.html index c162c8b95c..6c803ff544 100644 --- a/bitbake/lib/toaster/toastergui/templates/layerdetails.html +++ b/bitbake/lib/toaster/toastergui/templates/layerdetails.html @@ -257,7 +257,7 @@ Target version - Description + Summary Build target diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index be74c10f6e..196e66ea1b 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py @@ -2622,31 +2622,39 @@ if toastermain.settings.MANAGED: layer_version = Layer_Version.objects.get(pk = layerid) + targets_query = Recipe.objects.filter(layer_version=layer_version) + # Targets tab query functionality if request.GET.has_key('targets_search'): - targets = Paginator(Recipe.objects.filter(layer_version=layer_version,name__icontains=request.GET['targets_search']).order_by("name"), limit) - else: - targets = Paginator(Recipe.objects.filter(layer_version=layer_version).order_by("name"), limit) + targets_query = targets_query.filter( + Q(name__icontains=request.GET['targets_search']) | + Q(summary__icontains=request.GET['targets_search'])) + + targets = Paginator(targets_query.order_by("name"), limit) if request.GET.has_key("tpage"): - try: - targets = targets.page(request.GET['tpage']) - except EmptyPage: - targets = targets.page(targets.num_pages) + try: + targets = targets.page(request.GET['tpage']) + except EmptyPage: + targets = targets.page(targets.num_pages) else: targets = targets.page(1) + machines_query = Machine.objects.filter(layer_version=layer_version) + # Machines tab query functionality if request.GET.has_key('machines_search'): - machines = Paginator(Machine.objects.filter(layer_version=layer_version,name__icontains=request.GET['machines_search']).order_by("name"), limit) - else: - machines = Paginator(Machine.objects.filter(layer_version=layer_version).order_by("name"), limit) + machines_query = machines_query.filter( + Q(name__icontains=request.GET['machines_search']) | + Q(description__icontains=request.GET['machines_search'])) + + machines = Paginator(machines_query.order_by("name"), limit) if request.GET.has_key("mpage"): - try: - machines = machines.page(request.GET['mpage']) - except EmptyPage: - machines = machines.page(machines.num_pages) + try: + machines = machines.page(request.GET['mpage']) + except EmptyPage: + machines = machines.page(machines.num_pages) else: machines = machines.page(1) @@ -2787,9 +2795,9 @@ if toastermain.settings.MANAGED: # Now we need to weed out the layers which will appear as duplicated # because they're from a layer source which doesn't need to be used for machine in queryset_all: - to_rm = machine.layer_version.get_equivalents_wpriority(prj)[1:] - if len(to_rm) > 0: - queryset_all = queryset_all.exclude(layer_version__in=to_rm) + to_rm = machine.layer_version.get_equivalents_wpriority(prj)[1:] + if len(to_rm) > 0: + queryset_all = queryset_all.exclude(layer_version__in=to_rm) machine_info = _build_page_range(Paginator(queryset_all, request.GET.get('count', 100)),request.GET.get('page', 1)) -- cgit v1.2.3-54-g00ecf