summaryrefslogtreecommitdiffstats
path: root/bitbake/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:09:26 +0100
commit952ffb3e1f4a00793e0c9c49bc0c8fb8729424c4 (patch)
tree604083d9477c9d3d2f51c714fe3b74ac8196f26c /bitbake/lib/toaster/bldcontrol
parentc471740f5ba023dccc992438c75f1534950d26af (diff)
downloadpoky-952ffb3e1f4a00793e0c9c49bc0c8fb8729424c4.tar.gz
bitbake: 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] (Bitbake rev: c868ea036aa34b387a72ec5116a66b2cd863995b) Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/bldcontrol')
-rw-r--r--bitbake/lib/toaster/bldcontrol/migrations/0005_reorder_buildrequest_states.py19
-rw-r--r--bitbake/lib/toaster/bldcontrol/models.py12
2 files changed, 25 insertions, 6 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/migrations/0005_reorder_buildrequest_states.py b/bitbake/lib/toaster/bldcontrol/migrations/0005_reorder_buildrequest_states.py
new file mode 100644
index 0000000000..4bb9517768
--- /dev/null
+++ b/bitbake/lib/toaster/bldcontrol/migrations/0005_reorder_buildrequest_states.py
@@ -0,0 +1,19 @@
1# -*- coding: utf-8 -*-
2from __future__ import unicode_literals
3
4from django.db import migrations, models
5
6
7class Migration(migrations.Migration):
8
9 dependencies = [
10 ('bldcontrol', '0004_auto_20160523_1446'),
11 ]
12
13 operations = [
14 migrations.AlterField(
15 model_name='buildrequest',
16 name='state',
17 field=models.IntegerField(choices=[(0, 'created'), (1, 'queued'), (2, 'in progress'), (3, 'failed'), (4, 'deleted'), (5, 'cancelling'), (6, 'completed'), (7, 'archive')], default=0),
18 ),
19 ]
diff --git a/bitbake/lib/toaster/bldcontrol/models.py b/bitbake/lib/toaster/bldcontrol/models.py
index f06c562a38..f055480686 100644
--- a/bitbake/lib/toaster/bldcontrol/models.py
+++ b/bitbake/lib/toaster/bldcontrol/models.py
@@ -63,20 +63,20 @@ class BuildRequest(models.Model):
63 REQ_CREATED = 0 63 REQ_CREATED = 0
64 REQ_QUEUED = 1 64 REQ_QUEUED = 1
65 REQ_INPROGRESS = 2 65 REQ_INPROGRESS = 2
66 REQ_COMPLETED = 3 66 REQ_FAILED = 3
67 REQ_FAILED = 4 67 REQ_DELETED = 4
68 REQ_DELETED = 5 68 REQ_CANCELLING = 5
69 REQ_CANCELLING = 6 69 REQ_COMPLETED = 6
70 REQ_ARCHIVE = 7 70 REQ_ARCHIVE = 7
71 71
72 REQUEST_STATE = ( 72 REQUEST_STATE = (
73 (REQ_CREATED, "created"), 73 (REQ_CREATED, "created"),
74 (REQ_QUEUED, "queued"), 74 (REQ_QUEUED, "queued"),
75 (REQ_INPROGRESS, "in progress"), 75 (REQ_INPROGRESS, "in progress"),
76 (REQ_COMPLETED, "completed"),
77 (REQ_FAILED, "failed"), 76 (REQ_FAILED, "failed"),
78 (REQ_DELETED, "deleted"), 77 (REQ_DELETED, "deleted"),
79 (REQ_CANCELLING, "cancelling"), 78 (REQ_CANCELLING, "cancelling"),
79 (REQ_COMPLETED, "completed"),
80 (REQ_ARCHIVE, "archive"), 80 (REQ_ARCHIVE, "archive"),
81 ) 81 )
82 82
@@ -91,7 +91,7 @@ class BuildRequest(models.Model):
91 91
92 def __init__(self, *args, **kwargs): 92 def __init__(self, *args, **kwargs):
93 super(BuildRequest, self).__init__(*args, **kwargs) 93 super(BuildRequest, self).__init__(*args, **kwargs)
94 # Save the old state incase it's about to be modified 94 # Save the old state in case it's about to be modified
95 self.old_state = self.state 95 self.old_state = self.state
96 96
97 def save(self, *args, **kwargs): 97 def save(self, *args, **kwargs):