summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/tables.py
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2016-04-06 17:46:30 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-04-06 23:10:29 +0100
commiteead032aca1592de9a764b530f9c436ff57cee21 (patch)
treecc6f60e468aaa758555f203cac598dacc9b271ca /bitbake/lib/toaster/toastergui/tables.py
parentf5aa97067f0955b6be5e69b5859d1f3c5624c2da (diff)
downloadpoky-eead032aca1592de9a764b530f9c436ff57cee21.tar.gz
bitbake: toaster: Move xhr calls for starting and stopping builds
Move the backend xhr implementation of the build request changes into it's own file and out of the ToasterTable definition. It used to live in the views.py but in a hope of starting to collate logical groups of views move this to a new file called api. (Bitbake rev: 29572f0e6bd3b5e8315f3b93d55bdb8967b86bc3) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/tables.py')
-rw-r--r--bitbake/lib/toaster/toastergui/tables.py43
1 files changed, 1 insertions, 42 deletions
diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py
index 67a659222f..822c7e586c 100644
--- a/bitbake/lib/toaster/toastergui/tables.py
+++ b/bitbake/lib/toaster/toastergui/tables.py
@@ -22,7 +22,7 @@
22from toastergui.widgets import ToasterTable 22from toastergui.widgets import ToasterTable
23from orm.models import Recipe, ProjectLayer, Layer_Version, Machine, Project 23from orm.models import Recipe, ProjectLayer, Layer_Version, Machine, Project
24from orm.models import CustomImageRecipe, Package, Target, Build, LogMessage, Task 24from orm.models import CustomImageRecipe, Package, Target, Build, LogMessage, Task
25from orm.models import CustomImagePackage, ProjectTarget 25from orm.models import CustomImagePackage
26from django.db.models import Q, Max, Sum, Count, When, Case, Value, IntegerField 26from django.db.models import Q, Max, Sum, Count, When, Case, Value, IntegerField
27from django.conf.urls import url 27from django.conf.urls import url
28from django.core.urlresolvers import reverse, resolve 28from django.core.urlresolvers import reverse, resolve
@@ -1400,47 +1400,6 @@ class BuildsTable(ToasterTable):
1400 failed_tasks_filter.add_action(without_failed_tasks_action) 1400 failed_tasks_filter.add_action(without_failed_tasks_action)
1401 self.add_filter(failed_tasks_filter) 1401 self.add_filter(failed_tasks_filter)
1402 1402
1403 def post(self, request, *args, **kwargs):
1404 """ Process HTTP POSTs which make build requests """
1405
1406 project = Project.objects.get(pk=kwargs['pid'])
1407
1408 if 'buildCancel' in request.POST:
1409 for i in request.POST['buildCancel'].strip().split(" "):
1410 try:
1411 br = BuildRequest.objects.select_for_update().get(project = project, pk = i, state__lte = BuildRequest.REQ_QUEUED)
1412 br.state = BuildRequest.REQ_DELETED
1413 br.save()
1414 except BuildRequest.DoesNotExist:
1415 pass
1416
1417 if 'buildDelete' in request.POST:
1418 for i in request.POST['buildDelete'].strip().split(" "):
1419 try:
1420 BuildRequest.objects.select_for_update().get(project = project, pk = i, state__lte = BuildRequest.REQ_DELETED).delete()
1421 except BuildRequest.DoesNotExist:
1422 pass
1423
1424 if 'targets' in request.POST:
1425 ProjectTarget.objects.filter(project = project).delete()
1426 s = str(request.POST['targets'])
1427 for t in s.translate(None, ";%|\"").split(" "):
1428 if ":" in t:
1429 target, task = t.split(":")
1430 else:
1431 target = t
1432 task = ""
1433 ProjectTarget.objects.create(project = project,
1434 target = target,
1435 task = task)
1436 project.schedule_build()
1437
1438 # redirect back to builds page so any new builds in progress etc.
1439 # are visible
1440 response = HttpResponse()
1441 response.status_code = 302
1442 response['Location'] = request.build_absolute_uri()
1443 return response
1444 1403
1445class AllBuildsTable(BuildsTable): 1404class AllBuildsTable(BuildsTable):
1446 """ Builds page for all builds """ 1405 """ Builds page for all builds """