[oe-commits] [bitbake] 40/45: toaster: add rev dep column to image detail pages
git at git.openembedded.org
git at git.openembedded.org
Wed Apr 6 22:11:58 UTC 2016
rpurdie pushed a commit to branch master
in repository bitbake.
commit 2f978dccaa1ec82c7ad350bdc1cd9500000984eb
Author: Dave Lerner <dave.lerner at windriver.com>
AuthorDate: Wed Apr 6 14:44:41 2016 +0100
toaster: add rev dep column to image detail pages
Add a column to the custom image pages that shows the reverse
dependencies in a format matching the dependencies column:
- either blank or a button showing the count of reverse dependencies,
- when the button is clicked, a popover appears showing the list
of reverse dependencies, with each package's size, and the total
size of all of the reverse dependencies.
The implementation adds a packages table method to retreive the reverse
dependency total size, and adds a separate 'popover' html template. Both
of these changes follow the pattern for the dependencies column.
[YOCTO #9163]
Signed-off-by: Dave Lerner <dave.lerner at windriver.com>
Signed-off-by: Elliot Smith <elliot.smith at intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
lib/toaster/orm/models.py | 7 +++++++
lib/toaster/toastergui/tables.py | 6 ++++++
.../templates/snippets/pkg_revdependencies_popover.html | 14 ++++++++++++++
3 files changed, 27 insertions(+)
diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
index 2a01184..68c3072 100644
--- a/lib/toaster/orm/models.py
+++ b/lib/toaster/orm/models.py
@@ -822,6 +822,13 @@ class Package_DependencyManager(models.Manager):
"""
return self.all().aggregate(Sum('depends_on__size'))
+ def get_total_revdeps_size(self):
+ """ Returns the total file size of all the packages that depend on
+ this package.
+ """
+ return self.all().aggregate(Sum('package_id__size'))
+
+
def all_depends(self):
""" Returns just the depends packages and not any other dep_type """
return self.filter(Q(dep_type=Package_Dependency.TYPE_RDEPENDS) |
diff --git a/lib/toaster/toastergui/tables.py b/lib/toaster/toastergui/tables.py
index 385d658..2cc2f4e 100644
--- a/lib/toaster/toastergui/tables.py
+++ b/lib/toaster/toastergui/tables.py
@@ -725,6 +725,12 @@ class PackagesTable(ToasterTable):
static_data_template='\
{% include "snippets/pkg_dependencies_popover.html" %}')
+ self.add_column(title="Reverse dependencies",
+ static_data_name="reverse_dependencies",
+ static_data_template='\
+ {% include "snippets/pkg_revdependencies_popover.html" %}',
+ hidden=True)
+
self.add_column(title="Recipe",
field_name="recipe__name",
orderable=True,
diff --git a/lib/toaster/toastergui/templates/snippets/pkg_revdependencies_popover.html b/lib/toaster/toastergui/templates/snippets/pkg_revdependencies_popover.html
new file mode 100644
index 0000000..453a9d0
--- /dev/null
+++ b/lib/toaster/toastergui/templates/snippets/pkg_revdependencies_popover.html
@@ -0,0 +1,14 @@
+{# Popover that displays the reverse dependencies and sizes of a package 'data' used in the Packages table #}
+{% with data.package_dependencies_target.all_depends.count as dep_count %}
+{% load projecttags %}
+{% if dep_count %}
+ <a data-content="<ul class='unstyled'>
+ {% for dep in data.package_dependencies_target.all_depends|dictsort:'package.name' %}
+ <li>{{dep.package.name}} {% if dep.package.size > 0 %}({{dep.package.size|filtered_filesizeformat}}){% endif %}</li>
+ {% endfor %}
+ </ul>" title="" class="btn" data-original-title="
+ <strong>{{data.name}}</strong> reverse dependencies - <strong>{{data.package_dependencies_target.get_total_revdeps_size.package_id__size__sum|filtered_filesizeformat}}</strong>">
+ {{dep_count}}
+</a>
+{% endif %}
+{% endwith %}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list