diff options
author | Michael Wood <michael.g.wood@intel.com> | 2014-11-14 18:12:20 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-11-21 11:49:23 +0000 |
commit | 5b8a62dad7d429034c52290385da570c5ca1da34 (patch) | |
tree | 7102d4169f81f41aa64abd591084efe09c00528d /bitbake | |
parent | fa9206e42710772b8aac918b7aba01e126e993ce (diff) | |
download | poky-5b8a62dad7d429034c52290385da570c5ca1da34.tar.gz |
bitbake: toaster: libtoaster: Add getProjectInfo utility function
Add a utility function to return a specified project's info/config
This re-uses the existing server code path for the project edit
except that it allows any project id to be used as a parameter
(Bitbake rev: af42ea5f006c5cf55a7c57a42904f412639d261f)
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/libtoaster.js | 22 | ||||
-rw-r--r-- | bitbake/lib/toaster/toastergui/urls.py | 1 | ||||
-rwxr-xr-x | bitbake/lib/toaster/toastergui/views.py | 5 |
3 files changed, 27 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js index b899b8de4d..4983ef6f6d 100644 --- a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js +++ b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js | |||
@@ -88,10 +88,32 @@ var libtoaster = (function (){ | |||
88 | } }); | 88 | } }); |
89 | }; | 89 | }; |
90 | 90 | ||
91 | /* Get a project's configuration info */ | ||
92 | function _getProjectInfo(url, projectId, onsuccess, onfail){ | ||
93 | $.ajax({ | ||
94 | type: "POST", | ||
95 | url: url, | ||
96 | data: { project_id : projectId }, | ||
97 | headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, | ||
98 | success: function (_data) { | ||
99 | if (_data.error != "ok") { | ||
100 | console.log(_data.error); | ||
101 | } else { | ||
102 | if (onsuccess != undefined) onsuccess(_data); | ||
103 | } | ||
104 | }, | ||
105 | error: function (_data) { | ||
106 | console.log(_data); | ||
107 | if (onfail) onfail(data); | ||
108 | } | ||
109 | }); | ||
110 | }; | ||
111 | |||
91 | return { | 112 | return { |
92 | reload_params : reload_params, | 113 | reload_params : reload_params, |
93 | startABuild : _startABuild, | 114 | startABuild : _startABuild, |
94 | makeTypeahead : _makeTypeahead, | 115 | makeTypeahead : _makeTypeahead, |
116 | getProjectInfo: _getProjectInfo, | ||
95 | } | 117 | } |
96 | })(); | 118 | })(); |
97 | 119 | ||
diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py index f43bb64653..bae7103091 100644 --- a/bitbake/lib/toaster/toastergui/urls.py +++ b/bitbake/lib/toaster/toastergui/urls.py | |||
@@ -85,6 +85,7 @@ urlpatterns = patterns('toastergui.views', | |||
85 | url(r'^project/(?P<pid>\d+)/builds$', 'projectbuilds', name='projectbuilds'), | 85 | url(r'^project/(?P<pid>\d+)/builds$', 'projectbuilds', name='projectbuilds'), |
86 | 86 | ||
87 | url(r'^xhr_projectbuild/(?P<pid>\d+)/$', 'xhr_projectbuild', name='xhr_projectbuild'), | 87 | url(r'^xhr_projectbuild/(?P<pid>\d+)/$', 'xhr_projectbuild', name='xhr_projectbuild'), |
88 | url(r'^xhr_projectinfo/$', 'xhr_projectinfo', name='xhr_projectinfo'), | ||
88 | url(r'^xhr_projectedit/(?P<pid>\d+)/$', 'xhr_projectedit', name='xhr_projectedit'), | 89 | url(r'^xhr_projectedit/(?P<pid>\d+)/$', 'xhr_projectedit', name='xhr_projectedit'), |
89 | 90 | ||
90 | url(r'^xhr_datatypeahead/$', 'xhr_datatypeahead', name='xhr_datatypeahead'), | 91 | url(r'^xhr_datatypeahead/$', 'xhr_datatypeahead', name='xhr_datatypeahead'), |
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 1b4bb9ff69..9f214bb677 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
@@ -2057,8 +2057,11 @@ if toastermain.settings.MANAGED: | |||
2057 | except Exception as e: | 2057 | except Exception as e: |
2058 | return HttpResponse(jsonfilter({"error":str(e) + "\n" + traceback.format_exc()}), content_type = "application/json") | 2058 | return HttpResponse(jsonfilter({"error":str(e) + "\n" + traceback.format_exc()}), content_type = "application/json") |
2059 | 2059 | ||
2060 | def xhr_projectinfo(request): | ||
2061 | if request.POST.has_key("project_id") == False: | ||
2062 | raise BadParameterException("invalid project id") | ||
2060 | 2063 | ||
2061 | 2064 | return xhr_projectedit(request, request.POST['project_id']) | |
2062 | 2065 | ||
2063 | def xhr_projectedit(request, pid): | 2066 | def xhr_projectedit(request, pid): |
2064 | try: | 2067 | try: |