diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-03-09 18:42:17 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-03-16 17:44:07 +0000 |
commit | 42d1b65d1543cbb334e776bf0193ea9a8a14799e (patch) | |
tree | 5d70aaf9ee4574dc1eac00b19bbca162b45361a6 | |
parent | 50c5ca5254395c7bd092993304c314d86422eb99 (diff) | |
download | poky-42d1b65d1543cbb334e776bf0193ea9a8a14799e.tar.gz |
bitbake: toastergui: improve performance in the all targets page
This patch improves performance in the all targets display
by computing the preffered layer only for displayed targets,
instead of computing for all targets.
(Bitbake rev: 027e3b7c579e21b3164f2785578ae9905b4fb325)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-x | bitbake/lib/toaster/toastergui/views.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 9f1fbca228..5b481cbf01 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
@@ -2752,21 +2752,21 @@ if toastermain.settings.MANAGED: | |||
2752 | 2752 | ||
2753 | queryset_with_search = _get_queryset(Recipe, queryset_all, None, search_term, ordering_string, '-name') | 2753 | queryset_with_search = _get_queryset(Recipe, queryset_all, None, search_term, ordering_string, '-name') |
2754 | 2754 | ||
2755 | # get unique values for 'name' and 'version', and select the maximum ID for each entry (the max id is the newest one) | 2755 | # get unique values for 'name', and select the maximum ID for each entry (the max id is the newest one) |
2756 | queryset_with_search_maxids = queryset_with_search.values('name').distinct().annotate(max_id=Max('id')).values_list('max_id') | 2756 | queryset_with_search_maxids = queryset_with_search.values('name').distinct().annotate(max_id=Max('id')).values_list('max_id') |
2757 | 2757 | ||
2758 | queryset_with_search = queryset_with_search.filter(id__in=queryset_with_search_maxids).select_related('layer_version', 'layer_version__layer') | 2758 | queryset_with_search = queryset_with_search.filter(id__in=queryset_with_search_maxids).select_related('layer_version', 'layer_version__layer', 'layer_version__up_branch') |
2759 | 2759 | ||
2760 | objects = list(queryset_with_search) | ||
2761 | for e in objects: | ||
2762 | e.preffered_layerversion = e.layer_version.get_equivalents_wpriority(prj)[0] | ||
2763 | 2760 | ||
2764 | # retrieve the objects that will be displayed in the table; targets a paginator and gets a page range to display | 2761 | # retrieve the objects that will be displayed in the table; targets a paginator and gets a page range to display |
2765 | target_info = _build_page_range(Paginator(objects, request.GET.get('count', 10)),request.GET.get('page', 1)) | 2762 | target_info = _build_page_range(Paginator(queryset_with_search, request.GET.get('count', 10)),request.GET.get('page', 1)) |
2763 | |||
2764 | for e in target_info.object_list: | ||
2765 | e.preffered_layerversion = e.layer_version.get_equivalents_wpriority(prj)[0] | ||
2766 | 2766 | ||
2767 | 2767 | ||
2768 | context = { | 2768 | context = { |
2769 | 'projectlayerset' : jsonfilter(map(lambda x: x.layercommit.id, prj.projectlayer_set.all())), | 2769 | 'projectlayerset' : jsonfilter(map(lambda x: x.layercommit.id, prj.projectlayer_set.all().select_related("layercommit"))), |
2770 | 'objects' : target_info, | 2770 | 'objects' : target_info, |
2771 | 'objectname' : "targets", | 2771 | 'objectname' : "targets", |
2772 | 'default_orderby' : 'name:+', | 2772 | 'default_orderby' : 'name:+', |