[gnome-continuous-yocto/gnomeostree-3.28-rocko: 1294/8267] bitbake: toaster: display Target targets in build dashboard



commit b0585e6b0c8d4b9a7d2102e615fff0ef069e0f98
Author: Elliot Smith <elliot smith intel com>
Date:   Tue Jul 12 15:54:43 2016 -0700

    bitbake: toaster: display Target targets in build dashboard
    
    The build dashboard was showing the targets for the build in the page
    heading and title as "Target object".
    
    Add a filter which extracts the "target" from each Target object
    as a string so that the heading and title display correctly.
    
    Also sort the image file suffixes alphabetically.
    
    [YOCTO #8556]
    
    (Bitbake rev: 33a24992139e7dc05d14bbe1da60299b732945aa)
    
    Signed-off-by: Elliot Smith <elliot smith intel com>
    Signed-off-by: bavery <brian avery intel com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 .../toastergui/templates/builddashboard.html       |    9 +++++----
 .../toastergui/templatetags/field_values_filter.py |   18 ++++++++++++++++++
 2 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/bitbake/lib/toaster/toastergui/templates/builddashboard.html 
b/bitbake/lib/toaster/toastergui/templates/builddashboard.html
index 04a57ef..dcda2a8 100644
--- a/bitbake/lib/toaster/toastergui/templates/builddashboard.html
+++ b/bitbake/lib/toaster/toastergui/templates/builddashboard.html
@@ -1,8 +1,9 @@
 {% extends "basebuildpage.html" %}
 {% load humanize %}
 {% load projecttags %}
+{% load field_values_filter %}
 
-{% block title %} {{build.target_set.all|dictsort:"target"|join:", "}} {{build.machine}} - 
{{build.project.name}} - Toaster {% endblock %}
+{% block title %} {{build.get_sorted_target_list|field_values:"target"|join:", "}} {{build.machine}} - 
{{build.project.name}} - Toaster {% endblock %}
 {% block parentbreadcrumb %}
 {% if build.get_sorted_target_list.count > 0 %}
   {{build.get_sorted_target_list.0.target}}
@@ -15,7 +16,7 @@
 <!-- page title -->
 <div class="col-md-10">
  <div class="page-header build-data">
-     <h1>{{build.target_set.all|dictsort:"target"|join:", "}} {{build.machine}}</h1>
+     <h1>{{build.get_sorted_target_list|field_values:"target"|join:", "}} {{build.machine}}</h1>
  </div>
 
 <!-- build result bar -->
@@ -113,7 +114,7 @@
             </dt>
             <dd>
                 <ul class="list-unstyled">
-                    {% for i in target.imageFiles %}
+                    {% for i in target.imageFiles|dictsort:"suffix" %}
                         <li>
                             <a href="{% url 'build_artifact' build.pk 'imagefile' i.id %}">
                                 {{i.suffix}}
@@ -261,7 +262,7 @@
         if (location.href.search('#warnings') > -1) {
             $('#warning-info').addClass('in');
         }
-       
+
        //show warnings section when requested from the build outcome
        $(".show-warnings").click(function() {
            $('#warning-info').addClass('in');
diff --git a/bitbake/lib/toaster/toastergui/templatetags/field_values_filter.py 
b/bitbake/lib/toaster/toastergui/templatetags/field_values_filter.py
new file mode 100644
index 0000000..5a73af7
--- /dev/null
+++ b/bitbake/lib/toaster/toastergui/templatetags/field_values_filter.py
@@ -0,0 +1,18 @@
+from django import template
+
+register = template.Library()
+
+def field_values(iterable, field):
+    """
+    Convert an iterable of models into a list of strings, one for each model,
+    where the string for each model is the value of the field "field".
+    """
+    objects = []
+
+    if field:
+        for item in iterable:
+            objects.append(getattr(item, field))
+
+    return objects
+
+register.filter('field_values', field_values)
\ No newline at end of file


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]