summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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) {
406 406
407 var newRelease = releaseForm.find("option:selected").data('release'); 407 var newRelease = releaseForm.find("option:selected").data('release');
408 408
409 $.getJSON(ctx.typeaheadUrl, 409 $.getJSON(ctx.testReleaseChangeUrl,
410 { search: newRelease.id, type: "versionlayers" }, 410 { new_release_id: newRelease.id },
411 function(layers) { 411 function(layers) {
412 if (layers.rows.length === 0){ 412 if (layers.rows.length === 0){
413 /* No layers to change for this release */ 413 /* 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 @@
11<script> 11<script>
12 $(document).ready(function (){ 12 $(document).ready(function (){
13 var ctx = { 13 var ctx = {
14 typeaheadUrl : "{% url 'xhr_datatypeahead' project.id %}", 14 testReleaseChangeUrl: "{% url 'xhr_testreleasechange' project.id %}",
15
16 }; 15 };
17 16
18 try { 17 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',
126 name=tables.LayerMachinesTable.__name__.lower()), 126 name=tables.LayerMachinesTable.__name__.lower()),
127 127
128 128
129 url(r'^xhr_datatypeahead/(?P<pid>\d+)$', 'xhr_datatypeahead', name='xhr_datatypeahead'),
130 url(r'^xhr_configvaredit/(?P<pid>\d+)$', 'xhr_configvaredit', name='xhr_configvaredit'),
131 # typeahead api end points 129 # typeahead api end points
132 url(r'^xhr_typeahead/(?P<pid>\d+)/layers$', 130 url(r'^xhr_typeahead/(?P<pid>\d+)/layers$',
133 typeaheads.LayersTypeAhead.as_view(), name='xhr_layerstypeahead'), 131 typeaheads.LayersTypeAhead.as_view(), name='xhr_layerstypeahead'),
@@ -139,6 +137,12 @@ urlpatterns = patterns('toastergui.views',
139 typeaheads.ProjectsTypeAhead.as_view(), name='xhr_projectstypeahead'), 137 typeaheads.ProjectsTypeAhead.as_view(), name='xhr_projectstypeahead'),
140 138
141 139
140
141 url(r'^xhr_testreleasechange/(?P<pid>\d+)$', 'xhr_testreleasechange',
142 name='xhr_testreleasechange'),
143 url(r'^xhr_configvaredit/(?P<pid>\d+)$', 'xhr_configvaredit',
144 name='xhr_configvaredit'),
145
142 url(r'^xhr_importlayer/$', 'xhr_importlayer', name='xhr_importlayer'), 146 url(r'^xhr_importlayer/$', 'xhr_importlayer', name='xhr_importlayer'),
143 url(r'^xhr_updatelayer/$', 'xhr_updatelayer', name='xhr_updatelayer'), 147 url(r'^xhr_updatelayer/$', 'xhr_updatelayer', name='xhr_updatelayer'),
144 148
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:
2257 2257
2258 from django.views.decorators.csrf import csrf_exempt 2258 from django.views.decorators.csrf import csrf_exempt
2259 @csrf_exempt 2259 @csrf_exempt
2260 def xhr_datatypeahead(request, pid): 2260 def xhr_testreleasechange(request, pid):
2261 def response(data):
2262 return HttpResponse(jsonfilter(data),
2263 content_type="application/json")
2264
2265 """ returns layer versions that would be deleted on the new
2266 release__pk """
2261 try: 2267 try:
2262 prj = Project.objects.get(pk = pid) 2268 prj = Project.objects.get(pk = pid)
2269 new_release_id = request.GET['new_release_id']
2263 2270
2271 # If we're already on this project do nothing
2272 if prj.release.pk == int(new_release_id):
2273 return reponse({"error": "ok", "rows": []})
2264 2274
2265 # returns layer versions that would be deleted on the new release__pk 2275 retval = []
2266 if request.GET.get('type', None) == "versionlayers":
2267 # If we're already on this project do nothing
2268 if prj.release.pk == int(request.GET.get('search', -1)):
2269 return HttpResponse(jsonfilter({"error": "ok", "rows": []}), content_type="application/json")
2270
2271 retval = []
2272
2273 for i in prj.projectlayer_set.all():
2274 lv = prj.compatible_layerversions(release = Release.objects.get(pk=request.GET.get('search', None))).filter(layer__name = i.layercommit.layer.name)
2275 # there is no layer_version with the new release id, and the same name
2276 if lv.count() < 1:
2277 retval.append(i)
2278
2279 return HttpResponse(jsonfilter( {"error":"ok",
2280 "rows" : map( _lv_to_dict(prj), map(lambda x: x.layercommit, retval ))
2281 }), content_type = "application/json")
2282 2276
2277 for i in prj.projectlayer_set.all():
2278 lv = prj.compatible_layerversions(release = Release.objects.get(pk=new_release_id)).filter(layer__name = i.layercommit.layer.name)
2279 # there is no layer_version with the new release id,
2280 # and the same name
2281 if lv.count() < 1:
2282 retval.append(i)
2283 2283
2284 # returns layer versions that provide the named targets 2284 return response({"error":"ok",
2285 if request.GET.get('type', None) == "layers4target": 2285 "rows" : map( _lv_to_dict(prj),
2286 # we return data only if the recipe can't be provided by the current project layer set 2286 map(lambda x: x.layercommit, retval ))
2287 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): 2287 })
2288 final_list = []
2289 else:
2290 queryset_all = prj.compatible_layerversions().filter(recipe_layer_version__name = request.GET.get('search', None))
2291 2288
2292 # exclude layers in the project
2293 queryset_all = queryset_all.exclude(pk__in = [x.id for x in prj.projectlayer_equivalent_set()])
2294
2295 # and show only the selected layers for this project
2296 final_list = set([x.get_equivalents_wpriority(prj)[0] for x in queryset_all])
2297
2298 return HttpResponse(jsonfilter( { "error":"ok", "rows" : map( _lv_to_dict(prj), final_list) }), content_type = "application/json")
2299
2300
2301 raise Exception("Unknown request! " + request.GET.get('type', "No parameter supplied"))
2302 except Exception as e: 2289 except Exception as e:
2303 return HttpResponse(jsonfilter({"error":str(e) + "\n" + traceback.format_exc()}), content_type = "application/json") 2290 return response({"error": str(e) })
2304
2305 2291
2306 def xhr_configvaredit(request, pid): 2292 def xhr_configvaredit(request, pid):
2307 try: 2293 try: