From 372c9d144e87ab5f360c9763101916fbcb94e469 Mon Sep 17 00:00:00 2001 From: Alexandru DAMIAN Date: Fri, 29 Aug 2014 16:42:00 +0100 Subject: bitbake: toastergui: added pages for project details We add new pages for the layer importing, layer details, showing project builds and project configuration. The pages are in read-only mode, but they're needed as to be able to verify the quality of data in the system. Write capabilities will be added in a subsequent patch. [YOCTO #6595] [YOCTO #6590] [YOCTO #6591] [YOCTO #6588] [YOCTO #6589] (Bitbake rev: eed9ae5c2a2bd7567e12ae9a4f02a5a966a1e1a3) Signed-off-by: Alexandru DAMIAN Signed-off-by: Richard Purdie --- .../toaster/toastergui/templates/importlayer.html | 68 ++++++++ .../toaster/toastergui/templates/layerdetails.html | 159 +++++++++++++++++ .../lib/toaster/toastergui/templates/layers.html | 2 +- .../lib/toaster/toastergui/templates/project.html | 58 ++++--- .../toastergui/templates/projectbuilds.html | 59 +++++++ .../toaster/toastergui/templates/projectconf.html | 62 +++++++ bitbake/lib/toaster/toastergui/urls.py | 2 +- bitbake/lib/toaster/toastergui/views.py | 192 +++++++++++++++++++-- 8 files changed, 564 insertions(+), 38 deletions(-) create mode 100644 bitbake/lib/toaster/toastergui/templates/importlayer.html create mode 100644 bitbake/lib/toaster/toastergui/templates/layerdetails.html create mode 100644 bitbake/lib/toaster/toastergui/templates/projectbuilds.html create mode 100644 bitbake/lib/toaster/toastergui/templates/projectconf.html (limited to 'bitbake/lib') diff --git a/bitbake/lib/toaster/toastergui/templates/importlayer.html b/bitbake/lib/toaster/toastergui/templates/importlayer.html new file mode 100644 index 0000000000..7e48eac66e --- /dev/null +++ b/bitbake/lib/toaster/toastergui/templates/importlayer.html @@ -0,0 +1,68 @@ +{% extends "baseprojectpage.html" %} +{% load projecttags %} +{% load humanize %} + +{% block localbreadcrumb %} +
  • Layers
  • +{% endblock %} + +{% block projectinfomain %} + +
    + {% if project %} + The layer you are importing must be compatible with {{project.release.name}} ({{project.release.description}}), which is the release you are using in this project. + {% endif %} +
    + Layer repository information + + + + + + + + +
    +
    + + Layer dependencies + (optional) + + + + + You can only add layers Toaster knows about +
    +
    + Import and add to project + Just import for the moment + To import a layer, you need to enter a repository URL, a branch, tag or commit and a layer name +
    +
    + +{% endblock %} diff --git a/bitbake/lib/toaster/toastergui/templates/layerdetails.html b/bitbake/lib/toaster/toastergui/templates/layerdetails.html new file mode 100644 index 0000000000..78dc54bfd1 --- /dev/null +++ b/bitbake/lib/toaster/toastergui/templates/layerdetails.html @@ -0,0 +1,159 @@ +{% extends "baseprojectpage.html" %} +{% load projecttags %} +{% load humanize %} + +{% block localbreadcrumb %} +
  • Layer Details
  • +{% endblock %} + +{% block projectinfomain %} + + +
    + +
    +
    +
    +
    + + Repository URL +
    +
    +
    +
    + + + +
    + Cloning this Git repository failed +
    +
    +
    + + Repository subdirectory +
    +
    + {{layerversion.dirpath}} + + + +
    +
    Brach, tag or commit
    +
    + {{layerversion.up_branch.name}} + +
    +
    + + Yocto Project compatibility +
    +
    + +
    +
    + + Layer dependencies +
    +
    + + + You can only add layers Toaster knows about +
    +
    +
    +
    +
    + There is no target data for {{layerversion.layer.name}} ... yet
    + Toaster learns about layers as they are built. Once you have used {{layerversion.layer.name}} in a build, Toaster will show you + here the targets it provides. +
    +
    +
    +
    + There is no machine data for {{layerversion.layer.name}} ... yet
    + Toaster learns about layers as they are built. Once you have used {{layerversion.layer.name}} in a build, Toaster will show you + here the machines it provides. +
    +
    +
    +
    +
    +

    About {{layerversion.layer.name}}

    +
    + +
    + Summary + +
    +
    + {{layerversion.layer.summary}} + +
    + +
    + Description +
    +
    + {{layerversion.layer.description}} + +
    + +
    + Maintainer(s) +
    +
    + Not set + +
    +
    +
    + + +{% endblock %} diff --git a/bitbake/lib/toaster/toastergui/templates/layers.html b/bitbake/lib/toaster/toastergui/templates/layers.html index bc6e5a3073..281b72aec5 100644 --- a/bitbake/lib/toaster/toastergui/templates/layers.html +++ b/bitbake/lib/toaster/toastergui/templates/layers.html @@ -33,7 +33,7 @@ {% include "basetable_top.html" %} {% for lv in objects %} - {{lv.layer.name}} + {{lv.layer.name}} {{lv.layer.summary}} {{lv.layer_source.name}} {{lv.layer.layer_index_url}} diff --git a/bitbake/lib/toaster/toastergui/templates/project.html b/bitbake/lib/toaster/toastergui/templates/project.html index d7bfa2b9de..c3a470c54a 100644 --- a/bitbake/lib/toaster/toastergui/templates/project.html +++ b/bitbake/lib/toaster/toastergui/templates/project.html @@ -110,22 +110,34 @@ $(document).ready(function () {
    - - -
    - - +
    + - - -
    - - @@ -145,11 +157,11 @@ $(document).ready(function () {
    - {{br.0.get_state_display}} + {{br.0.get_state_display}}
    -
    +
    {% if br.state == br.REQ_FAILED%} - {% for bre in br.0.brerror_set.all %} {{bre.errmsg}} ({{bre.errtype}})

    {{bre.traceback}}{%endfor%} + {% for bre in br.0.brerror_set.all %} {{bre.errmsg}} ({{bre.errtype}})

    {{bre.traceback}}{%endfor%} {%endif%}
    @@ -224,14 +236,14 @@ $(document).ready(function () { @@ -278,9 +290,9 @@ $(document).ready(function () { {% if target %}
  • {{target.target}}{% if target.task%} (target.task){%endif%} - {% if target.notprovided %} + {% if target.notprovided %} - {% elif target.notknown %} + {% elif target.notknown %} {% endif %} @@ -347,7 +359,7 @@ $(document).ready(function () {

    Yocto Project version

    - {{project.release}} - {{project.short_description}} + {{project.release.name}} - {{project.release.description}}

  • diff --git a/bitbake/lib/toaster/toastergui/templates/projectbuilds.html b/bitbake/lib/toaster/toastergui/templates/projectbuilds.html new file mode 100644 index 0000000000..8c5942c7cb --- /dev/null +++ b/bitbake/lib/toaster/toastergui/templates/projectbuilds.html @@ -0,0 +1,59 @@ +{% extends "baseprojectpage.html" %} +{% load projecttags %} +{% load humanize %} + +{% block localbreadcrumb %} +
  • Project builds
  • +{% endblock %} + +{% block projectinfomain %} + + + + + + +{% include "basetable_top.html" %} + {% for build in objects %} + + {%if build.outcome == build.SUCCEEDED%}{%elif build.outcome == build.FAILED%}{%else%}{%endif%} + {% for t in build.target_set.all %} {{t.target}}
    {% endfor %} + {{build.machine}} + {{build.started_on|date:"d/m/y H:i"}} + {{build.completed_on|date:"d/m/y H:i"}} + {% query build.task_build outcome=4 order__gt=0 as exectask%}{% if exectask.count == 1 %}{{exectask.0.recipe.name}}.{{exectask.0.task_name}}{% elif exectask.count > 1%}{{exectask.count}}{%endif%} + {% if build.errors_no %}{{build.errors_no}} error{{build.errors_no|pluralize}}{%endif%} + {% if build.warnings_no %}{{build.warnings_no}} warning{{build.warnings_no|pluralize}}{%endif%} + {{build.timespent|sectohms}} + {{build.cooker_log_path}} + + {% if build.outcome == build.SUCCEEDED %} + {{fstypes|get_dict_value:build.id}} + {% endif %} + + + + {% endfor %} +{% include "basetable_bottom.html" %} + + + + +{% endblock %} diff --git a/bitbake/lib/toaster/toastergui/templates/projectconf.html b/bitbake/lib/toaster/toastergui/templates/projectconf.html new file mode 100644 index 0000000000..e8b0c39f25 --- /dev/null +++ b/bitbake/lib/toaster/toastergui/templates/projectconf.html @@ -0,0 +1,62 @@ +{% extends "baseprojectpage.html" %} +{% load projecttags %} +{% load humanize %} + +{% block localbreadcrumb %} +
  • Project configuration
  • +{% endblock %} + +{% block projectinfomain %} + + +
    + +
    + {% for c in configvars %} +
    + {{c.name}} + +
    +
    + {{c.value}} + + +
    + {% endfor %} + + +
    +
    +
    + Add variable + + + + + +
    +
    + + +
    + + +{% endblock %} diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py index 30f006348a..a9c05922c2 100644 --- a/bitbake/lib/toaster/toastergui/urls.py +++ b/bitbake/lib/toaster/toastergui/urls.py @@ -76,7 +76,7 @@ urlpatterns = patterns('toastergui.views', url(r'^project/(?P\d+)/$', 'project', name='project'), url(r'^project/(?P\d+)/configuration$', 'projectconf', name='projectconf'), - url(r'^project/(?P\d+)/builds$', 'projectbuilds', name='projectbuild'), + url(r'^project/(?P\d+)/builds$', 'projectbuilds', name='projectbuilds'), url(r'^xhr_projectbuild/(?P\d+)/$', 'xhr_projectbuild', name='xhr_projectbuild'), url(r'^xhr_projectedit/(?P\d+)/$', 'xhr_projectedit', name='xhr_projectedit'), diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 167b687d03..13788b0d55 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py @@ -903,7 +903,7 @@ def tasks_common(request, build_id, variant, task_anchor): retval = _verify_parameters( request.GET, mandatory_parameters ) if retval: if task_anchor: - mandatory_parameters['anchor']=task_anchor + mandatory_parameters['anchor']=task_anchor return _redirect_parameters( variant, request.GET, mandatory_parameters, build_id = build_id) (filter_string, search_term, ordering_string) = _search_tuple(request, Task) queryset_all = Task.objects.filter(build=build_id).exclude(order__isnull=True).exclude(outcome=Task.OUTCOME_NA) @@ -917,19 +917,19 @@ def tasks_common(request, build_id, variant, task_anchor): else: queryset = _get_queryset(Task, queryset_all, filter_string, search_term, ordering_string, 'order') - # compute the anchor's page + # compute the anchor's page if anchor: - request.GET = request.GET.copy() + request.GET = request.GET.copy() del request.GET['anchor'] i=0 a=int(anchor) - count_per_page=int(request.GET.get('count', 100)) + count_per_page=int(request.GET.get('count', 100)) for task in queryset.iterator(): if a == task.order: - new_page= (i / count_per_page ) + 1 - request.GET.__setitem__('page', new_page) - mandatory_parameters['page']=new_page - return _redirect_parameters( variant, request.GET, mandatory_parameters, build_id = build_id) + new_page= (i / count_per_page ) + 1 + request.GET.__setitem__('page', new_page) + mandatory_parameters['page']=new_page + return _redirect_parameters( variant, request.GET, mandatory_parameters, build_id = build_id) i += 1 tasks = _build_page_range(Paginator(queryset, request.GET.get('count', 100)),request.GET.get('page', 1)) @@ -1917,10 +1917,12 @@ if toastermain.settings.MANAGED: return HttpResponse(json.dumps({"error":str(e) + "\n" + traceback.format_exc()}), content_type = "application/json") def importlayer(request): - raise Exception("TODO: implement page #6595") + template = "importlayer.html" + context = { + } + return render(request, template, context) def layers(request): - # "TODO: implement page #6590" template = "layers.html" # define here what parameters the view needs in the GET portion in order to # be able to display something. 'count' and 'page' are mandatory for all views @@ -2000,7 +2002,11 @@ if toastermain.settings.MANAGED: return render(request, template, context) def layerdetails(request, layerid): - raise Exception("TODO: implement page #6591") + template = "layerdetails.html" + context = { + 'layerversion': Layer_Version.objects.get(pk = layerid), + } + return render(request, template, context) def targets(request): template = "targets.html" @@ -2159,11 +2165,171 @@ if toastermain.settings.MANAGED: return render(request, template, context) def projectconf(request, pid): - raise Exception("TODO: implement page #6588") + template = "projectconf.html" + context = { + 'configvars': ProjectVariable.objects.filter(project_id = pid), + } + return render(request, template, context) def projectbuilds(request, pid): - raise Exception("TODO: implement page #6589") + template = 'projectbuilds.html' + # define here what parameters the view needs in the GET portion in order to + # be able to display something. 'count' and 'page' are mandatory for all views + # that use paginators. + mandatory_parameters = { 'count': 10, 'page' : 1, 'orderby' : 'completed_on:-' }; + retval = _verify_parameters( request.GET, mandatory_parameters ) + # boilerplate code that takes a request for an object type and returns a queryset + # for that object type. copypasta for all needed table searches + (filter_string, search_term, ordering_string) = _search_tuple(request, Build) + queryset_all = Build.objects.all.exclude(outcome = Build.IN_PROGRESS) + queryset_with_search = _get_queryset(Build, queryset_all, None, search_term, ordering_string, '-completed_on') + queryset = _get_queryset(Build, queryset_all, filter_string, search_term, ordering_string, '-completed_on') + + # retrieve the objects that will be displayed in the table; builds a paginator and gets a page range to display + build_info = _build_page_range(Paginator(queryset, request.GET.get('count', 10)),request.GET.get('page', 1)) + + + # set up list of fstypes for each build + fstypes_map = {}; + for build in build_info: + targets = Target.objects.filter( build_id = build.id ) + comma = ""; + extensions = ""; + for t in targets: + if ( not t.is_image ): + continue + tif = Target_Image_File.objects.filter( target_id = t.id ) + for i in tif: + s=re.sub('.*tar.bz2', 'tar.bz2', i.file_name) + if s == i.file_name: + s=re.sub('.*\.', '', i.file_name) + if None == re.search(s,extensions): + extensions += comma + s + comma = ", " + fstypes_map[build.id]=extensions + + # send the data to the template + context = { + 'objects' : build_info, + 'objectname' : "builds", + 'default_orderby' : 'completed_on:-', + 'fstypes' : fstypes_map, + 'search_term' : search_term, + 'total_count' : queryset_with_search.count(), + # Specifies the display of columns for the table, appearance in "Edit columns" box, toggling default show/hide, and specifying filters for columns + 'tablecols' : [ + {'name': 'Outcome', # column with a single filter + 'qhelp' : "The outcome tells you if a build successfully completed or failed", # the help button content + 'dclass' : "span2", # indication about column width; comes from the design + 'orderfield': _get_toggle_order(request, "outcome"), # adds ordering by the field value; default ascending unless clicked from ascending into descending + 'ordericon':_get_toggle_order_icon(request, "outcome"), + # filter field will set a filter on that column with the specs in the filter description + # the class field in the filter has no relation with clclass; the control different aspects of the UI + # still, it is recommended for the values to be identical for easy tracking in the generated HTML + 'filter' : {'class' : 'outcome', + 'label': 'Show:', + 'options' : [ + ('Successful builds', 'outcome:' + str(Build.SUCCEEDED), queryset_with_search.filter(outcome=str(Build.SUCCEEDED)).count()), # this is the field search expression + ('Failed builds', 'outcome:'+ str(Build.FAILED), queryset_with_search.filter(outcome=str(Build.FAILED)).count()), + ] + } + }, + {'name': 'Target', # default column, disabled box, with just the name in the list + 'qhelp': "This is the build target or build targets (i.e. one or more recipes or image recipes)", + 'orderfield': _get_toggle_order(request, "target__target"), + 'ordericon':_get_toggle_order_icon(request, "target__target"), + }, + {'name': 'Machine', + 'qhelp': "The machine is the hardware for which you are building a recipe or image recipe", + 'orderfield': _get_toggle_order(request, "machine"), + 'ordericon':_get_toggle_order_icon(request, "machine"), + 'dclass': 'span3' + }, # a slightly wider column + {'name': 'Started on', 'clclass': 'started_on', 'hidden' : 1, # this is an unchecked box, which hides the column + 'qhelp': "The date and time you started the build", + 'orderfield': _get_toggle_order(request, "started_on", True), + 'ordericon':_get_toggle_order_icon(request, "started_on"), + 'filter' : {'class' : 'started_on', + 'label': 'Show:', + 'options' : [ + ("Today's builds" , 'started_on__gte:'+timezone.now().strftime("%Y-%m-%d"), queryset_with_search.filter(started_on__gte=timezone.now()).count()), + ("Yesterday's builds", 'started_on__gte:'+(timezone.now()-timedelta(hours=24)).strftime("%Y-%m-%d"), queryset_with_search.filter(started_on__gte=(timezone.now()-timedelta(hours=24))).count()), + ("This week's builds", 'started_on__gte:'+(timezone.now()-timedelta(days=7)).strftime("%Y-%m-%d"), queryset_with_search.filter(started_on__gte=(timezone.now()-timedelta(days=7))).count()), + ] + } + }, + {'name': 'Completed on', + 'qhelp': "The date and time the build finished", + 'orderfield': _get_toggle_order(request, "completed_on", True), + 'ordericon':_get_toggle_order_icon(request, "completed_on"), + 'orderkey' : 'completed_on', + 'filter' : {'class' : 'completed_on', + 'label': 'Show:', + 'options' : [ + ("Today's builds", 'completed_on__gte:'+timezone.now().strftime("%Y-%m-%d"), queryset_with_search.filter(completed_on__gte=timezone.now()).count()), + ("Yesterday's builds", 'completed_on__gte:'+(timezone.now()-timedelta(hours=24)).strftime("%Y-%m-%d"), queryset_with_search.filter(completed_on__gte=(timezone.now()-timedelta(hours=24))).count()), + ("This week's builds", 'completed_on__gte:'+(timezone.now()-timedelta(days=7)).strftime("%Y-%m-%d"), queryset_with_search.filter(completed_on__gte=(timezone.now()-timedelta(days=7))).count()), + ] + } + }, + {'name': 'Failed tasks', 'clclass': 'failed_tasks', # specifing a clclass will enable the checkbox + 'qhelp': "How many tasks failed during the build", + 'filter' : {'class' : 'failed_tasks', + 'label': 'Show:', + 'options' : [ + ('Builds with failed tasks', 'task_build__outcome:4', queryset_with_search.filter(task_build__outcome=4).count()), + ('Builds without failed tasks', 'task_build__outcome:NOT4', queryset_with_search.filter(~Q(task_build__outcome=4)).count()), + ] + } + }, + {'name': 'Errors', 'clclass': 'errors_no', + 'qhelp': "How many errors were encountered during the build (if any)", + 'orderfield': _get_toggle_order(request, "errors_no", True), + 'ordericon':_get_toggle_order_icon(request, "errors_no"), + 'orderkey' : 'errors_no', + 'filter' : {'class' : 'errors_no', + 'label': 'Show:', + 'options' : [ + ('Builds with errors', 'errors_no__gte:1', queryset_with_search.filter(errors_no__gte=1).count()), + ('Builds without errors', 'errors_no:0', queryset_with_search.filter(errors_no=0).count()), + ] + } + }, + {'name': 'Warnings', 'clclass': 'warnings_no', + 'qhelp': "How many warnings were encountered during the build (if any)", + 'orderfield': _get_toggle_order(request, "warnings_no", True), + 'ordericon':_get_toggle_order_icon(request, "warnings_no"), + 'orderkey' : 'warnings_no', + 'filter' : {'class' : 'warnings_no', + 'label': 'Show:', + 'options' : [ + ('Builds with warnings','warnings_no__gte:1', queryset_with_search.filter(warnings_no__gte=1).count()), + ('Builds without warnings','warnings_no:0', queryset_with_search.filter(warnings_no=0).count()), + ] + } + }, + {'name': 'Time', 'clclass': 'time', 'hidden' : 1, + 'qhelp': "How long it took the build to finish", + 'orderfield': _get_toggle_order(request, "timespent", True), + 'ordericon':_get_toggle_order_icon(request, "timespent"), + 'orderkey' : 'timespent', + }, + {'name': 'Log', + 'dclass': "span4", + 'qhelp': "Path to the build main log file", + 'clclass': 'log', 'hidden': 1, + 'orderfield': _get_toggle_order(request, "cooker_log_path"), + 'ordericon':_get_toggle_order_icon(request, "cooker_log_path"), + 'orderkey' : 'cooker_log_path', + }, + {'name': 'Output', 'clclass': 'output', + 'qhelp': "The root file system types produced by the build. You can find them in your /build/tmp/deploy/images/ directory", + }, + ] + } + + return render(request, template, context) else: # these are pages that are NOT available in interactive mode def managedcontextprocessor(request): -- cgit v1.2.3-54-g00ecf