From 405e190b314db29e1332c56376dff026a9631202 Mon Sep 17 00:00:00 2001 From: David Reyna Date: Fri, 21 Mar 2014 05:35:50 -0700 Subject: bitbake: toaster: add Image detail and multiple targets to dashboard Filled in the Image section detail information and allow for multiple targets. Each target has a separate section. Added license manifest display. Changed the target of the license manifest link. Added Tasks failed in the build summary. The target lists required filters to create sorted lists. [YOCTO #4258] [YOCTO #5936] (Bitbake rev: 09b099903bdf51bfb277b9a8f922255cfe83ab96) Signed-off-by: Farrell Wymore Signed-off-by: Richard Purdie --- bitbake/lib/toaster/toastergui/views.py | 49 ++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 4 deletions(-) (limited to 'bitbake/lib/toaster/toastergui/views.py') diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index d1234fe804..4f31ddb4bf 100644 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py @@ -25,7 +25,7 @@ from django.db.models import Q, Sum from django.shortcuts import render, redirect from orm.models import Build, Target, Task, Layer, Layer_Version, Recipe, LogMessage, Variable from orm.models import Task_Dependency, Recipe_Dependency, Package, Package_File, Package_Dependency -from orm.models import Target_Installed_Package, Target_File +from orm.models import Target_Installed_Package, Target_Image_File from django.views.decorators.cache import cache_control from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.http import HttpResponseBadRequest @@ -350,18 +350,59 @@ def builds(request): return render(request, template, context) +## # build dashboard for a single build, coming in as argument +# Each build may contain multiple targets and each target +# may generate multiple image files. display them all. +# def builddashboard(request, build_id): template = "builddashboard.html" if Build.objects.filter(pk=build_id).count() == 0 : return redirect(builds) + build = Build.objects.filter(pk = build_id)[0]; + layerVersionId = Layer_Version.objects.filter( build = build_id ); + recipeCount = Recipe.objects.filter( layer_version__id__in = layerVersionId ).count( ); + tgts = Target.objects.filter( build_id = build_id ).order_by( 'target' ); + + # set up custom target list with computed package and image data + targets = [ ]; + ntargets = 0; + hasImages = False; + for t in tgts: + elem = { }; + elem[ 'target' ] = t; + if ( t.is_image ): + hasImages = True; + npkg = 0; + pkgsz = 0; + pid= 0; + tp = Target_Installed_Package.objects.filter( target_id = t.id ); + package = None; + for p in tp: + pid = p.package_id; + package = Package.objects.get( pk = p.package_id ) + pkgsz = pkgsz + package.size; + npkg = npkg + 1; + elem[ 'npkg' ] = npkg; + elem[ 'pkgsz' ] = pkgsz; + ti = Target_Image_File.objects.filter( target_id = t.id ); + imageFiles = [ ]; + for i in ti: + imageFiles.append({ 'path': i.file_name, 'size' : i.file_size }); + elem[ 'imageFiles' ] = imageFiles; + targets.append( elem ); + 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(), - 'logmessages' : LogMessage.objects.filter(build=build_id), + 'build' : build, + 'hasImages' : hasImages, + 'ntargets' : ntargets, + 'targets' : targets, + 'recipecount' : recipeCount, + 'logmessages' : LogMessage.objects.filter(build=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 : -- cgit v1.2.3-54-g00ecf