diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui/views.py')
-rwxr-xr-x | bitbake/lib/toaster/toastergui/views.py | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 9f214bb677..a0dcf8797a 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
@@ -2015,10 +2015,20 @@ if toastermain.settings.MANAGED: | |||
2015 | response['Pragma'] = "no-cache" | 2015 | response['Pragma'] = "no-cache" |
2016 | return response | 2016 | return response |
2017 | 2017 | ||
2018 | # This is a wrapper for xhr_projectbuild which allows for a project id | ||
2019 | # which only becomes known client side. | ||
2020 | def xhr_build(request): | ||
2021 | if request.POST.has_key("project_id"): | ||
2022 | pid = request.POST['project_id'] | ||
2023 | return xhr_projectbuild(request, pid) | ||
2024 | else: | ||
2025 | raise BadParameterException("invalid project id") | ||
2026 | |||
2018 | def xhr_projectbuild(request, pid): | 2027 | def xhr_projectbuild(request, pid): |
2019 | try: | 2028 | try: |
2020 | if request.method != "POST": | 2029 | if request.method != "POST": |
2021 | raise BadParameterException("invalid method") | 2030 | raise BadParameterException("invalid method") |
2031 | request.session['project_id'] = pid | ||
2022 | prj = Project.objects.get(id = pid) | 2032 | prj = Project.objects.get(id = pid) |
2023 | 2033 | ||
2024 | 2034 | ||
@@ -2057,6 +2067,8 @@ if toastermain.settings.MANAGED: | |||
2057 | except Exception as e: | 2067 | except Exception as e: |
2058 | return HttpResponse(jsonfilter({"error":str(e) + "\n" + traceback.format_exc()}), content_type = "application/json") | 2068 | return HttpResponse(jsonfilter({"error":str(e) + "\n" + traceback.format_exc()}), content_type = "application/json") |
2059 | 2069 | ||
2070 | # This is a wraper for xhr_projectedit which allows for a project id | ||
2071 | # which only becomes known client side | ||
2060 | def xhr_projectinfo(request): | 2072 | def xhr_projectinfo(request): |
2061 | if request.POST.has_key("project_id") == False: | 2073 | if request.POST.has_key("project_id") == False: |
2062 | raise BadParameterException("invalid project id") | 2074 | raise BadParameterException("invalid project id") |
@@ -2121,8 +2133,12 @@ if toastermain.settings.MANAGED: | |||
2121 | def xhr_datatypeahead(request): | 2133 | def xhr_datatypeahead(request): |
2122 | try: | 2134 | try: |
2123 | prj = None | 2135 | prj = None |
2124 | if 'project_id' in request.session: | 2136 | if request.GET.has_key('project_id'): |
2137 | prj = Project.objects.get(pk = request.GET['project_id']) | ||
2138 | elif 'project_id' in request.session: | ||
2125 | prj = Project.objects.get(pk = request.session['project_id']) | 2139 | prj = Project.objects.get(pk = request.session['project_id']) |
2140 | else: | ||
2141 | raise Exception("No valid project selected") | ||
2126 | 2142 | ||
2127 | # returns layers for current project release that are not in the project set | 2143 | # returns layers for current project release that are not in the project set |
2128 | if request.GET['type'] == "layers": | 2144 | if request.GET['type'] == "layers": |
@@ -2188,6 +2204,14 @@ if toastermain.settings.MANAGED: | |||
2188 | 2204 | ||
2189 | }), content_type = "application/json") | 2205 | }), content_type = "application/json") |
2190 | 2206 | ||
2207 | if request.GET['type'] == "projects": | ||
2208 | queryset_all = Project.objects.all() | ||
2209 | ret = { "error": "ok", | ||
2210 | "list": map (lambda x: {"id":x.pk, "name": x.name}, | ||
2211 | queryset_all.filter(name__icontains=request.GET.get('value',''))[:8])} | ||
2212 | |||
2213 | return HttpResponse(jsonfilter(ret), content_type = "application/json") | ||
2214 | |||
2191 | raise Exception("Unknown request! " + request.GET.get('type', "No parameter supplied")) | 2215 | raise Exception("Unknown request! " + request.GET.get('type', "No parameter supplied")) |
2192 | except Exception as e: | 2216 | except Exception as e: |
2193 | return HttpResponse(jsonfilter({"error":str(e) + "\n" + traceback.format_exc()}), content_type = "application/json") | 2217 | return HttpResponse(jsonfilter({"error":str(e) + "\n" + traceback.format_exc()}), content_type = "application/json") |
@@ -2773,6 +2797,12 @@ else: | |||
2773 | def xhr_projectbuild(request, pid): | 2797 | def xhr_projectbuild(request, pid): |
2774 | raise Exception("page not available in interactive mode") | 2798 | raise Exception("page not available in interactive mode") |
2775 | 2799 | ||
2800 | def xhr_build(request, pid): | ||
2801 | raise Exception("page not available in interactive mode") | ||
2802 | |||
2803 | def xhr_projectinfo(request, pid): | ||
2804 | raise Exception("page not available in interactive mode") | ||
2805 | |||
2776 | def xhr_projectedit(request, pid): | 2806 | def xhr_projectedit(request, pid): |
2777 | raise Exception("page not available in interactive mode") | 2807 | raise Exception("page not available in interactive mode") |
2778 | 2808 | ||