summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/views.py
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2016-07-06 18:22:36 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-08 09:57:28 +0100
commit36dec688c7e50e02e55c070f04c396e2d1aa3ef3 (patch)
tree6072b631d8a122f2364cb896a268e93d0fc680b2 /bitbake/lib/toaster/toastergui/views.py
parent903c3c2ef8e31aad287d914dbb18a926cb96e6d0 (diff)
downloadpoky-36dec688c7e50e02e55c070f04c396e2d1aa3ef3.tar.gz
bitbake: toaster: layerdetails api Fix saving of git revision of a layer
Update, clean up and move the api for updating a layerversion from the views to api. Also update the layerdetails page to include the layerversion id in the url getter. [YOCTO #8952] (Bitbake rev: 20f4e23bc86290f0a42881a7cac44c41eafa86fc) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/views.py')
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py43
1 files changed, 0 insertions, 43 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 2db68bdd4d..ad85fafb4d 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -1739,49 +1739,6 @@ if True:
1739 1739
1740 return HttpResponse(jsonfilter(json_response), content_type = "application/json") 1740 return HttpResponse(jsonfilter(json_response), content_type = "application/json")
1741 1741
1742 def xhr_updatelayer(request):
1743
1744 def error_response(error):
1745 return HttpResponse(jsonfilter({"error": error}), content_type = "application/json")
1746
1747 if "layer_version_id" not in request.POST:
1748 return error_response("Please specify a layer version id")
1749 try:
1750 layer_version_id = request.POST["layer_version_id"]
1751 layer_version = Layer_Version.objects.get(id=layer_version_id)
1752 except Layer_Version.DoesNotExist:
1753 return error_response("Cannot find layer to update")
1754
1755
1756 if "vcs_url" in request.POST:
1757 layer_version.layer.vcs_url = request.POST["vcs_url"]
1758 if "dirpath" in request.POST:
1759 layer_version.dirpath = request.POST["dirpath"]
1760 if "commit" in request.POST:
1761 layer_version.commit = request.POST["commit"]
1762 if "up_branch" in request.POST:
1763 layer_version.up_branch_id = int(request.POST["up_branch"])
1764
1765 if "add_dep" in request.POST:
1766 lvd = LayerVersionDependency(layer_version=layer_version, depends_on_id=request.POST["add_dep"])
1767 lvd.save()
1768
1769 if "rm_dep" in request.POST:
1770 rm_dep = LayerVersionDependency.objects.get(layer_version=layer_version, depends_on_id=request.POST["rm_dep"])
1771 rm_dep.delete()
1772
1773 if "summary" in request.POST:
1774 layer_version.layer.summary = request.POST["summary"]
1775 if "description" in request.POST:
1776 layer_version.layer.description = request.POST["description"]
1777
1778 try:
1779 layer_version.layer.save()
1780 layer_version.save()
1781 except Exception as e:
1782 return error_response("Could not update layer version entry: %s" % e)
1783
1784 return HttpResponse(jsonfilter({"error": "ok",}), content_type = "application/json")
1785 1742
1786 @xhr_response 1743 @xhr_response
1787 def xhr_customrecipe(request): 1744 def xhr_customrecipe(request):