bitbake: toastergui: http api Add guard against incomplete change requests
If we get a request to the project change api which either contains the current configuration (i.e no change) or empty configuration handle this gracefully. (Bitbake rev: cc6c606c07baadc849c3290b23c56ad4e719fba2) 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>
This commit is contained in:
parent
7a589c0b20
commit
9af7ce513c
|
@ -2160,12 +2160,12 @@ if True:
|
|||
# execute POST requests
|
||||
if request.method == "POST":
|
||||
# add layers
|
||||
if 'layerAdd' in request.POST:
|
||||
if 'layerAdd' in request.POST and len(request.POST['layerAdd']) > 0:
|
||||
for lc in Layer_Version.objects.filter(pk__in=[i for i in request.POST['layerAdd'].split(",") if len(i) > 0]):
|
||||
ProjectLayer.objects.get_or_create(project = prj, layercommit = lc)
|
||||
|
||||
# remove layers
|
||||
if 'layerDel' in request.POST:
|
||||
if 'layerDel' in request.POST and len(request.POST['layerDel']) > 0:
|
||||
for t in request.POST['layerDel'].strip().split(" "):
|
||||
pt = ProjectLayer.objects.filter(project = prj, layercommit_id = int(t)).delete()
|
||||
|
||||
|
@ -2174,6 +2174,10 @@ if True:
|
|||
prj.save();
|
||||
|
||||
if 'projectVersion' in request.POST:
|
||||
# If the release is the current project then return now
|
||||
if prj.release.pk == int(request.POST.get('projectVersion',-1)):
|
||||
return {}
|
||||
|
||||
prj.release = Release.objects.get(pk = request.POST['projectVersion'])
|
||||
# we need to change the bitbake version
|
||||
prj.bitbake_version = prj.release.bitbake_version
|
||||
|
@ -2257,8 +2261,12 @@ if True:
|
|||
|
||||
# returns layer versions that would be deleted on the new release__pk
|
||||
if request.GET.get('type', None) == "versionlayers":
|
||||
# If we're already on this project do nothing
|
||||
if prj.release.pk == int(request.GET.get('search', -1)):
|
||||
return HttpResponse(jsonfilter({"error": "ok", "rows": []}), content_type="application/json")
|
||||
|
||||
retval = []
|
||||
|
||||
for i in prj.projectlayer_set.all():
|
||||
lv = prj.compatible_layerversions(release = Release.objects.get(pk=request.GET.get('search', None))).filter(layer__name = i.layercommit.layer.name)
|
||||
# there is no layer_version with the new release id, and the same name
|
||||
|
|
Loading…
Reference in New Issue