summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-02-24 17:20:52 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-24 23:35:43 +0000
commit4742ae94a91028f7128b862fdb6ec80123749859 (patch)
tree36806ada60bf85c818cd92727937f57ea2cd234b /bitbake
parent00e3545029a6e08900591e4c1001c17fbd0c4566 (diff)
downloadpoky-4742ae94a91028f7128b862fdb6ec80123749859.tar.gz
bitbake: toaster: layerdetails Fix pagination controls
Bring the pagination controls into line with others in toaster by limiting the number of page buttons to 5 [YOCTO #7195] (Bitbake rev: 0b35eed7ca758476f20d6875291ee31fad35b7d3) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/toastergui/templates/layerdetails.html4
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py20
2 files changed, 4 insertions, 20 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/layerdetails.html b/bitbake/lib/toaster/toastergui/templates/layerdetails.html
index 49c62c6bc0..1f48c653a9 100644
--- a/bitbake/lib/toaster/toastergui/templates/layerdetails.html
+++ b/bitbake/lib/toaster/toastergui/templates/layerdetails.html
@@ -287,7 +287,7 @@
287 {%else%} 287 {%else%}
288 <li class="disabled"><a href="#">&laquo;</a></li> 288 <li class="disabled"><a href="#">&laquo;</a></li>
289 {%endif%} 289 {%endif%}
290 {% for i in targets.paginator.page_range %} 290 {% for i in targets.page_range %}
291 <li {%if i == targets.number %} class="active" {%endif%}><a href="?tpage={{i}}#targets">{{i}}</a></li> 291 <li {%if i == targets.number %} class="active" {%endif%}><a href="?tpage={{i}}#targets">{{i}}</a></li>
292 {% endfor %} 292 {% endfor %}
293 {%if targets.has_next%} 293 {%if targets.has_next%}
@@ -418,7 +418,7 @@
418 {%else%} 418 {%else%}
419 <li class="disabled"><a href="#">&laquo;</a></li> 419 <li class="disabled"><a href="#">&laquo;</a></li>
420 {%endif%} 420 {%endif%}
421 {% for i in machines.paginator.page_range %} 421 {% for i in machines.page_range %}
422 <li {%if i == machines.number %} class="active" {%endif%}><a href="?mpage={{i}}#machines">{{i}}</a></li> 422 <li {%if i == machines.number %} class="active" {%endif%}><a href="?mpage={{i}}#machines">{{i}}</a></li>
423 {% endfor %} 423 {% endfor %}
424 {%if machines.has_next%} 424 {%if machines.has_next%}
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 196e66ea1b..0284b1abcd 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -2630,15 +2630,7 @@ if toastermain.settings.MANAGED:
2630 Q(name__icontains=request.GET['targets_search']) | 2630 Q(name__icontains=request.GET['targets_search']) |
2631 Q(summary__icontains=request.GET['targets_search'])) 2631 Q(summary__icontains=request.GET['targets_search']))
2632 2632
2633 targets = Paginator(targets_query.order_by("name"), limit) 2633 targets = _build_page_range(Paginator(targets_query.order_by("name"), limit), request.GET.get('tpage', 1))
2634
2635 if request.GET.has_key("tpage"):
2636 try:
2637 targets = targets.page(request.GET['tpage'])
2638 except EmptyPage:
2639 targets = targets.page(targets.num_pages)
2640 else:
2641 targets = targets.page(1)
2642 2634
2643 machines_query = Machine.objects.filter(layer_version=layer_version) 2635 machines_query = Machine.objects.filter(layer_version=layer_version)
2644 2636
@@ -2648,15 +2640,7 @@ if toastermain.settings.MANAGED:
2648 Q(name__icontains=request.GET['machines_search']) | 2640 Q(name__icontains=request.GET['machines_search']) |
2649 Q(description__icontains=request.GET['machines_search'])) 2641 Q(description__icontains=request.GET['machines_search']))
2650 2642
2651 machines = Paginator(machines_query.order_by("name"), limit) 2643 machines = _build_page_range(Paginator(machines_query.order_by("name"), limit), request.GET.get('mpage', 1))
2652
2653 if request.GET.has_key("mpage"):
2654 try:
2655 machines = machines.page(request.GET['mpage'])
2656 except EmptyPage:
2657 machines = machines.page(machines.num_pages)
2658 else:
2659 machines = machines.page(1)
2660 2644
2661 context = { 2645 context = {
2662 'layerversion': layer_version, 2646 'layerversion': layer_version,