]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
toaster: add rev dep column to image detail pages
authorDave Lerner <dave.lerner@windriver.com>
Wed, 6 Apr 2016 13:44:41 +0000 (14:44 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 6 Apr 2016 22:08:34 +0000 (23:08 +0100)
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@windriver.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/toaster/orm/models.py
lib/toaster/toastergui/tables.py
lib/toaster/toastergui/templates/snippets/pkg_revdependencies_popover.html [new file with mode: 0644]

index 2a01184a7328601cb2634c5d7a31c15fa8c5caa6..68c3072991d52c283e7f49a6f1743d22269316a9 100644 (file)
@@ -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) |
index 385d65895d8f141c3e57d34b683d13b14988bf68..2cc2f4eb7bc0f3d212c11cc880493eb5118e1ef1 100644 (file)
@@ -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 (file)
index 0000000..453a9d0
--- /dev/null
@@ -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 %}