mirror of
https://git.yoctoproject.org/poky
synced 2026-05-09 05:29:32 +00:00
bitbake: toasterui: views Remove unused xhr_typeahead view definition
The one thing left being used in this definition was a response which contains the list of layers which would be deleted if you change the project release. This patch moves that to it's own url/endpoint and updates the frontend reference which is using it. (Bitbake rev: 1cc19c84ee97182f39eae0338c712f7a2b40a18d) 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:
committed by
Richard Purdie
parent
1e7707b63f
commit
951e40dd7d
@@ -406,8 +406,8 @@ function projectPageInit(ctx) {
|
||||
|
||||
var newRelease = releaseForm.find("option:selected").data('release');
|
||||
|
||||
$.getJSON(ctx.typeaheadUrl,
|
||||
{ search: newRelease.id, type: "versionlayers" },
|
||||
$.getJSON(ctx.testReleaseChangeUrl,
|
||||
{ new_release_id: newRelease.id },
|
||||
function(layers) {
|
||||
if (layers.rows.length === 0){
|
||||
/* No layers to change for this release */
|
||||
|
||||
@@ -11,8 +11,7 @@
|
||||
<script>
|
||||
$(document).ready(function (){
|
||||
var ctx = {
|
||||
typeaheadUrl : "{% url 'xhr_datatypeahead' project.id %}",
|
||||
|
||||
testReleaseChangeUrl: "{% url 'xhr_testreleasechange' project.id %}",
|
||||
};
|
||||
|
||||
try {
|
||||
|
||||
@@ -126,8 +126,6 @@ urlpatterns = patterns('toastergui.views',
|
||||
name=tables.LayerMachinesTable.__name__.lower()),
|
||||
|
||||
|
||||
url(r'^xhr_datatypeahead/(?P<pid>\d+)$', 'xhr_datatypeahead', name='xhr_datatypeahead'),
|
||||
url(r'^xhr_configvaredit/(?P<pid>\d+)$', 'xhr_configvaredit', name='xhr_configvaredit'),
|
||||
# typeahead api end points
|
||||
url(r'^xhr_typeahead/(?P<pid>\d+)/layers$',
|
||||
typeaheads.LayersTypeAhead.as_view(), name='xhr_layerstypeahead'),
|
||||
@@ -139,6 +137,12 @@ urlpatterns = patterns('toastergui.views',
|
||||
typeaheads.ProjectsTypeAhead.as_view(), name='xhr_projectstypeahead'),
|
||||
|
||||
|
||||
|
||||
url(r'^xhr_testreleasechange/(?P<pid>\d+)$', 'xhr_testreleasechange',
|
||||
name='xhr_testreleasechange'),
|
||||
url(r'^xhr_configvaredit/(?P<pid>\d+)$', 'xhr_configvaredit',
|
||||
name='xhr_configvaredit'),
|
||||
|
||||
url(r'^xhr_importlayer/$', 'xhr_importlayer', name='xhr_importlayer'),
|
||||
url(r'^xhr_updatelayer/$', 'xhr_updatelayer', name='xhr_updatelayer'),
|
||||
|
||||
|
||||
@@ -2257,51 +2257,37 @@ if True:
|
||||
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
@csrf_exempt
|
||||
def xhr_datatypeahead(request, pid):
|
||||
def xhr_testreleasechange(request, pid):
|
||||
def response(data):
|
||||
return HttpResponse(jsonfilter(data),
|
||||
content_type="application/json")
|
||||
|
||||
""" returns layer versions that would be deleted on the new
|
||||
release__pk """
|
||||
try:
|
||||
prj = Project.objects.get(pk = pid)
|
||||
new_release_id = request.GET['new_release_id']
|
||||
|
||||
# If we're already on this project do nothing
|
||||
if prj.release.pk == int(new_release_id):
|
||||
return reponse({"error": "ok", "rows": []})
|
||||
|
||||
# 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 = []
|
||||
|
||||
retval = []
|
||||
for i in prj.projectlayer_set.all():
|
||||
lv = prj.compatible_layerversions(release = Release.objects.get(pk=new_release_id)).filter(layer__name = i.layercommit.layer.name)
|
||||
# there is no layer_version with the new release id,
|
||||
# and the same name
|
||||
if lv.count() < 1:
|
||||
retval.append(i)
|
||||
|
||||
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
|
||||
if lv.count() < 1:
|
||||
retval.append(i)
|
||||
return response({"error":"ok",
|
||||
"rows" : map( _lv_to_dict(prj),
|
||||
map(lambda x: x.layercommit, retval ))
|
||||
})
|
||||
|
||||
return HttpResponse(jsonfilter( {"error":"ok",
|
||||
"rows" : map( _lv_to_dict(prj), map(lambda x: x.layercommit, retval ))
|
||||
}), content_type = "application/json")
|
||||
|
||||
|
||||
# returns layer versions that provide the named targets
|
||||
if request.GET.get('type', None) == "layers4target":
|
||||
# we return data only if the recipe can't be provided by the current project layer set
|
||||
if reduce(lambda x, y: x + y, [x.recipe_layer_version.filter(name=request.GET.get('search', None)).count() for x in prj.projectlayer_equivalent_set()], 0):
|
||||
final_list = []
|
||||
else:
|
||||
queryset_all = prj.compatible_layerversions().filter(recipe_layer_version__name = request.GET.get('search', None))
|
||||
|
||||
# exclude layers in the project
|
||||
queryset_all = queryset_all.exclude(pk__in = [x.id for x in prj.projectlayer_equivalent_set()])
|
||||
|
||||
# and show only the selected layers for this project
|
||||
final_list = set([x.get_equivalents_wpriority(prj)[0] for x in queryset_all])
|
||||
|
||||
return HttpResponse(jsonfilter( { "error":"ok", "rows" : map( _lv_to_dict(prj), final_list) }), content_type = "application/json")
|
||||
|
||||
|
||||
raise Exception("Unknown request! " + request.GET.get('type', "No parameter supplied"))
|
||||
except Exception as e:
|
||||
return HttpResponse(jsonfilter({"error":str(e) + "\n" + traceback.format_exc()}), content_type = "application/json")
|
||||
|
||||
return response({"error": str(e) })
|
||||
|
||||
def xhr_configvaredit(request, pid):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user