aboutsummaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-08-04 22:46:36 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-06 16:04:46 -0500
commit951e40dd7d77ca5fcad35204817cfae916c267e5 (patch)
tree19200baebde063d9e4c57d1967797fd6064c1373 /bitbake
parent1e7707b63f91eb310e3207da4d9cdd831a4851c5 (diff)
downloadopenembedded-core-contrib-951e40dd7d77ca5fcad35204817cfae916c267e5.tar.gz
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>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/projectpage.js4
-rw-r--r--bitbake/lib/toaster/toastergui/templates/project.html3
-rw-r--r--bitbake/lib/toaster/toastergui/urls.py8
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py60
4 files changed, 32 insertions, 43 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/projectpage.js b/bitbake/lib/toaster/toastergui/static/js/projectpage.js
index b82f7408e7..146319e042 100644
--- a/bitbake/lib/toaster/toastergui/static/js/projectpage.js
+++ b/bitbake/lib/toaster/toastergui/static/js/projectpage.js
@@ -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 */
diff --git a/bitbake/lib/toaster/toastergui/templates/project.html b/bitbake/lib/toaster/toastergui/templates/project.html
index d21f4bd7e5..e8354fd678 100644
--- a/bitbake/lib/toaster/toastergui/templates/project.html
+++ b/bitbake/lib/toaster/toastergui/templates/project.html
@@ -11,8 +11,7 @@
<script>
$(document).ready(function (){
var ctx = {
- typeaheadUrl : "{% url 'xhr_datatypeahead' project.id %}",
-
+ testReleaseChangeUrl: "{% url 'xhr_testreleasechange' project.id %}",
};
try {
diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py
index b44c42f2e3..d65ad2bfbb 100644
--- a/bitbake/lib/toaster/toastergui/urls.py
+++ b/bitbake/lib/toaster/toastergui/urls.py
@@ -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'),
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index b7bfb9a69d..6a219ede0c 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -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 = []
-
- 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 HttpResponse(jsonfilter( {"error":"ok",
- "rows" : map( _lv_to_dict(prj), map(lambda x: x.layercommit, retval ))
- }), content_type = "application/json")
+ 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)
- # 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))
+ return response({"error":"ok",
+ "rows" : map( _lv_to_dict(prj),
+ map(lambda x: x.layercommit, retval ))
+ })
- # 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: