diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-06-08 18:33:44 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-06-12 00:01:49 +0100 |
commit | 58cd4a14ea81b72dcd9679608e5e2231ec3d3631 (patch) | |
tree | 15cea3afb06ad5ae448fbf2fb65bfb4cb7535308 /bitbake/lib/toaster/toastergui/views.py | |
parent | 27f5137cd6143b523e9aea8eeba406337aa935c4 (diff) | |
download | poky-58cd4a14ea81b72dcd9679608e5e2231ec3d3631.tar.gz |
bitbake: toaster: fixes after refactoring
This patch fixes issues brought in by refactoring:
* the New Build button is working with pre-set projects
* the xhr_datatypeahead is exposed for calls that are not
mapable to the REST objects
* a new table returing recipes provided by layers currently
selected in the project is used to provide recipe suggestions
* the field names in json are switched from "list" to "rows" as
to maintain consistency with the ToasterTables
* the "value" field in xhr_ calls is now named "search" to maintain
consistency
(Bitbake rev: a5bc29083d4f85a5695f3f62d5badb783c6f7224)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/views.py')
-rwxr-xr-x | bitbake/lib/toaster/toastergui/views.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index b2b263b6e0..4dac62c568 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
@@ -129,9 +129,9 @@ def _template_renderer(template): | |||
129 | 129 | ||
130 | if request.GET.get('format', None) == 'json': | 130 | if request.GET.get('format', None) == 'json': |
131 | # objects is a special keyword - it's a Page, but we need the actual objects here | 131 | # objects is a special keyword - it's a Page, but we need the actual objects here |
132 | # in XHR, the objects come in the "list" property | 132 | # in XHR, the objects come in the "rows" property |
133 | if "objects" in context: | 133 | if "objects" in context: |
134 | context["list"] = context["objects"].object_list | 134 | context["rows"] = context["objects"].object_list |
135 | del context["objects"] | 135 | del context["objects"] |
136 | 136 | ||
137 | # we're about to return; to keep up with the XHR API, we set the error to OK | 137 | # we're about to return; to keep up with the XHR API, we set the error to OK |
@@ -2340,7 +2340,7 @@ if toastermain.settings.MANAGED: | |||
2340 | retval.append(i) | 2340 | retval.append(i) |
2341 | 2341 | ||
2342 | return HttpResponse(jsonfilter( {"error":"ok", | 2342 | return HttpResponse(jsonfilter( {"error":"ok", |
2343 | "list" : map( _lv_to_dict(prj), map(lambda x: x.layercommit, retval )) | 2343 | "rows" : map( _lv_to_dict(prj), map(lambda x: x.layercommit, retval )) |
2344 | }), content_type = "application/json") | 2344 | }), content_type = "application/json") |
2345 | 2345 | ||
2346 | 2346 | ||
@@ -2358,7 +2358,7 @@ if toastermain.settings.MANAGED: | |||
2358 | # and show only the selected layers for this project | 2358 | # and show only the selected layers for this project |
2359 | final_list = set([x.get_equivalents_wpriority(prj)[0] for x in queryset_all]) | 2359 | final_list = set([x.get_equivalents_wpriority(prj)[0] for x in queryset_all]) |
2360 | 2360 | ||
2361 | return HttpResponse(jsonfilter( { "error":"ok", "list" : map( _lv_to_dict(prj), final_list) }), content_type = "application/json") | 2361 | return HttpResponse(jsonfilter( { "error":"ok", "rows" : map( _lv_to_dict(prj), final_list) }), content_type = "application/json") |
2362 | 2362 | ||
2363 | 2363 | ||
2364 | raise Exception("Unknown request! " + request.GET.get('type', "No parameter supplied")) | 2364 | raise Exception("Unknown request! " + request.GET.get('type', "No parameter supplied")) |
@@ -2845,7 +2845,7 @@ if toastermain.settings.MANAGED: | |||
2845 | p.projectPageUrl = reverse('project', args=(p.id,)) | 2845 | p.projectPageUrl = reverse('project', args=(p.id,)) |
2846 | p.projectLayersUrl = reverse('projectlayers', args=(p.id,)) | 2846 | p.projectLayersUrl = reverse('projectlayers', args=(p.id,)) |
2847 | p.projectBuildsUrl = reverse('projectbuilds', args=(p.id,)) | 2847 | p.projectBuildsUrl = reverse('projectbuilds', args=(p.id,)) |
2848 | p.projectTargetsUrl = reverse('projecttargets', args=(p.id,)) | 2848 | p.projectTargetsUrl = reverse('projectavailabletargets', args=(p.id,)) |
2849 | 2849 | ||
2850 | # build view-specific information; this is rendered specifically in the builds page, at the top of the page (i.e. Recent builds) | 2850 | # build view-specific information; this is rendered specifically in the builds page, at the top of the page (i.e. Recent builds) |
2851 | build_mru = _managed_get_latest_builds() | 2851 | build_mru = _managed_get_latest_builds() |
@@ -3144,6 +3144,13 @@ else: | |||
3144 | def project(request, pid): | 3144 | def project(request, pid): |
3145 | return {} | 3145 | return {} |
3146 | 3146 | ||
3147 | from django.views.decorators.csrf import csrf_exempt | ||
3148 | @csrf_exempt | ||
3149 | @_template_renderer('landing_not_managed.html') | ||
3150 | def xhr_datatypeahead(request, pid): | ||
3151 | return {} | ||
3152 | |||
3153 | |||
3147 | @_template_renderer('landing_not_managed.html') | 3154 | @_template_renderer('landing_not_managed.html') |
3148 | def xhr_configvaredit(request, pid): | 3155 | def xhr_configvaredit(request, pid): |
3149 | return {} | 3156 | return {} |