summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Reyna <David.Reyna@windriver.com>2014-03-29 07:47:43 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-04-05 14:55:28 +0100
commit0d39bee035923186afc3c5c113a3d2e710e1820d (patch)
treeffcf7f88407a57069bda279d9646f3c0ea3a2a47
parentbf8dcb43432004328162ddad3c8b38eaab6ab5ce (diff)
downloadpoky-0d39bee035923186afc3c5c113a3d2e710e1820d.tar.gz
bitbake: toaster: link task order to right tasks page
When linking from a task order number to the All Tasks page, automatically display the correct page for that link anchor. [YOCTO #5933] (Bitbake rev: e5b6681432b627eb73bfa766d3154162206f374e) Signed-off-by: David Reyna <David.Reyna@windriver.com> 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/task.html2
-rw-r--r--bitbake/lib/toaster/toastergui/urls.py1
-rw-r--r--bitbake/lib/toaster/toastergui/views.py36
3 files changed, 32 insertions, 7 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/task.html b/bitbake/lib/toaster/toastergui/templates/task.html
index 1a7e9d4c04..5c32250bed 100644
--- a/bitbake/lib/toaster/toastergui/templates/task.html
+++ b/bitbake/lib/toaster/toastergui/templates/task.html
@@ -199,7 +199,7 @@
199 <i class="icon-question-sign get-help" title="The running sequence of each task in the build"></i> 199 <i class="icon-question-sign get-help" title="The running sequence of each task in the build"></i>
200 Task order 200 Task order
201 </dt> 201 </dt>
202 <dd><a href="{%url "tasks" build.pk %}#{{task.order}}">{{task.order}}</a></dd> 202 <dd><a href="{%url "tasks_task" build.pk task.order %}#{{task.order}}">{{task.order}}</a></dd>
203 {% if task.task_executed %} 203 {% if task.task_executed %}
204 <dt> 204 <dt>
205 <i class="icon-question-sign get-help" title="If this task executes a Python or Shell function(s)"></i> 205 <i class="icon-question-sign get-help" title="If this task executes a Python or Shell function(s)"></i>
diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py
index ac83b387c5..d7e9457c66 100644
--- a/bitbake/lib/toaster/toastergui/urls.py
+++ b/bitbake/lib/toaster/toastergui/urls.py
@@ -26,6 +26,7 @@ urlpatterns = patterns('toastergui.views',
26 url(r'^build/(?P<build_id>\d+)$', 'builddashboard', name="builddashboard"), 26 url(r'^build/(?P<build_id>\d+)$', 'builddashboard', name="builddashboard"),
27 27
28 url(r'^build/(?P<build_id>\d+)/tasks/$', 'tasks', name='tasks'), 28 url(r'^build/(?P<build_id>\d+)/tasks/$', 'tasks', name='tasks'),
29 url(r'^build/(?P<build_id>\d+)/tasks/(?P<task_id>\d+)/$', 'tasks_task', name='tasks_task'),
29 url(r'^build/(?P<build_id>\d+)/task/(?P<task_id>\d+)$', 'task', name='task'), 30 url(r'^build/(?P<build_id>\d+)/task/(?P<task_id>\d+)$', 'task', name='task'),
30 31
31 url(r'^build/(?P<build_id>\d+)/recipes/$', 'recipes', name='recipes'), 32 url(r'^build/(?P<build_id>\d+)/recipes/$', 'recipes', name='recipes'),
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 05e24ea139..a92a03f50b 100644
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -196,7 +196,7 @@ def _get_queryset(model, queryset, filter_string, search_term, ordering_string,
196 else: 196 else:
197 queryset = queryset.order_by(column) 197 queryset = queryset.order_by(column)
198 198
199 # insure only distinct records (e.g. from multiple search hits) are returned 199 # insure only distinct records (e.g. from multiple search hits) are returned
200 return queryset.distinct() 200 return queryset.distinct()
201 201
202 202
@@ -746,7 +746,7 @@ def _find_task_provider(task):
746 return trc 746 return trc
747 return None 747 return None
748 748
749def tasks_common(request, build_id, variant): 749def tasks_common(request, build_id, variant, task_anchor):
750# This class is shared between these pages 750# This class is shared between these pages
751# 751#
752# Column tasks buildtime diskio cpuusage 752# Column tasks buildtime diskio cpuusage
@@ -766,6 +766,10 @@ def tasks_common(request, build_id, variant):
766# 'min':on always, 'def':on by default, else hidden 766# 'min':on always, 'def':on by default, else hidden
767# '+' default column sort up, '-' default column sort down 767# '+' default column sort up, '-' default column sort down
768 768
769 anchor = request.GET.get('anchor', '')
770 if not anchor:
771 anchor=task_anchor
772
769 # default ordering depends on variant 773 # default ordering depends on variant
770 if 'buildtime' == variant: 774 if 'buildtime' == variant:
771 title_variant='Time' 775 title_variant='Time'
@@ -791,12 +795,29 @@ def tasks_common(request, build_id, variant):
791 template = 'tasks.html' 795 template = 'tasks.html'
792 retval = _verify_parameters( request.GET, mandatory_parameters ) 796 retval = _verify_parameters( request.GET, mandatory_parameters )
793 if retval: 797 if retval:
798 if task_anchor:
799 mandatory_parameters['anchor']=task_anchor
794 return _redirect_parameters( variant, request.GET, mandatory_parameters, build_id = build_id) 800 return _redirect_parameters( variant, request.GET, mandatory_parameters, build_id = build_id)
795 (filter_string, search_term, ordering_string) = _search_tuple(request, Task) 801 (filter_string, search_term, ordering_string) = _search_tuple(request, Task)
796 queryset_all = Task.objects.filter(build=build_id, order__gt=0) 802 queryset_all = Task.objects.filter(build=build_id, order__gt=0)
797 queryset_with_search = _get_queryset(Task, queryset_all, None , search_term, ordering_string, 'order') 803 queryset_with_search = _get_queryset(Task, queryset_all, None , search_term, ordering_string, 'order')
798 queryset = _get_queryset(Task, queryset_all, filter_string, search_term, ordering_string, 'order') 804 queryset = _get_queryset(Task, queryset_all, filter_string, search_term, ordering_string, 'order')
799 805
806 # compute the anchor's page
807 if anchor:
808 request.GET = request.GET.copy()
809 del request.GET['anchor']
810 i=0
811 a=int(anchor)
812 count_per_page=int(request.GET.get('count', 100))
813 for task in queryset.iterator():
814 if a == task.order:
815 new_page= (i / count_per_page ) + 1
816 request.GET.__setitem__('page', new_page)
817 mandatory_parameters['page']=new_page
818 return _redirect_parameters( variant, request.GET, mandatory_parameters, build_id = build_id)
819 i += 1
820
800 tasks = _build_page_range(Paginator(queryset, request.GET.get('count', 100)),request.GET.get('page', 1)) 821 tasks = _build_page_range(Paginator(queryset, request.GET.get('count', 100)),request.GET.get('page', 1))
801 822
802 # define (and modify by variants) the 'tablecols' members 823 # define (and modify by variants) the 'tablecols' members
@@ -937,16 +958,19 @@ def tasks_common(request, build_id, variant):
937 return render(request, template, context) 958 return render(request, template, context)
938 959
939def tasks(request, build_id): 960def tasks(request, build_id):
940 return tasks_common(request, build_id, 'tasks') 961 return tasks_common(request, build_id, 'tasks', '')
962
963def tasks_task(request, build_id, task_id):
964 return tasks_common(request, build_id, 'tasks', task_id)
941 965
942def buildtime(request, build_id): 966def buildtime(request, build_id):
943 return tasks_common(request, build_id, 'buildtime') 967 return tasks_common(request, build_id, 'buildtime', '')
944 968
945def diskio(request, build_id): 969def diskio(request, build_id):
946 return tasks_common(request, build_id, 'diskio') 970 return tasks_common(request, build_id, 'diskio', '')
947 971
948def cpuusage(request, build_id): 972def cpuusage(request, build_id):
949 return tasks_common(request, build_id, 'cpuusage') 973 return tasks_common(request, build_id, 'cpuusage', '')
950 974
951 975
952def recipes(request, build_id): 976def recipes(request, build_id):