Skip to contentSkip to conversation

toaster: templates make build data breadcrumb consistent

PATCH New Michael Wood 1 participant 2 messages Feb 10, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 toaster: templates make build data breadcrumb consistent

From: Belen Barros Pena <[email protected]>

The pages in the build data section of Toaster showed different
breadcrumbs: in some pages the machine was displayed, but not in others. For builds with more than one target, some pages showed the first alphabetical target (the correct behaviour), others didn't.

This patch removes the inconsistencies, showing exactly the same breacrumb across all pages in the section.

The patch also removes the extra space between the '+' and the number of targets when the builds have more than one target.

Remove an unneeded debug message

---
 lib/toaster/toastergui/templates/basebuilddetailpage.html | 2 +-
 lib/toaster/toastergui/templates/basebuildpage.html       | 3 +--
 lib/toaster/toastergui/templates/builddashboard.html      | 3 +--
 3 files changed, 3 insertions(+), 5 deletions(-)
lib/toaster/toastergui/templates/basebuilddetailpage.html +1 -1
index 22ca50c..ffe7aa4 100644
@@ -8,7 +8,7 @@
         <ul class="breadcrumb" id="breadcrumb">
             <li class="muted">{{build.project.name}}:</li>
             <li><a href="{% url 'projectbuilds' build.project.id %}">Builds</a></li>
-            <li><a href="{%url 'builddashboard' build.pk%}">{{build.target_set.all.0.target}} {%if build.target_set.all.count > 1%}(+ {{build.target_set.all.count|add:"-1"}}){%endif%} ({{build.completed_on|date:"d/m/y H:i"}})</a></li>
+            <li><a href="{%url 'builddashboard' build.pk%}">{{build.get_sorted_target_list.0.target}} {%if build.target_set.all.count > 1%}(+{{build.target_set.all.count|add:"-1"}}){%endif%} {{build.machine}} ({{build.completed_on|date:"d/m/y H:i"}})</a></li>
             {% block localbreadcrumb %}{% endblock %}
         </ul>
         <script>
lib/toaster/toastergui/templates/basebuildpage.html +1 -2
index d441df8..a9048d3 100644
@@ -13,7 +13,7 @@
             <li>
             {% block parentbreadcrumb %}
             <a href="{%url 'builddashboard' build.pk%}">
-                {{build.get_sorted_target_list.0.target}} {%if build.target_set.all.count > 1%}(+ {{build.target_set.all.count|add:"-1"}}){%endif%} ({{build.completed_on|date:"d/m/y H:i"}})
+              {{build.get_sorted_target_list.0.target}} {%if build.target_set.all.count > 1%}(+{{build.target_set.all.count|add:"-1"}}){%endif%} {{build.machine}} ({{build.completed_on|date:"d/m/y H:i"}})
             </a>
             {% endblock %}
             </li>
@@ -24,7 +24,6 @@
             $('#breadcrumb > li').append('<span class="divider">&rarr;</span>');
             $('#breadcrumb > li:last').addClass("active");
             $('#breadcrumb > li:last > span, #breadcrumb > li:first > span').remove();
-	    console.log("done");
         });
         </script>
     </div>
lib/toaster/toastergui/templates/builddashboard.html +1 -2
index 323bbbb..7857aba 100644
@@ -6,10 +6,9 @@
 {% block parentbreadcrumb %}
 {% if build.get_sorted_target_list.count > 0 %}
   {{build.get_sorted_target_list.0.target}}
-  &nbsp;
 {% endif %}
 
-{%if build.target_set.all.count > 1%}(+ {{build.target_set.all.count|add:"-1"}}){%endif%} {{build.machine}} ({{build.completed_on|date:"d/m/y H:i"}})
+{%if build.target_set.all.count > 1%}(+{{build.target_set.all.count|add:"-1"}}){%endif%} {{build.machine}} ({{build.completed_on|date:"d/m/y H:i"}})
 {% endblock %}
 
 {% block buildinfomain %}
Signature · 1 line
2.5.0
#1 lore raw

PATCH 2/2 toaster: build section Improve display of builds when > 1 targets

From: Belen Barros Pena <[email protected]>

* Display always the first target in alphabetical order to match what we do in the breadcrumbs and the build dashboard heading

* Remove the extra space between the '+' and the additional number of targets

* Make sure the tooltip with the full target list takes the Bootstrap tooltip styles

* Replace the word 'targets' in the tooltip with 'recipes', since that's how we call build targets everywhere else in Toaster

---
 lib/toaster/toastergui/static/js/libtoaster.js    |  8 ++++++--
 lib/toaster/toastergui/templates/mrb_section.html | 11 ++++++-----
 2 files changed, 12 insertions(+), 7 deletions(-)
lib/toaster/toastergui/static/js/libtoaster.js +6 -2
index 1012034..a370051 100644
@@ -443,8 +443,12 @@ $(document).ready(function() {
         $('.tooltip').hide();
     });
 
-    // enable help information tooltip
-    $(".get-help").tooltip({container:'body', html:true, delay:{show:300}});
+    /* Initialise bootstrap tooltips */
+    $(".get-help, [data-toggle=tooltip]").tooltip({
+      container : 'body',
+      html : true,
+      delay: { show : 300 }
+    });
 
     // show help bubble only on hover inside tables
     $(".hover-help").css("visibility","hidden");
lib/toaster/toastergui/templates/mrb_section.html +6 -5
index 2f4820c..d1d52ef 100644
@@ -38,8 +38,9 @@
             {% if build.target_set.all.count > 0 %}
                 <span data-toggle="tooltip"
                   {% if build.target_set.all.count > 1 %}
-                    title="Targets:
-                    {% for target in build.target_set.all %}
+                    {{build.get_sorted_target_list.0.target}}
+                    title="Recipes:
+                    {% for target in build.get_sorted_target_list %}
                         {% if target.task %}
                             {{target.target}}:{{target.task}}
                         {% else %}
@@ -49,12 +50,12 @@
                   {% endif %}
                 >
                 {% if build.target_set.all.0.task %}
-                    {{build.target_set.all.0.target}}:{{build.target_set.all.0.task}}
+                    {{build.get_sorted_target_list.0.target}}:{{build.target_set.all.0.task}}
                 {% else %}
-                    {{build.target_set.all.0.target}}
+                    {{build.get_sorted_target_list.0.target}}
                 {% endif %}
                 {% if build.target_set.all.count > 1 %}
-                    (+ {{build.target_set.all.count|add:"-1"}})
+                    (+{{build.target_set.all.count|add:"-1"}})
                 {% endif %}
                 </span>
              {% endif %}
Signature · 1 line
2.5.0