Patchwork [bitbake-devel,14/14] toaster: added covered task list

login
register
mail settings
Submitter Alexandru DAMIAN
Date April 4, 2014, 2:10 p.m.
Message ID <21e31a9751934c23c19ec919116455369137c93a.1396620556.git.alexandru.damian@intel.com>
Download mbox | patch
Permalink /patch/70135/
State New
Headers show

Comments

Alexandru DAMIAN - April 4, 2014, 2:10 p.m.
From: Farrell Wymore <farrell.wymore@windriver.com>

if a task has a 'covered' indication, the list of tasks that
covered the task are computed and displayed. amended to add tooltip.

[YOCTO #5925]

Signed-off-by: Farrell Wymore <farrell.wymore@windriver.com>
---
 lib/toaster/toastergui/templates/task.html | 11 ++++-
 lib/toaster/toastergui/views.py            | 64 ++++++++++++++++++++----------
 2 files changed, 52 insertions(+), 23 deletions(-)

Patch

diff --git a/lib/toaster/toastergui/templates/task.html b/lib/toaster/toastergui/templates/task.html
index c1504b6..66a6695 100644
--- a/lib/toaster/toastergui/templates/task.html
+++ b/lib/toaster/toastergui/templates/task.html
@@ -109,7 +109,16 @@ 
             </dt>
             <dd>
                 <ul>
-                    <li><p class="alert-info">TODO:Covering tasks will be displayed here</p></li>
+                  {% for t in covered_by %}
+                    <li>
+                      <a href="{%url 'task' t.build.pk t.pk%}"
+                         class="task-info"
+                        title="{{t.get_executed_display}} | {{t.get_outcome_display}}">
+                        {{t.recipe.name}}_{{t.recipe.version}}
+                        {{t.task_name}}
+                      </a>
+                    </li>
+                  {% endfor %}
                 </ul>
             </dd>
         </dl>
diff --git a/lib/toaster/toastergui/views.py b/lib/toaster/toastergui/views.py
index 2da81c1..910b3b9 100644
--- a/lib/toaster/toastergui/views.py
+++ b/lib/toaster/toastergui/views.py
@@ -448,38 +448,58 @@  def builddashboard( request, build_id ):
     return render( request, template, context )
 
 
-def task(request, build_id, task_id):
-    template = "task.html"
-    if Task.objects.filter(pk=task_id).count() == 0 :
-        return redirect(builds)
-    task = Task.objects.filter(pk=task_id)[0]
-
-    dependencies = sorted(_find_task_dep(task), key=lambda t:'%s_%s %s'%(t.recipe.name, t.recipe.version, t.task_name))
-    reverse_dependencies = sorted(_find_task_revdep(task), key=lambda t:'%s_%s %s'%(t.recipe.name, t.recipe.version, t.task_name))
+def generateCoveredList( task ):
+    revList = _find_task_revdep( task );
+    list = { };
+    for t in revList:
+        if ( t.outcome == Task.OUTCOME_COVERED ):
+            list.update( generateCoveredList( t ));
+        else:
+            list[ t.task_name ] = t;
+    return( list );
 
+def task( request, build_id, task_id ):
+    template = "task.html"
+    tasks = Task.objects.filter( pk=task_id )
+    if tasks.count( ) == 0:
+        return redirect( builds )
+    task = tasks[ 0 ];
+    dependencies = sorted(
+        _find_task_dep( task ),
+        key=lambda t:'%s_%s %s'%(t.recipe.name, t.recipe.version, t.task_name))
+    reverse_dependencies = sorted(
+        _find_task_revdep( task ),
+        key=lambda t:'%s_%s %s'%( t.recipe.name, t.recipe.version, t.task_name ))
+    coveredBy = '';
+    if ( task.outcome == Task.OUTCOME_COVERED ):
+        dict = generateCoveredList( task )
+        coveredBy = [ ]
+        for name, t in dict.items( ):
+            coveredBy.append( t )
     log_head = ''
     log_body = ''
     if task.outcome == task.OUTCOME_FAILED:
         pass
-# FIXME: the log should be read from the orm_logmessage table.
-# This will be fixed when the backend is done.
 
     context = {
-            'build' : Build.objects.filter(pk=build_id)[0],
-            'object': task,
-            'task':task,
-            'deps': dependencies,
-            'rdeps': reverse_dependencies,
-            'log_head':log_head,
-            'log_body':log_body,
-            'showing_matches':False,
+            'build'           : Build.objects.filter( pk = build_id )[ 0 ],
+            'object'          : task,
+            'task'            : task,
+            'covered_by'      : coveredBy,
+            'deps'            : dependencies,
+            'rdeps'           : reverse_dependencies,
+            'log_head'        : log_head,
+            'log_body'        : log_body,
+            'showing_matches' : False,
     }
+    if request.GET.get( 'show_matches', "" ):
+        context[ 'showing_matches' ] = True
+        context[ 'matching_tasks' ] = Task.objects.filter( 
+            sstate_checksum=task.sstate_checksum ).filter( 
+            build__completed_on__lt=task.build.completed_on ).order_by('-build__completed_on')
 
-    if request.GET.get('show_matches', ""):
-        context['showing_matches'] = True
-        context['matching_tasks'] = Task.objects.filter(sstate_checksum=task.sstate_checksum).filter(build__completed_on__lt=task.build.completed_on).order_by('-build__completed_on')
+    return render( request, template, context )
 
-    return render(request, template, context)
 
 def recipe(request, build_id, recipe_id):
     template = "recipe.html"