From 160563532f87bd901e1cc6972fe238be87a8b63c Mon Sep 17 00:00:00 2001 From: Alexandru DAMIAN Date: Thu, 11 Jun 2015 15:00:08 +0100 Subject: [PATCH] bitbake: toaster: refactor the builds pages Taking out the managed mode-specific bits in build-related pages, as there is always only one mode available. Also refactors the build pages in order to always display Build objects instead of BuildRequest objects. (Bitbake rev: 6e46e1e3882b9770872d8a0bb459bc7d5d6bfed3) Signed-off-by: Alexandru DAMIAN Signed-off-by: Richard Purdie --- .../toastergui/static/js/projectapp.js | 14 +- .../templates/{build.html => builds.html} | 7 +- .../toastergui/templates/managed_builds.html | 167 ------- .../templates/managed_mrb_section.html | 193 -------- .../toastergui/templates/mrb_section.html | 41 +- .../toaster/toastergui/templates/project.html | 40 +- .../toastergui/templates/projectbuilds.html | 1 - .../toastergui/templates/projects.html | 22 +- bitbake/lib/toaster/toastergui/urls.py | 2 +- bitbake/lib/toaster/toastergui/views.py | 437 +++++------------- 10 files changed, 175 insertions(+), 749 deletions(-) rename bitbake/lib/toaster/toastergui/templates/{build.html => builds.html} (97%) delete mode 100644 bitbake/lib/toaster/toastergui/templates/managed_builds.html delete mode 100644 bitbake/lib/toaster/toastergui/templates/managed_mrb_section.html diff --git a/bitbake/lib/toaster/toastergui/static/js/projectapp.js b/bitbake/lib/toaster/toastergui/static/js/projectapp.js index b2e65c5bb5..40e2e1fffa 100644 --- a/bitbake/lib/toaster/toastergui/static/js/projectapp.js +++ b/bitbake/lib/toaster/toastergui/static/js/projectapp.js @@ -429,13 +429,17 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc */ $scope.validateData = function () { - if ($scope.layers.length === 0) { + if ($scope.project.release) { + if ($scope.layers.length === 0) { $scope.layeralert = $scope.displayAlert($scope.zone1alerts, "You need to add some layers to this project. View all layers available in Toaster or import a layer"); - } else { - if ($scope.layeralert !== undefined) { - $scope.layeralert.close(); - $scope.layeralert = undefined; + } else { + if ($scope.layeralert !== undefined) { + $scope.layeralert.close(); + $scope.layeralert = undefined; + } } + } else { + $scope.layeralert = $scope.displayAlert($scope.zone1alerts, "This project is not set to run builds."); } }; diff --git a/bitbake/lib/toaster/toastergui/templates/build.html b/bitbake/lib/toaster/toastergui/templates/builds.html similarity index 97% rename from bitbake/lib/toaster/toastergui/templates/build.html rename to bitbake/lib/toaster/toastergui/templates/builds.html index f0b5ea529f..e9211affcd 100644 --- a/bitbake/lib/toaster/toastergui/templates/build.html +++ b/bitbake/lib/toaster/toastergui/templates/builds.html @@ -14,13 +14,15 @@ {% block pagecontent %} +{% if last_date_from and last_date_to %} +{%endif%} {# last_date_from and last_date_to #}
@@ -87,9 +89,8 @@ {{fstypes|get_dict_value:build.id}} {% endif %} - {% if build.project %} + {{build.project.name}} - {% endif %} diff --git a/bitbake/lib/toaster/toastergui/templates/managed_builds.html b/bitbake/lib/toaster/toastergui/templates/managed_builds.html deleted file mode 100644 index 63ae5408f5..0000000000 --- a/bitbake/lib/toaster/toastergui/templates/managed_builds.html +++ /dev/null @@ -1,167 +0,0 @@ -{% extends "base.html" %} - -{% load static %} -{% load projecttags %} -{% load humanize %} - -{% block extraheadcontent %} - - - - - -{% endblock %} - -{% block pagecontent %} - - - -
- - {% include "managed_mrb_section.html" %} - - - {% if 1 %} - - - {% if objects.paginator.count == 0 %} -
- {% if request.GET.filter or request.GET.search %} -
-
- {% if request.GET.search %}{% endif %} - - -
-
- {% else %} -
-

Toaster has not recorded any builds yet. To run a build, select the project for which you want to build. -

- {% endif %} -
- - - {% else %} {# We have builds to display #} - {% include "basetable_top_buildprojects.html" %} - - {% for buildrequest in objects %}{% if buildrequest.build %} {% with build=buildrequest.build %} {# if we have a build, just display it #} - - {%if build.outcome == build.SUCCEEDED%}{%elif build.outcome == build.FAILED%}{%else%}{%endif%} - {% if build.project %} -   - - - {% endif %} - - - {% for t in build.target_set.all %} {{t.target}}
{% endfor %} - {{build.machine}} - {% if MANAGED %} - - {% if build.project %} - {{build.project.name}} - {% endif %} - - {% endif %} - {{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}} - {% if MANAGED and build.project %} - - - - {% endif %} - {% elif exectask.count > 1%} - {{exectask.count}} task{{exectask.count|pluralize}} - {%endif%} - - - {% if build.errors_no %} - {{build.errors_no}} error{{build.errors_no|pluralize}} - {% if MANAGED and build.project and build.buildartifact_set.count %} - - - - {% endif %} - {%endif%} - - {% if build.warnings_no %}{{build.warnings_no}} warning{{build.warnings_no|pluralize}}{%endif%} - {{build.timespent|sectohms}} - {% if not MANAGED or not build.project %} - {{build.cooker_log_path}} - {% endif %} - - {% if build.outcome == build.SUCCEEDED %} - {{fstypes|get_dict_value:build.id}} - {% endif %} - - - - - {%endwith%} - {% else %} {# we don't have a build for this build request, mask the data with build request data #} - - - - - {% if buildrequest.state == buildrequest.REQ_FAILED %}{%else%}FIXME_build_request_state{%endif%} - - 1%}title="Targets: {%for target in buildrequest.brtarget_set.all%}{{target.target}} {%endfor%}"{%endif%}>{{buildrequest.brtarget_set.all.0.target}} {%if buildrequest.brtarget_set.all.count > 1%}(+ {{buildrequest.brtarget_set.all.count|add:"-1"}}){%endif%} - - - {{buildrequest.machine}} - - {% if MANAGED %} - - {{buildrequest.project.name}} - - {% endif %} - - {{buildrequest.created|date:"d/m/y H:i"}} - - - {{buildrequest.updated|date:"d/m/y H:i"}} - - - - - {{buildrequest.brerror_set.all.count}} error{{buildrequest.brerror_set.all.count|pluralize}} - - - - - {{br.timespent.total_seconds|sectohms}} - - {# we have no output here #} - - - {%endif%} - {% endfor %} - - - {% include "basetable_bottom.html" %} - {% endif %} {# objects.paginator.count #} -{% endif %} {# empty #} -
- -{% endblock %} diff --git a/bitbake/lib/toaster/toastergui/templates/managed_mrb_section.html b/bitbake/lib/toaster/toastergui/templates/managed_mrb_section.html deleted file mode 100644 index 47e64eaaab..0000000000 --- a/bitbake/lib/toaster/toastergui/templates/managed_mrb_section.html +++ /dev/null @@ -1,193 +0,0 @@ -{% load static %} -{% load projecttags %} -{% load humanize %} - -{%if mru|length > 0%} -{# Template provides the latest builds section requires mru in the context which can be added from _managed_get_latest_builds #} - -
- {% for buildrequest in mru %}{% with build=buildrequest.build %} - - {% if build %} {# if we have a build, just display it #} - -
- {% if MANAGED and build.project %} - - {{build.project.name}} - - {% endif %} - -
-
- {%if build.outcome == build.SUCCEEDED or build.outcome == build.FAILED %} - - {% endif %} - {% include "brtargets.html" %} - {%if build.outcome == build.SUCCEEDED or build.outcome == build.FAILED %} - - {% endif %} -
- {%if build.outcome == build.SUCCEEDED or build.outcome == build.FAILED %} -
- {% if build.completed_on|format_build_date %} - {{ build.completed_on|date:'d/m/y H:i' }} - {% else %} - {{ build.completed_on|date:'H:i' }} - {% 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 time: {{ build.timespent|sectohms }} - - {% if build.project %} -
- {%endif%} - {%if build.outcome == build.IN_PROGRESS %} -
-
-
-
-
-
{{build.completeper}}% tasks completed
- {%endif%} -
-
- - {% else %} {# we use the project's page recent build design #} - - - - -
- - {{buildrequest.project.name}} - -
- - {% if buildrequest.state == buildrequest.REQ_FAILED %} - -
- {% if buildrequest.updated|format_build_date %} - {{ buildrequest.updated|date:'d/m/y H:i' }} - {% else %} - {{ buildrequest.updated|date:'H:i' }} - {% endif %} -
-
- {% if buildrequest.brerror_set.all.count %} - {{buildrequest.brerror_set.all.count}} error{{buildrequest.brerror_set.all.count|pluralize}} - {% endif %} -
-
{# there are no warnings for buildrequests #} -
-
- - Build time: {{ buildrequest.get_duration|sectohms }} - - -
- - - {% elif buildrequest.state == buildrequest.REQ_QUEUED %} - -
- {% include "brtargets.html" %} -
-
Build queued - -
- - - {% elif buildrequest.state == buildrequest.REQ_CREATED %} - -
- {% include "brtargets.html" %} -
-
- Creating build -
- - {% elif buildrequest.state == buildrequest.REQ_INPROGRESS %} - -
- {% include "brtargets.html" %} -
-
- Checking out layers -
- {% else %} - -
FIXME!
- - {% endif %} -
-
-
-
- - - - {% endif %} {# this ends the build request most recent build section #} - -{%endwith%}{% endfor %} -
- - - -{%endif%} - diff --git a/bitbake/lib/toaster/toastergui/templates/mrb_section.html b/bitbake/lib/toaster/toastergui/templates/mrb_section.html index c7bddf0372..7e84e4134d 100644 --- a/bitbake/lib/toaster/toastergui/templates/mrb_section.html +++ b/bitbake/lib/toaster/toastergui/templates/mrb_section.html @@ -12,18 +12,24 @@
{% for build in mru %} -
- {% if MANAGED and build.project %} +
{{build.project.name}} - {% endif %}
+ + + {%endif%} diff --git a/bitbake/lib/toaster/toastergui/templates/project.html b/bitbake/lib/toaster/toastergui/templates/project.html index bca703a162..0f6a77b63c 100644 --- a/bitbake/lib/toaster/toastergui/templates/project.html +++ b/bitbake/lib/toaster/toastergui/templates/project.html @@ -124,7 +124,7 @@ vim: expandtab tabstop=2
- + @@ -145,11 +145,11 @@ vim: expandtab tabstop=2

Latest builds

-
+
- + - -
-
Build queued - -
- -
- -
-
- Creating build -
- -
- - -
-
- Build cancelled -
- -
- - - +
@@ -227,7 +203,7 @@ vim: expandtab tabstop=2
- +
@@ -293,7 +269,7 @@ vim: expandtab tabstop=2 Layers ({[layers.length]}) -
+
You need to add some layers

You can: @@ -307,7 +283,7 @@ vim: expandtab tabstop=2

- +
{% csrf_token %} @@ -334,7 +310,7 @@ vim: expandtab tabstop=2
- +
diff --git a/bitbake/lib/toaster/toastergui/templates/projectbuilds.html b/bitbake/lib/toaster/toastergui/templates/projectbuilds.html index 18b24955d0..896c3b5af7 100644 --- a/bitbake/lib/toaster/toastergui/templates/projectbuilds.html +++ b/bitbake/lib/toaster/toastergui/templates/projectbuilds.html @@ -105,7 +105,6 @@ - {%endwith%} {% else %} {# we don't have a build for this build request, mask the data with build request data #} diff --git a/bitbake/lib/toaster/toastergui/templates/projects.html b/bitbake/lib/toaster/toastergui/templates/projects.html index 23340083ca..9c4346c45a 100644 --- a/bitbake/lib/toaster/toastergui/templates/projects.html +++ b/bitbake/lib/toaster/toastergui/templates/projects.html @@ -7,7 +7,7 @@ {% block pagecontent %} - {% include "managed_mrb_section.html" %} + {% include "mrb_section.html" %}