summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2015-09-04 10:37:43 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-18 09:05:35 +0100
commit5528f3a8fd3c4839b8b1b3976d4dc1b26ffa7458 (patch)
tree20cb1f58eb5d91a8a9f773ff1e8b6dede14465d2
parent2bb600a579cd8fec3887593b3a26e26a4b06b13b (diff)
downloadpoky-5528f3a8fd3c4839b8b1b3976d4dc1b26ffa7458.tar.gz
bitbake: toaster: hide irrelevant builds in the project builds view
This patch fixes the project builds view so it doesn't show "in progress" builds or builds for other projects. Note that this also modifies the "all builds" view to use the same queryset filtering as the project builds. This is to avoid excluding "in progress" builds more than once, which is what was happening before. The patch also has a minor change to ensure that when displaying the project builds page, only builds for that project are in the results. The queryset filtering is now split over several lines so you can see what's going on. [YOCTO #8236] [YOCTO #8187] (Bitbake rev: 09079f15c0511a6d17ce1cc29be6de5387e45f09) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py54
1 files changed, 42 insertions, 12 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index e918b052fd..45a5611724 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -1903,7 +1903,7 @@ if True:
1903 # be able to display something. 'count' and 'page' are mandatory for all views 1903 # be able to display something. 'count' and 'page' are mandatory for all views
1904 # that use paginators. 1904 # that use paginators.
1905 1905
1906 queryset = Build.objects.exclude(outcome = Build.IN_PROGRESS) 1906 queryset = Build.objects.all()
1907 1907
1908 try: 1908 try:
1909 context, pagesize, orderby = _build_list_helper(request, queryset) 1909 context, pagesize, orderby = _build_list_helper(request, queryset)
@@ -1920,7 +1920,6 @@ if True:
1920 1920
1921 # helper function, to be used on "all builds" and "project builds" pages 1921 # helper function, to be used on "all builds" and "project builds" pages
1922 def _build_list_helper(request, queryset_all): 1922 def _build_list_helper(request, queryset_all):
1923
1924 default_orderby = 'completed_on:-' 1923 default_orderby = 'completed_on:-'
1925 (pagesize, orderby) = _get_parameters_values(request, 10, default_orderby) 1924 (pagesize, orderby) = _get_parameters_values(request, 10, default_orderby)
1926 mandatory_parameters = { 'count': pagesize, 'page' : 1, 'orderby' : orderby } 1925 mandatory_parameters = { 'count': pagesize, 'page' : 1, 'orderby' : orderby }
@@ -1931,11 +1930,42 @@ if True:
1931 # boilerplate code that takes a request for an object type and returns a queryset 1930 # boilerplate code that takes a request for an object type and returns a queryset
1932 # for that object type. copypasta for all needed table searches 1931 # for that object type. copypasta for all needed table searches
1933 (filter_string, search_term, ordering_string) = _search_tuple(request, Build) 1932 (filter_string, search_term, ordering_string) = _search_tuple(request, Build)
1933
1934 # post-process any date range filters 1934 # post-process any date range filters
1935 filter_string,daterange_selected = _modify_date_range_filter(filter_string) 1935 filter_string, daterange_selected = _modify_date_range_filter(filter_string)
1936 queryset_all = queryset_all.select_related("project").annotate(errors_no = Count('logmessage', only=Q(logmessage__level=LogMessage.ERROR)|Q(logmessage__level=LogMessage.EXCEPTION))).annotate(warnings_no = Count('logmessage', only=Q(logmessage__level=LogMessage.WARNING))).extra(select={'timespent':'completed_on - started_on'}) 1936
1937 queryset_with_search = _get_queryset(Build, queryset_all, None, search_term, ordering_string, '-completed_on') 1937 # don't show "in progress" builds in "all builds" or "project builds"
1938 queryset = _get_queryset(Build, queryset_all, filter_string, search_term, ordering_string, '-completed_on') 1938 queryset_all = queryset_all.exclude(outcome = Build.IN_PROGRESS)
1939
1940 # append project info
1941 queryset_all = queryset_all.select_related("project")
1942
1943 # annotate with number of ERROR and EXCEPTION log messages
1944 queryset_all = queryset_all.annotate(
1945 errors_no = Count(
1946 'logmessage',
1947 only=Q(logmessage__level=LogMessage.ERROR) |
1948 Q(logmessage__level=LogMessage.EXCEPTION)
1949 )
1950 )
1951
1952 # annotate with number of warnings
1953 q_warnings = Q(logmessage__level=LogMessage.WARNING)
1954 queryset_all = queryset_all.annotate(
1955 warnings_no = Count('logmessage', only=q_warnings)
1956 )
1957
1958 # add timespent field
1959 timespent = 'completed_on - started_on'
1960 queryset_all = queryset_all.extra(select={'timespent': timespent})
1961
1962 queryset_with_search = _get_queryset(Build, queryset_all,
1963 None, search_term,
1964 ordering_string, '-completed_on')
1965
1966 queryset = _get_queryset(Build, queryset_all,
1967 filter_string, search_term,
1968 ordering_string, '-completed_on')
1939 1969
1940 # retrieve the objects that will be displayed in the table; builds a paginator and gets a page range to display 1970 # retrieve the objects that will be displayed in the table; builds a paginator and gets a page range to display
1941 build_info = _build_page_range(Paginator(queryset, pagesize), request.GET.get('page', 1)) 1971 build_info = _build_page_range(Paginator(queryset, pagesize), request.GET.get('page', 1))
@@ -2658,7 +2688,7 @@ if True:
2658 if 'buildDelete' in request.POST: 2688 if 'buildDelete' in request.POST:
2659 for i in request.POST['buildDelete'].strip().split(" "): 2689 for i in request.POST['buildDelete'].strip().split(" "):
2660 try: 2690 try:
2661 br = BuildRequest.objects.select_for_update().get(project = prj, pk = i, state__lte = BuildRequest.REQ_DELETED).delete() 2691 BuildRequest.objects.select_for_update().get(project = prj, pk = i, state__lte = BuildRequest.REQ_DELETED).delete()
2662 except BuildRequest.DoesNotExist: 2692 except BuildRequest.DoesNotExist:
2663 pass 2693 pass
2664 2694
@@ -2671,12 +2701,12 @@ if True:
2671 else: 2701 else:
2672 target = t 2702 target = t
2673 task = "" 2703 task = ""
2674 ProjectTarget.objects.create(project = prj, target = target, task = task) 2704 ProjectTarget.objects.create(project = prj,
2675 2705 target = target,
2676 br = prj.schedule_build() 2706 task = task)
2677 2707 prj.schedule_build()
2678 2708
2679 queryset = Build.objects.filter(outcome__lte = Build.IN_PROGRESS) 2709 queryset = Build.objects.filter(project_id = pid)
2680 2710
2681 try: 2711 try:
2682 context, pagesize, orderby = _build_list_helper(request, queryset) 2712 context, pagesize, orderby = _build_list_helper(request, queryset)