aboutsummaryrefslogtreecommitdiffstats
path: root/lib/toaster/bldcontrol
diff options
context:
space:
mode:
authorElliot Smith <elliot.smith@intel.com>2016-06-29 15:41:56 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-11 00:08:17 +0100
commitc868ea036aa34b387a72ec5116a66b2cd863995b (patch)
tree31112a655b2a94f8ddea9c9373b22e93f5bd96f2 /lib/toaster/bldcontrol
parentac02fda870965bf7d44ff5688eda54d2d11ab9c7 (diff)
downloadbitbake-contrib-c868ea036aa34b387a72ec5116a66b2cd863995b.tar.gz
toaster: move most recent builds templating to client
The most recent builds area of the all builds and project builds table needs to update as a build progresses. It also needs additional functionality to show other states (e.g. recipe parsing, queued) which again needs to update on the client side. Rather than add to the existing mix of server-side templating with client-side DOM updating, translate all of the server-side templates to client-side ones (jsrender), and add logic which updates the most recent builds area as the state of a build changes. Add a JSON API for mostrecentbuilds, which returns the state of all "recent" builds. Fetch this via Ajax from the build dashboard (rather than fetching the ad hoc API as in the previous version). Then, as new states for builds are fetched via Ajax, determine whether the build state has changed completely, or whether the progress has just updated. If the state completely changed, re-render the template on the client side for that build. If only the progress changed, just update the progress bar. (NB this fixes the task progress bar so it works for the project builds and all builds pages.) In cases where the builds table needs to update as the result of a build finishing, reload the whole page. This work highlighted a variety of other issues, such as build requests not being able to change state as necessary. This was one part of the cause of the "cancelling build..." state being fragile and disappearing entirely when the page refreshed. The cancelling state now persists between page reloads, as the logic for determining whether a build is cancelling is now on the Build object itself. Note that jsrender is redistributed as part of Toaster, so a note was added to LICENSE to that effect. [YOCTO #9631] Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Diffstat (limited to 'lib/toaster/bldcontrol')
-rw-r--r--lib/toaster/bldcontrol/migrations/0005_reorder_buildrequest_states.py19
-rw-r--r--lib/toaster/bldcontrol/models.py12
2 files changed, 25 insertions, 6 deletions
diff --git a/lib/toaster/bldcontrol/migrations/0005_reorder_buildrequest_states.py b/lib/toaster/bldcontrol/migrations/0005_reorder_buildrequest_states.py
new file mode 100644
index 000000000..4bb951776
--- /dev/null
+++ b/lib/toaster/bldcontrol/migrations/0005_reorder_buildrequest_states.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('bldcontrol', '0004_auto_20160523_1446'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='buildrequest',
+ name='state',
+ field=models.IntegerField(choices=[(0, 'created'), (1, 'queued'), (2, 'in progress'), (3, 'failed'), (4, 'deleted'), (5, 'cancelling'), (6, 'completed'), (7, 'archive')], default=0),
+ ),
+ ]
diff --git a/lib/toaster/bldcontrol/models.py b/lib/toaster/bldcontrol/models.py
index f06c562a3..f05548068 100644
--- a/lib/toaster/bldcontrol/models.py
+++ b/lib/toaster/bldcontrol/models.py
@@ -63,20 +63,20 @@ class BuildRequest(models.Model):
REQ_CREATED = 0
REQ_QUEUED = 1
REQ_INPROGRESS = 2
- REQ_COMPLETED = 3
- REQ_FAILED = 4
- REQ_DELETED = 5
- REQ_CANCELLING = 6
+ REQ_FAILED = 3
+ REQ_DELETED = 4
+ REQ_CANCELLING = 5
+ REQ_COMPLETED = 6
REQ_ARCHIVE = 7
REQUEST_STATE = (
(REQ_CREATED, "created"),
(REQ_QUEUED, "queued"),
(REQ_INPROGRESS, "in progress"),
- (REQ_COMPLETED, "completed"),
(REQ_FAILED, "failed"),
(REQ_DELETED, "deleted"),
(REQ_CANCELLING, "cancelling"),
+ (REQ_COMPLETED, "completed"),
(REQ_ARCHIVE, "archive"),
)
@@ -91,7 +91,7 @@ class BuildRequest(models.Model):
def __init__(self, *args, **kwargs):
super(BuildRequest, self).__init__(*args, **kwargs)
- # Save the old state incase it's about to be modified
+ # Save the old state in case it's about to be modified
self.old_state = self.state
def save(self, *args, **kwargs):