Patchwork [bitbake-devel,4/4] toaster: add errors and warnings listing

login
register
mail settings
Submitter Alexandru DAMIAN
Date March 12, 2014, 6:47 p.m.
Message ID <93666733ffc89c9a3534c2ad774c0a49857c028c.1394649860.git.alexandru.damian@intel.com>
Download mbox | patch
Permalink /patch/68539/
State New
Headers show

Comments

Alexandru DAMIAN - March 12, 2014, 6:47 p.m.
From: Amit Kumar Chaudhary <amit@floatingpondtech.com>

Add the errors and warnings listing to the build
dashboard page.

Signed-off-by: Amit Kumar Chaudhary <amit@floatingpondtech.com>
---
 lib/toaster/toastergui/static/js/main.js           | 20 ++++++++
 .../toastergui/templates/builddashboard.html       | 56 +++++++++++++++++++++-
 lib/toaster/toastergui/views.py                    |  3 +-
 3 files changed, 76 insertions(+), 3 deletions(-)

Patch

diff --git a/lib/toaster/toastergui/static/js/main.js b/lib/toaster/toastergui/static/js/main.js
index c80f716..07aba3d 100644
--- a/lib/toaster/toastergui/static/js/main.js
+++ b/lib/toaster/toastergui/static/js/main.js
@@ -91,3 +91,23 @@  $(document).ready(function() {
     });
 
 });
+
+$(document).ready(function() {
+    //toggle the errors and warnings sections
+    $('.show-errors').click(function() {
+        $('#collapse-errors').addClass('in');
+    });
+    $('.toggle-errors').click(function() {
+        $('#collapse-errors').toggleClass('in');
+    });
+    $('.show-warnings').click(function() {
+        $('#collapse-warnings').addClass('in');
+    });
+    $('.toggle-warnings').click(function() {
+        $('#collapse-warnings').toggleClass('in');
+    });
+    //show warnings section when requested from the previous page
+    if (location.href.search('#warnings') > -1) {
+        $('#collapse-warnings').addClass('in');
+    }
+});
diff --git a/lib/toaster/toastergui/templates/builddashboard.html b/lib/toaster/toastergui/templates/builddashboard.html
index b6506c7..763a28d 100644
--- a/lib/toaster/toastergui/templates/builddashboard.html
+++ b/lib/toaster/toastergui/templates/builddashboard.html
@@ -18,10 +18,10 @@ 
   <div class="alert {%if build.outcome == build.SUCCEEDED%}alert-success{%elif build.outcome == build.FAILED%}alert-error{%else%}alert-info{%endif%}">
     <div class="row-fluid lead">
             <span class="pull-left"><strong>{%if build.outcome == build.SUCCEEDED%}Completed{%elif build.outcome == build.FAILED%}Failed{%else%}{%endif%}</strong> {{build.completed_on|date:"d/m/y H:i"}} with </span>{%if build.outcome == build.SUCCEEDED or build.outcome == build.FAILED %}{% if  build.errors_no %}
-            <span class="span2"><i class="icon-minus-sign red"></i><strong><a href="{%url 'builddashboard' build.pk%}" class="error"> {{build.errors_no}} error{{build.errors_no|pluralize}}</a></strong></span>
+            <span class="span2"><i class="icon-minus-sign red"></i><strong><a href="#errors" class="error"> {{build.errors_no}} error{{build.errors_no|pluralize}}</a></strong></span>
 {% endif %}
 {% if  build.warnings_no %}
-            <span class="span2"><i class="icon-warning-sign yellow"></i><strong><a href="{%url 'builddashboard' build.pk%}" class="warning"> {{build.warnings_no}} warning{{build.warnings_no|pluralize}}</a></strong></span>
+            <span class="span2"><i class="icon-warning-sign yellow"></i><strong><a href="#warnings" class="warning"> {{build.warnings_no}} warning{{build.warnings_no|pluralize}}</a></strong></span>
 {% endif %}
             <span class="pull-right">Build time: <a href="build-time.html">{{ build.timespent|sectohms }}</a></span>
 {%endif%}
@@ -29,6 +29,32 @@ 
   </div>
 </div>
 
+{% if build.errors_no %}
+<div class="accordion span10 pull-right" id="errors">
+  <div class="accordion-group">
+    <div class="accordion-heading">
+      <a class="accordion-toggle error toggle-errors">
+         <h2 id="error-toggle">
+           <i class="icon-minus-sign"></i>
+           {{build.errors_no}} error{{build.errors_no|pluralize}}
+         </h2>
+      </a>
+    </div>
+    <div class="accordion-body collapse in" id="collapse-errors">
+      <div class="accordion-inner">
+        <div class="span10">
+          {% for error in logmessages %}{% if error.level == 2 %}
+            <div class="alert alert-error">
+              <pre>{{error.message}}</pre>
+            </div>
+          {% endif %}{% endfor %}
+        </div>
+      </div>
+    </div>
+  </div>
+</div>
+{% endif %}
+
 {%if build.outcome == build.SUCCEEDED%}
 <!-- built images -->
 <div class="row-fluid span10 pull-right">
@@ -71,4 +97,30 @@ 
     </div>
 </div>
 
+{% if build.warnings_no %}
+<div class="accordion span10 pull-right" id="warnings">
+  <div class="accordion-group">
+    <div class="accordion-heading">
+      <a class="accordion-toggle warning toggle-warnings">
+        <h2 id="warning-toggle">
+          <i class="icon-warning-sign"></i>
+          {{build.warnings_no}} warning{{build.warnings_no|pluralize}}
+        </h2>
+      </a>
+    </div>
+    <div class="accordion-body collapse" id="collapse-warnings">
+      <div class="accordion-inner">
+        <div class="span10">
+          {% for warning in logmessages %}{% if warning.level == 1 %}
+            <div class="alert alert-warning">
+              <pre>{{warning.message}}</pre>
+            </div>
+          {% endif %}{% endfor %}
+        </div>
+      </div>
+    </div>
+  </div>
+</div>
+{% endif %}
+
 {% endblock %}
diff --git a/lib/toaster/toastergui/views.py b/lib/toaster/toastergui/views.py
index a499c30..7f61ade 100644
--- a/lib/toaster/toastergui/views.py
+++ b/lib/toaster/toastergui/views.py
@@ -356,7 +356,8 @@  def builddashboard(request, build_id):
         return redirect(builds)
     context = {
             'build' : Build.objects.filter(pk=build_id)[0],
-            'recipecount' : Recipe.objects.filter(layer_version__id__in=Layer_Version.objects.filter(build=build_id)).count()
+            'recipecount' : Recipe.objects.filter(layer_version__id__in=Layer_Version.objects.filter(build=build_id)).count(),
+            'logmessages' : LogMessage.objects.filter(build=build_id),
     }
     return render(request, template, context)