From 4cdd56fff3471669ff2372f0d8bf15f9a287374a Mon Sep 17 00:00:00 2001 From: Dave Lerner Date: Wed, 12 Mar 2014 16:54:09 -0500 Subject: bitbake: toaster: image information views [YOCTO # 4346] When a target image is selected, this commit adds to the toaster project a two-tabbed page that shows 1) 'packages included' a table of packages included in the image (see target.html), and 2) 'directory structure', the target image's file system directory and detailed information showing the source of each file in the directory table (see dirinfo.html). The directory structure tab relies on the open source jQuery plugin jtreetable which provides hierarchical table expansions and contractions of the directory entry tables as the user drills down into directories. A file of jtreetable styles that are compatible with other toaster styles is provided included as css/jquery.treetable.theme.toaster.css. The complete unaltered jtreetable plugin is added via a separate commit. This work was developed base on the bugzilla specification number 4346 and the document "Design 1.1 Image information" attached to that report. Whitespace and typo fixes from Alex Damian. (Bitbake rev: 1ba9f310a8b4fd0952a95be86ab43ae27fe6d983) Signed-off-by: Dave Lerner Signed-off-by: Alexandru DAMIAN Signed-off-by: Richard Purdie --- .../toaster/toastergui/templatetags/projecttags.py | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'bitbake/lib/toaster/toastergui/templatetags/projecttags.py') diff --git a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py index 60d5dd0b7c..e08258b6e7 100644 --- a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py +++ b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py @@ -215,3 +215,52 @@ def get_image_extensions( build ): comma = ", "; return( extensions ); +@register.filter +def filtered_installedsize(size, installed_size): + """If package.installed_size not null and not empty return it, + else return package.size + """ + return size if (installed_size == 0) or (installed_size == "") or (installed_size == None) else installed_size + +@register.filter +def filtered_installedname(name, installed_name): + """If package.installed_name not null and not empty + return
as {{package.installed_name}} + otherwise "" + """ + return name if (name == installed_name) or (not installed_name) or (installed_name == "") else name + " as " + installed_name + +@register.filter +def filtered_packageversion(version, revision): + """ Emit "version-revision" if version and revision are not null + else "version" if version is not null + else "" + """ + return "" if (not version or version == "") else version if (not revision or revision == "") else version + "-" + revision + +from django.db import models +from orm.models import Package +@register.filter +def runtime_dependencies(package_object, targetid): + """ Return a queryset that lists the packages this package depends on + """ + return package_object.package_dependencies_source.filter(target_id__exact=targetid, dep_type__in={'1'}) + +@register.filter +def reverse_runtime_dependencies(package_object, targetid): + """ Return a queryset that lists the packages depending on this package + """ + return package_object.package_dependencies_target.filter(target_id__exact = targetid,dep_type__in={'1'}) + +@register.filter +def filter_sizeovertotal(package_object, total_size): + """ Return the % size of the package over the total size argument + formatted nicely. + """ + size = package_object.installed_size + if size == None or size == '': + size = package_object.size + + return '{:.1%}'.format(float(size)/float(total_size)) + + -- cgit v1.2.3-54-g00ecf