summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/views.py
diff options
context:
space:
mode:
authorDave Lerner <dave.lerner@windriver.com>2014-04-08 16:32:21 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-04-09 17:00:02 +0100
commitd3e5632efb1f10143c748c169f6439f39eb3cf21 (patch)
tree8e6709581e91d2d8f46856656560d18ea78063fd /bitbake/lib/toaster/toastergui/views.py
parentdc7d3d29108d63eb5ecf276769f0099a5bc3ab86 (diff)
downloadpoky-d3e5632efb1f10143c748c169f6439f39eb3cf21.tar.gz
bitbake: toaster: sort on size in detail pages
[YOCTO 5778] Implements the features described in the attachment to bugzilla 5778 - new global changes to the format of size data, and - adding sorts by selected columns to specific detail pages. Although new pagination and row search capabilities are shown on the screen shots for the 5778 attachment, those features are specified in a different bugzilla entry 5777 and are not implemented in this commit. Also, the 5778 spec includes table sorting for the recipe package detail page, but sorting for that page was not implemented in this commit due to complications with sorting then returning to a page that is only one URL fragment in a template. The scope of file changes are described below. Changes to support new 'size' field column formats... default.css - added sizecol class style (right justified) projecttags.py - changed filtered_filesizeformat to allow ".0" suffixes Changes that add class 'sizecol, span2(as spec'd) ' to <th> and/or <td> size columns were made to... dirinfo.py, package_built_dependencies.html, package_included_dependencies.html, recipe.html, bpackage.html, and target.html More significant changes to support detail page table sorting are: - tablesort.html: New created to implement the sort icons, directions, and table headings, and suppress sort handling if 'disable_sort' in context, without search or pagination elements ingrained in basetable_top. Confining the changes to this small file reduces the impact (testing and risk) on the larger set of files that arleady include basetable_top/bottom files. - view.py: Modified the following view functions with - trivial changes for size formatting to the views: target, - changes to package_built_detail, package_included_detail, package_included_reverse_dependencies to handle the sorting implementation as well as moving headings and size formatting for size columns from templates to the views. - Implementation of the detail sorting using above in: package_built_detail.html, package_included_detail.html, and package_included_reverse_dependencies.html to include the tablesort heading setup, format the size column, and iterate over the new sorted objects, suppressing sorts if table row count less than 2. (Bitbake rev: d16126e9abfffde66ab70865a81997322847d44e) Signed-off-by: Dave Lerner <dave.lerner@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/views.py')
-rw-r--r--bitbake/lib/toaster/toastergui/views.py115
1 files changed, 91 insertions, 24 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index f5fa72e610..36eb0bf97e 100644
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -563,13 +563,13 @@ def target(request, build_id, target_id):
563 'qhelp':'The size of the package', 563 'qhelp':'The size of the package',
564 'orderfield': _get_toggle_order(request, "size", True), 564 'orderfield': _get_toggle_order(request, "size", True),
565 'ordericon':_get_toggle_order_icon(request, "size"), 565 'ordericon':_get_toggle_order_icon(request, "size"),
566 'clclass': 'package_size', 566 'clclass': 'package_size span2',
567 'hidden' : 0, 567 'hidden' : 0,
568 }, 568 },
569 { 569 {
570 'name':'Size over total (%)', 570 'name':'Size over total (%)',
571 'qhelp':'Proportion of the overall included package size represented by this package', 571 'qhelp':'Proportion of the overall included package size represented by this package',
572 'clclass': 'size_over_total', 572 'clclass': 'size_over_total span2',
573 'hidden' : 1, 573 'hidden' : 1,
574 }, 574 },
575 { 575 {
@@ -1254,7 +1254,7 @@ def bpackage(request, build_id):
1254 'qhelp':'The size of the package', 1254 'qhelp':'The size of the package',
1255 'orderfield': _get_toggle_order(request, "size", True), 1255 'orderfield': _get_toggle_order(request, "size", True),
1256 'ordericon':_get_toggle_order_icon(request, "size"), 1256 'ordericon':_get_toggle_order_icon(request, "size"),
1257 'clclass': 'size', 'hidden': 0, 1257 'clclass': 'size span2', 'hidden': 0,
1258 }, 1258 },
1259 { 1259 {
1260 'name':'License', 1260 'name':'License',
@@ -1456,13 +1456,40 @@ def package_built_detail(request, build_id, package_id):
1456 template = "package_built_detail.html" 1456 template = "package_built_detail.html"
1457 if Build.objects.filter(pk=build_id).count() == 0 : 1457 if Build.objects.filter(pk=build_id).count() == 0 :
1458 return redirect(builds) 1458 return redirect(builds)
1459
1460 # follow convention for pagination w/ search although not used for this view
1461 queryset = Package_File.objects.filter(package_id__exact=package_id)
1462 mandatory_parameters = { 'count': 25, 'page' : 1, 'orderby':'path:+'};
1463 retval = _verify_parameters( request.GET, mandatory_parameters )
1464 if retval:
1465 return _redirect_parameters( 'package_built_detail', request.GET, mandatory_parameters, build_id = build_id, package_id = package_id)
1466
1467 (filter_string, search_term, ordering_string) = _search_tuple(request, Package_File)
1468 paths = _get_queryset(Package_File, queryset, filter_string, search_term, ordering_string, 'path')
1469
1459 package = Package.objects.filter(pk=package_id)[0] 1470 package = Package.objects.filter(pk=package_id)[0]
1460 package.fullpackagespec = _get_fullpackagespec(package) 1471 package.fullpackagespec = _get_fullpackagespec(package)
1461 context = { 1472 context = {
1462 'build' : Build.objects.filter(pk=build_id)[0], 1473 'build' : Build.objects.filter(pk=build_id)[0],
1463 'package' : package, 1474 'package' : package,
1464 'dependency_count' : _get_package_dependency_count(package, -1, False), 1475 'dependency_count' : _get_package_dependency_count(package, -1, False),
1476 'objects' : paths,
1477 'tablecols':[
1478 {
1479 'name':'File',
1480 'orderfield': _get_toggle_order(request, "path"),
1481 'ordericon':_get_toggle_order_icon(request, "path"),
1482 },
1483 {
1484 'name':'Size',
1485 'orderfield': _get_toggle_order(request, "size", True),
1486 'ordericon':_get_toggle_order_icon(request, "size"),
1487 'dclass': 'sizecol span2',
1488 },
1489 ]
1465 } 1490 }
1491 if paths.all().count() < 2:
1492 context['disable_sort'] = True;
1466 return render(request, template, context) 1493 return render(request, template, context)
1467 1494
1468def package_built_dependencies(request, build_id, package_id): 1495def package_built_dependencies(request, build_id, package_id):
@@ -1488,6 +1515,17 @@ def package_included_detail(request, build_id, target_id, package_id):
1488 if Build.objects.filter(pk=build_id).count() == 0 : 1515 if Build.objects.filter(pk=build_id).count() == 0 :
1489 return redirect(builds) 1516 return redirect(builds)
1490 1517
1518
1519 # follow convention for pagination w/ search although not used for this view
1520 mandatory_parameters = { 'count': 25, 'page' : 1, 'orderby':'path:+'};
1521 retval = _verify_parameters( request.GET, mandatory_parameters )
1522 if retval:
1523 return _redirect_parameters( 'package_included_detail', request.GET, mandatory_parameters, build_id = build_id, target_id = target_id, package_id = package_id)
1524 (filter_string, search_term, ordering_string) = _search_tuple(request, Package_File)
1525
1526 queryset = Package_File.objects.filter(package_id__exact=package_id)
1527 paths = _get_queryset(Package_File, queryset, filter_string, search_term, ordering_string, 'path')
1528
1491 package = Package.objects.filter(pk=package_id)[0] 1529 package = Package.objects.filter(pk=package_id)[0]
1492 package.fullpackagespec = _get_fullpackagespec(package) 1530 package.fullpackagespec = _get_fullpackagespec(package)
1493 package.alias = _get_package_alias(package) 1531 package.alias = _get_package_alias(package)
@@ -1497,8 +1535,24 @@ def package_included_detail(request, build_id, target_id, package_id):
1497 'target' : target, 1535 'target' : target,
1498 'package' : package, 1536 'package' : package,
1499 'reverse_count' : _get_package_reverse_dep_count(package, target_id), 1537 'reverse_count' : _get_package_reverse_dep_count(package, target_id),
1500 'dependency_count' : _get_package_dependency_count(package, target_id, True) 1538 'dependency_count' : _get_package_dependency_count(package, target_id, True),
1539 'objects': paths,
1540 'tablecols':[
1541 {
1542 'name':'File',
1543 'orderfield': _get_toggle_order(request, "path"),
1544 'ordericon':_get_toggle_order_icon(request, "path"),
1545 },
1546 {
1547 'name':'Size',
1548 'orderfield': _get_toggle_order(request, "size", True),
1549 'ordericon':_get_toggle_order_icon(request, "size"),
1550 'dclass': 'sizecol span2',
1551 },
1552 ]
1501 } 1553 }
1554 if paths.all().count() < 2:
1555 context['disable_sort'] = True;
1502 return render(request, template, context) 1556 return render(request, template, context)
1503 1557
1504def package_included_dependencies(request, build_id, target_id, package_id): 1558def package_included_dependencies(request, build_id, target_id, package_id):
@@ -1528,36 +1582,49 @@ def package_included_reverse_dependencies(request, build_id, target_id, package_
1528 if Build.objects.filter(pk=build_id).count() == 0 : 1582 if Build.objects.filter(pk=build_id).count() == 0 :
1529 return redirect(builds) 1583 return redirect(builds)
1530 1584
1585 mandatory_parameters = { 'count': 25, 'page' : 1, 'orderby':'package__name:+'};
1586 retval = _verify_parameters( request.GET, mandatory_parameters )
1587 if retval:
1588 return _redirect_parameters( 'package_included_reverse_dependencies', request.GET, mandatory_parameters, build_id = build_id, target_id = target_id, package_id = package_id)
1589 (filter_string, search_term, ordering_string) = _search_tuple(request, Package_File)
1590
1591 queryset = Package_Dependency.objects.select_related('depends_on__name', 'depends_on__size').filter(depends_on=package_id, target_id=target_id, dep_type=Package_Dependency.TYPE_TRDEPENDS)
1592 objects = _get_queryset(Package_Dependency, queryset, filter_string, search_term, ordering_string, 'package__name')
1593
1531 package = Package.objects.filter(pk=package_id)[0] 1594 package = Package.objects.filter(pk=package_id)[0]
1532 package.fullpackagespec = _get_fullpackagespec(package) 1595 package.fullpackagespec = _get_fullpackagespec(package)
1533 package.alias = _get_package_alias(package) 1596 package.alias = _get_package_alias(package)
1534 target = Target.objects.filter(pk=target_id)[0] 1597 target = Target.objects.filter(pk=target_id)[0]
1535 1598 for o in objects:
1536 reverse_deps = [] 1599 if o.package.version != '':
1537 alldeps = package.package_dependencies_target.filter(target_id__exact=target_id) 1600 o.package.version += '-' + o.package.revision
1538 for idep in alldeps: 1601 o.alias = _get_package_alias(o.package)
1539 dep_package = Package.objects.get(pk=idep.package_id)
1540 version = dep_package.version
1541 if version != '' :
1542 version += '-' + dep_package.revision
1543 dep = {
1544 'name' : dep_package.name,
1545 'alias' : _get_package_alias(dep_package),
1546 'dependent_id' : dep_package.id,
1547 'version' : version,
1548 'size' : dep_package.size
1549 }
1550 if idep.dep_type == Package_Dependency.TYPE_TRDEPENDS :
1551 reverse_deps.append(dep)
1552
1553 context = { 1602 context = {
1554 'build' : Build.objects.filter(pk=build_id)[0], 1603 'build' : Build.objects.filter(pk=build_id)[0],
1555 'package' : package, 1604 'package' : package,
1556 'target' : target, 1605 'target' : target,
1557 'reverse_deps' : reverse_deps, 1606 'objects' : objects,
1558 'reverse_count' : _get_package_reverse_dep_count(package, target_id), 1607 'reverse_count' : _get_package_reverse_dep_count(package, target_id),
1559 'dependency_count' : _get_package_dependency_count(package, target_id, True) 1608 'dependency_count' : _get_package_dependency_count(package, target_id, True),
1609 'tablecols':[
1610 {
1611 'name':'Package',
1612 'orderfield': _get_toggle_order(request, "package__name"),
1613 'ordericon': _get_toggle_order_icon(request, "package__name"),
1614 },
1615 {
1616 'name':'Version',
1617 },
1618 {
1619 'name':'Size',
1620 'orderfield': _get_toggle_order(request, "package__size", True),
1621 'ordericon': _get_toggle_order_icon(request, "package__size"),
1622 'dclass': 'sizecol span2',
1623 },
1624 ]
1560 } 1625 }
1626 if objects.all().count() < 2:
1627 context['disable_sort'] = True;
1561 return render(request, template, context) 1628 return render(request, template, context)
1562 1629
1563def image_information_dir(request, build_id, target_id, packagefile_id): 1630def image_information_dir(request, build_id, target_id, packagefile_id):