summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
diff options
context:
space:
mode:
authorDave Lerner <dave.lerner@windriver.com>2014-03-12 16:54:09 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-21 14:47:53 +0000
commit4cdd56fff3471669ff2372f0d8bf15f9a287374a (patch)
tree76b81b2cb87e3b3df9751d8487351b5dfb2c59a3 /bitbake/lib/toaster/toastergui/templatetags/projecttags.py
parente94f0b4e8c2cbea92688975b1a45a061af48911e (diff)
downloadpoky-4cdd56fff3471669ff2372f0d8bf15f9a287374a.tar.gz
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 <dave.lerner@windriver.com> Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/templatetags/projecttags.py')
-rw-r--r--bitbake/lib/toaster/toastergui/templatetags/projecttags.py49
1 files changed, 49 insertions, 0 deletions
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 ):
215 comma = ", "; 215 comma = ", ";
216 return( extensions ); 216 return( extensions );
217 217
218@register.filter
219def filtered_installedsize(size, installed_size):
220 """If package.installed_size not null and not empty return it,
221 else return package.size
222 """
223 return size if (installed_size == 0) or (installed_size == "") or (installed_size == None) else installed_size
224
225@register.filter
226def filtered_installedname(name, installed_name):
227 """If package.installed_name not null and not empty
228 return <div class=muted> as {{package.installed_name}}
229 otherwise ""
230 """
231 return name if (name == installed_name) or (not installed_name) or (installed_name == "") else name + " as " + installed_name
232
233@register.filter
234def filtered_packageversion(version, revision):
235 """ Emit "version-revision" if version and revision are not null
236 else "version" if version is not null
237 else ""
238 """
239 return "" if (not version or version == "") else version if (not revision or revision == "") else version + "-" + revision
240
241from django.db import models
242from orm.models import Package
243@register.filter
244def runtime_dependencies(package_object, targetid):
245 """ Return a queryset that lists the packages this package depends on
246 """
247 return package_object.package_dependencies_source.filter(target_id__exact=targetid, dep_type__in={'1'})
248
249@register.filter
250def reverse_runtime_dependencies(package_object, targetid):
251 """ Return a queryset that lists the packages depending on this package
252 """
253 return package_object.package_dependencies_target.filter(target_id__exact = targetid,dep_type__in={'1'})
254
255@register.filter
256def filter_sizeovertotal(package_object, total_size):
257 """ Return the % size of the package over the total size argument
258 formatted nicely.
259 """
260 size = package_object.installed_size
261 if size == None or size == '':
262 size = package_object.size
263
264 return '{:.1%}'.format(float(size)/float(total_size))
265
266