diff options
| author | Michael Wood <michael.g.wood@intel.com> | 2016-09-26 13:59:33 +0300 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-09-30 16:52:22 +0100 |
| commit | 44058c45eea28f8f5bc7a787f899671ee603c3b8 (patch) | |
| tree | 16dd5d0b11c738f728e75b6af650f53747d83cdb /bitbake/lib/toaster/toastergui | |
| parent | d209f8b7afc1e6847ac68e23a1389230fdd6768d (diff) | |
| download | poky-44058c45eea28f8f5bc7a787f899671ee603c3b8.tar.gz | |
bitbake: toaster: Add backend API for deleting a build
(Bitbake rev: cdc380c188fd17e55d1d270e5b468d931aa436b2)
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui')
| -rw-r--r-- | bitbake/lib/toaster/toastergui/api.py | 30 | ||||
| -rw-r--r-- | bitbake/lib/toaster/toastergui/urls.py | 4 |
2 files changed, 34 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/api.py b/bitbake/lib/toaster/toastergui/api.py index 856918b6a3..149abf7a5b 100644 --- a/bitbake/lib/toaster/toastergui/api.py +++ b/bitbake/lib/toaster/toastergui/api.py | |||
| @@ -832,3 +832,33 @@ class XhrProject(View): | |||
| 832 | "error": "ok", | 832 | "error": "ok", |
| 833 | "gotoUrl": reverse("all-projects", args=[]) | 833 | "gotoUrl": reverse("all-projects", args=[]) |
| 834 | }) | 834 | }) |
| 835 | |||
| 836 | |||
| 837 | class XhrBuild(View): | ||
| 838 | """ Delete a build object | ||
| 839 | |||
| 840 | Entry point: /xhr_build/<build_id> | ||
| 841 | """ | ||
| 842 | def delete(self, request, *args, **kwargs): | ||
| 843 | """ | ||
| 844 | Delete build data | ||
| 845 | |||
| 846 | Args: | ||
| 847 | build_id = build_id | ||
| 848 | |||
| 849 | Returns: | ||
| 850 | {"error": "ok"} | ||
| 851 | or | ||
| 852 | {"error": <error message>} | ||
| 853 | """ | ||
| 854 | try: | ||
| 855 | build = Build.objects.get(pk=kwargs['build_id']) | ||
| 856 | project = build.project | ||
| 857 | build.delete() | ||
| 858 | except Build.DoesNotExist: | ||
| 859 | return error_response("Build %s does not exist" % | ||
| 860 | kwargs['build_id']) | ||
| 861 | return JsonResponse({ | ||
| 862 | "error": "ok", | ||
| 863 | "gotoUrl": reverse("projectbuilds", args=(project.pk,)) | ||
| 864 | }) | ||
diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py index 0002a5a2ee..ece9ac1696 100644 --- a/bitbake/lib/toaster/toastergui/urls.py +++ b/bitbake/lib/toaster/toastergui/urls.py | |||
| @@ -225,6 +225,10 @@ urlpatterns = patterns('toastergui.views', | |||
| 225 | api.XhrProject.as_view(), | 225 | api.XhrProject.as_view(), |
| 226 | name='xhr_project'), | 226 | name='xhr_project'), |
| 227 | 227 | ||
| 228 | url(r'xhr_build/(?P<build_id>\d+)$', | ||
| 229 | api.XhrBuild.as_view(), | ||
| 230 | name='xhr_build'), | ||
| 231 | |||
| 228 | url(r'^mostrecentbuilds$', widgets.MostRecentBuildsView.as_view(), | 232 | url(r'^mostrecentbuilds$', widgets.MostRecentBuildsView.as_view(), |
| 229 | name='most_recent_builds'), | 233 | name='most_recent_builds'), |
| 230 | 234 | ||
